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  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 #ifndef __elxMetricBase_h
16 #define __elxMetricBase_h
17 
19 #include "elxMacro.h"
20 
21 #include "elxBaseComponentSE.h"
23 #include "itkImageGridSampler.h"
24 #include "itkPointSet.h"
25 
26 #include "elxTimer.h"
27 
28 
29 namespace elastix
30 {
31 using namespace itk;
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 SingleValuedCostFunction ITKBaseType;
104 
106  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
108  itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension );
109 
111  typedef typename ITKBaseType::ParametersValueType CoordinateRepresentationType;
112  typedef PointSet<
113  CoordinateRepresentationType, FixedImageDimension,
114  DefaultStaticMeshTraits<
116  FixedImageDimension, FixedImageDimension,
119  typedef PointSet<
120  CoordinateRepresentationType, MovingImageDimension,
121  DefaultStaticMeshTraits<
123  MovingImageDimension, MovingImageDimension,
126 
129 
131  typedef typename ITKBaseType::MeasureType MeasureType;
132 
134  virtual ITKBaseType * GetAsITKBaseType( void )
135  {
136  return dynamic_cast<ITKBaseType *>( this );
137  }
138 
140  virtual const ITKBaseType * GetAsITKBaseType( void ) const
141  {
142  return dynamic_cast<const ITKBaseType *>( this );
143  }
144 
149  virtual void BeforeEachResolutionBase( void );
150 
154  virtual void AfterEachIterationBase( void );
155 
159  virtual void SelectNewSamples( void );
160 
164  virtual bool GetAdvancedMetricUseImageSampler( void ) const;
165 
170  virtual void SetAdvancedMetricImageSampler( ImageSamplerBaseType * sampler );
171 
176  virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler( void ) const;
177 
179  virtual bool GetShowExactMetricValue( void ) const
180  { return this->m_ShowExactMetricValue; }
181 
183  virtual MeasureType GetCurrentExactMetricValue( void ) const
184  { return this->m_CurrentExactMetricValue; }
185 
186 protected:
187 
189  typedef typename ITKBaseType::ParametersType ParametersType;
190 
193  typedef typename
195 
197  MetricBase();
199  virtual ~MetricBase() {}
200 
210  virtual MeasureType GetExactValue( const ParametersType& parameters );
217 
218 private:
219 
221  MetricBase( const Self& ); // purposely not implemented
223  void operator=( const Self& ); // purposely not implemented
224 
225 }; // end class MetricBase
226 
227 
228 } // end namespace elastix
229 
230 #ifndef ITK_MANUAL_INSTANTIATION
231 #include "elxMetricBase.hxx"
232 #endif
233 
234 #endif // end #ifndef __elxMetricBase_h


Generated on 27-06-2013 for elastix by doxygen 1.8.3.1 elastix logo