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 namespace elastix
30 {
31 
71 template< class TElastix >
72 class MetricBase : public BaseComponentSE< TElastix >
73 {
74 public:
75 
77  typedef MetricBase Self;
79 
81  itkTypeMacro( MetricBase, BaseComponentSE );
82 
84  typedef typename Superclass::ElastixType ElastixType;
90 
92  typedef typename ElastixType::FixedImageType FixedImageType;
93  typedef typename FixedImageType::PointType FixedPointType;
94  typedef typename FixedPointType::ValueType FixedPointValueType;
95  typedef typename ElastixType::MovingImageType MovingImageType;
96  typedef typename MovingImageType::PointType MovingPointType;
97  typedef typename MovingPointType::ValueType MovingPointValueType;
98 
100  typedef itk::SingleValuedCostFunction ITKBaseType;
102  FixedImageType, MovingImageType > AdvancedMetricType;
104 
106  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
108  itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension );
109 
111  typedef typename ITKBaseType::ParametersValueType CoordinateRepresentationType;
112  typedef itk::PointSet<
113  CoordinateRepresentationType, FixedImageDimension,
114  itk::DefaultStaticMeshTraits<
116  FixedImageDimension, FixedImageDimension,
118  CoordinateRepresentationType > > FixedPointSetType;
119  typedef itk::PointSet<
120  CoordinateRepresentationType, MovingImageDimension,
121  itk::DefaultStaticMeshTraits<
123  MovingImageDimension, MovingImageDimension,
125  CoordinateRepresentationType > > MovingPointSetType;
126 
129 
131  typedef typename ITKBaseType::MeasureType MeasureType;
132 
134  virtual ITKBaseType * GetAsITKBaseType( void )
135  {
136  return dynamic_cast< ITKBaseType * >( this );
137  }
138 
139 
141  virtual const ITKBaseType * GetAsITKBaseType( void ) const
142  {
143  return dynamic_cast< const ITKBaseType * >( this );
144  }
145 
146 
151  virtual void BeforeEachResolutionBase( void );
152 
156  virtual void AfterEachIterationBase( void );
157 
161  virtual void SelectNewSamples( void );
162 
166  virtual bool GetAdvancedMetricUseImageSampler( void ) const;
167 
172  virtual void SetAdvancedMetricImageSampler( ImageSamplerBaseType * sampler );
173 
178  virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler( void ) const;
179 
181  virtual bool GetShowExactMetricValue( void ) const
182  { return this->m_ShowExactMetricValue; }
183 
185  virtual MeasureType GetCurrentExactMetricValue( void ) const
186  { return this->m_CurrentExactMetricValue; }
187 
188 protected:
189 
191  typedef typename ITKBaseType::ParametersType ParametersType;
192 
197 
199  MetricBase();
201  virtual ~MetricBase() {}
202 
212  virtual MeasureType GetExactValue( const ParametersType & parameters );
213 
217  ExactMetricImageSamplerPointer m_ExactMetricSampler;
219  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:85
Superclass::RegistrationType RegistrationType
Definition: elxMetricBase.h:88
ITKBaseType::MeasureType MeasureType
ElastixType::RegistrationBaseType RegistrationType
ElastixType::ConfigurationPointer ConfigurationPointer
Superclass::ConfigurationType ConfigurationType
Definition: elxMetricBase.h:86
ExactMetricImageSamplerPointer m_ExactMetricSampler
ElastixType::ConfigurationType ConfigurationType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
AdvancedMetricType::ImageSamplerType ImageSamplerBaseType
virtual bool GetAdvancedMetricUseImageSampler(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:92
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:97
BaseComponentSE< TElastix > Superclass
Definition: elxMetricBase.h:78
itk::ImageGridSampler< FixedImageType > ExactMetricImageSamplerType
virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler(void) const
ExactMetricImageSamplerType::Pointer ExactMetricImageSamplerPointer
unsigned int m_ExactMetricEachXNumberOfIterations
MovingImageType::PointType MovingPointType
Definition: elxMetricBase.h:96
ITKBaseType::ParametersType ParametersType
FixedPointType::ValueType FixedPointValueType
Definition: elxMetricBase.h:94
MeasureType m_CurrentExactMetricValue
itk::AdvancedImageToImageMetric< FixedImageType, MovingImageType > AdvancedMetricType
FixedImageType::PointType FixedPointType
Definition: elxMetricBase.h:93
virtual void SetAdvancedMetricImageSampler(ImageSamplerBaseType *sampler)
Superclass::ElastixType ElastixType
Definition: elxMetricBase.h:81
itk::SingleValuedCostFunction ITKBaseType
itk::PointSet< CoordinateRepresentationType, MovingImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, MovingImageDimension, MovingImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
ElastixType::MovingImageType MovingImageType
Definition: elxMetricBase.h:95
Superclass::RegistrationPointer RegistrationPointer
Definition: elxMetricBase.h:89
virtual const ITKBaseType * GetAsITKBaseType(void) const
itk::WeakPointer< ElastixType > ElastixPointer
virtual void AfterEachIterationBase(void)
virtual MeasureType GetCurrentExactMetricValue(void) const
ITKBaseType::ParametersValueType CoordinateRepresentationType
AdvancedMetricType::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
Superclass::ConfigurationPointer ConfigurationPointer
Definition: elxMetricBase.h:87
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:72
void operator=(const Self &)


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.13 elastix logo