go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxMetricBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __elxMetricBase_h
19 #define __elxMetricBase_h
20 
22 #include "elxMacro.h"
23 
24 #include "elxBaseComponentSE.h"
26 #include "itkImageGridSampler.h"
27 #include "itkPointSet.h"
28 
29 
30 namespace elastix
31 {
32 
72 template< class TElastix >
73 class MetricBase : public BaseComponentSE< TElastix >
74 {
75 public:
76 
78  typedef MetricBase Self;
80 
82  itkTypeMacro( MetricBase, BaseComponentSE );
83 
85  typedef typename Superclass::ElastixType ElastixType;
91 
93  typedef typename ElastixType::FixedImageType FixedImageType;
94  typedef typename FixedImageType::PointType FixedPointType;
95  typedef typename FixedPointType::ValueType FixedPointValueType;
96  typedef typename ElastixType::MovingImageType MovingImageType;
97  typedef typename MovingImageType::PointType MovingPointType;
98  typedef typename MovingPointType::ValueType MovingPointValueType;
99 
101  typedef itk::SingleValuedCostFunction ITKBaseType;
103  FixedImageType, MovingImageType > AdvancedMetricType;
105 
107  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
109  itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension );
110 
112  typedef typename ITKBaseType::ParametersValueType CoordinateRepresentationType;
113  typedef itk::PointSet<
114  CoordinateRepresentationType, FixedImageDimension,
115  itk::DefaultStaticMeshTraits<
117  FixedImageDimension, FixedImageDimension,
119  CoordinateRepresentationType > > FixedPointSetType;
120  typedef itk::PointSet<
121  CoordinateRepresentationType, MovingImageDimension,
122  itk::DefaultStaticMeshTraits<
124  MovingImageDimension, MovingImageDimension,
126  CoordinateRepresentationType > > MovingPointSetType;
127 
130 
132  typedef typename ITKBaseType::MeasureType MeasureType;
133 
135  virtual ITKBaseType * GetAsITKBaseType( void )
136  {
137  return dynamic_cast< ITKBaseType * >( this );
138  }
139 
140 
142  virtual const ITKBaseType * GetAsITKBaseType( void ) const
143  {
144  return dynamic_cast< const ITKBaseType * >( this );
145  }
146 
147 
152  virtual void BeforeEachResolutionBase( void );
153 
157  virtual void AfterEachIterationBase( void );
158 
162  virtual void SelectNewSamples( void );
163 
167  virtual bool GetAdvancedMetricUseImageSampler( void ) const;
168 
173  virtual void SetAdvancedMetricImageSampler( ImageSamplerBaseType * sampler );
174 
179  virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler( void ) const;
180 
182  virtual bool GetShowExactMetricValue( void ) const
183  { return this->m_ShowExactMetricValue; }
184 
186  virtual MeasureType GetCurrentExactMetricValue( void ) const
187  { return this->m_CurrentExactMetricValue; }
188 
189 protected:
190 
192  typedef typename ITKBaseType::ParametersType ParametersType;
193 
198 
200  MetricBase();
202  virtual ~MetricBase() {}
203 
213  virtual MeasureType GetExactValue( const ParametersType & parameters );
214 
218  ExactMetricImageSamplerPointer m_ExactMetricSampler;
220  ExactMetricSampleGridSpacingType m_ExactMetricSampleGridSpacing;
221 
222 private:
223 
225  MetricBase( const Self & ); // purposely not implemented
227  void operator=( const Self & ); // purposely not implemented
228 
229 };
230 
231 } // end namespace elastix
232 
233 #ifndef ITK_MANUAL_INSTANTIATION
234 #include "elxMetricBase.hxx"
235 #endif
236 
237 #endif // end #ifndef __elxMetricBase_h
The BaseComponentSE class is a base class for elastix components that provides some basic functionali...
Superclass::ElastixPointer ElastixPointer
Definition: elxMetricBase.h:86
Superclass::RegistrationType RegistrationType
Definition: elxMetricBase.h:89
ITKBaseType::MeasureType MeasureType
virtual MeasureType GetCurrentExactMetricValue(void) const
ElastixType::RegistrationBaseType RegistrationType
ElastixType::ConfigurationPointer ConfigurationPointer
Superclass::ConfigurationType ConfigurationType
Definition: elxMetricBase.h:87
ExactMetricImageSamplerPointer m_ExactMetricSampler
ElastixType::Pointer ElastixPointer
ElastixType::ConfigurationType ConfigurationType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
AdvancedMetricType::ImageSamplerType ImageSamplerBaseType
virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler(void) const
virtual bool GetShowExactMetricValue(void) const
itk::PointSet< CoordinateRepresentationType, FixedImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, FixedImageDimension, FixedImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > FixedPointSetType
InputImageType::OffsetType SampleGridSpacingType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
ElastixType::FixedImageType FixedImageType
Definition: elxMetricBase.h:93
virtual void BeforeEachResolutionBase(void)
virtual void SelectNewSamples(void)
virtual ITKBaseType * GetAsITKBaseType(void)
RegistrationType * RegistrationPointer
This class is a base class for any image sampler.
MovingPointType::ValueType MovingPointValueType
Definition: elxMetricBase.h:98
BaseComponentSE< TElastix > Superclass
Definition: elxMetricBase.h:79
itk::ImageGridSampler< FixedImageType > ExactMetricImageSamplerType
ExactMetricImageSamplerType::Pointer ExactMetricImageSamplerPointer
MovingImageType::PointType MovingPointType
Definition: elxMetricBase.h:97
ITKBaseType::ParametersType ParametersType
FixedPointType::ValueType FixedPointValueType
Definition: elxMetricBase.h:95
MeasureType m_CurrentExactMetricValue
itk::AdvancedImageToImageMetric< FixedImageType, MovingImageType > AdvancedMetricType
FixedImageType::PointType FixedPointType
Definition: elxMetricBase.h:94
virtual void SetAdvancedMetricImageSampler(ImageSamplerBaseType *sampler)
Superclass::ElastixType ElastixType
Definition: elxMetricBase.h:82
itk::SingleValuedCostFunction ITKBaseType
itk::PointSet< CoordinateRepresentationType, MovingImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, MovingImageDimension, MovingImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
ElastixType::MovingImageType MovingImageType
Definition: elxMetricBase.h:96
Superclass::RegistrationPointer RegistrationPointer
Definition: elxMetricBase.h:90
virtual bool GetAdvancedMetricUseImageSampler(void) const
virtual void AfterEachIterationBase(void)
ITKBaseType::ParametersValueType CoordinateRepresentationType
virtual const ITKBaseType * GetAsITKBaseType(void) const
AdvancedMetricType::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
Superclass::ConfigurationPointer ConfigurationPointer
Definition: elxMetricBase.h:88
ExactMetricImageSamplerType::SampleGridSpacingType ExactMetricSampleGridSpacingType
ExactMetricSampleGridSpacingType m_ExactMetricSampleGridSpacing
Samples image voxels on a regular grid.
virtual MeasureType GetExactValue(const ParametersType &parameters)
This class is the elastix base class for all Metrics.
Definition: elxMetricBase.h:73
void operator=(const Self &)


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo