go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkMultiInputImageToImageMetricBase.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 __itkMultiInputImageToImageMetricBase_h
19 #define __itkMultiInputImageToImageMetricBase_h
20 
22 #include <vector>
23 
25 #define itkSetNumberOfMacro( name ) \
26  virtual void SetNumberOf##name##s( const unsigned int _arg ) \
27  { \
28  if( this->m_NumberOf##name##s != _arg ) \
29  { \
30  this->m_##name##Vector.resize( _arg ); \
31  this->m_NumberOf##name##s = _arg; \
32  this->Modified(); \
33  } \
34  } // comments for allowing ; after calling the macro
35 
36 namespace itk
37 {
38 
48 template< class TFixedImage, class TMovingImage >
50  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
51 {
52 public:
53 
58  typedef SmartPointer< const Self > ConstPointer;
59 
62 
64  itkStaticConstMacro( MovingImageDimension, unsigned int, TMovingImage::ImageDimension );
65  itkStaticConstMacro( FixedImageDimension, unsigned int, TFixedImage::ImageDimension );
66 
85  typedef typename Superclass::RealType RealType;
98 
99  typedef InterpolateImageFunction<
100  FixedImageType, CoordinateRepresentationType > FixedImageInterpolatorType;
101  typedef typename FixedImageInterpolatorType::Pointer FixedImageInterpolatorPointer;
102 
104  typedef std::vector< FixedImageConstPointer > FixedImageVectorType;
105  typedef std::vector< FixedImageMaskPointer > FixedImageMaskVectorType;
106  typedef std::vector< FixedImageRegionType > FixedImageRegionVectorType;
107  typedef std::vector< MovingImageConstPointer > MovingImageVectorType;
108  typedef std::vector< MovingImageMaskPointer > MovingImageMaskVectorType;
109  typedef std::vector< InterpolatorPointer > InterpolatorVectorType;
110  typedef std::vector< FixedImageInterpolatorPointer > FixedImageInterpolatorVectorType;
111 
115  virtual void SetFixedImage( const FixedImageType * _arg, unsigned int pos );
116 
118  virtual void SetFixedImage( const FixedImageType * _arg )
119  {
120  this->SetFixedImage( _arg, 0 );
121  }
122 
123 
125  virtual const FixedImageType * GetFixedImage( unsigned int pos ) const;
126 
128  virtual const FixedImageType * GetFixedImage( void ) const
129  {
130  return this->GetFixedImage( 0 );
131  }
132 
133 
135  itkSetNumberOfMacro( FixedImage );
136 
138  itkGetConstMacro( NumberOfFixedImages, unsigned int );
139 
143  virtual void SetFixedImageMask( FixedImageMaskType * _arg, unsigned int pos );
144 
146  virtual void SetFixedImageMask( FixedImageMaskType * _arg )
147  {
148  this->SetFixedImageMask( _arg, 0 );
149  }
150 
151 
153  virtual FixedImageMaskType * GetFixedImageMask( unsigned int pos ) const;
154 
156  virtual FixedImageMaskType * GetFixedImageMask( void ) const
157  {
158  return this->GetFixedImageMask( 0 );
159  }
160 
161 
163  itkSetNumberOfMacro( FixedImageMask );
164 
166  itkGetConstMacro( NumberOfFixedImageMasks, unsigned int );
167 
171  virtual void SetFixedImageRegion( const FixedImageRegionType _arg, unsigned int pos );
172 
174  virtual void SetFixedImageRegion( const FixedImageRegionType _arg )
175  {
176  this->SetFixedImageRegion( _arg, 0 );
177  }
178 
179 
181  virtual const FixedImageRegionType & GetFixedImageRegion( unsigned int pos ) const;
182 
184  virtual const FixedImageRegionType & GetFixedImageRegion( void ) const
185  {
186  return this->GetFixedImageRegion( 0 );
187  }
188 
189 
191  itkSetNumberOfMacro( FixedImageRegion );
192 
194  itkGetConstMacro( NumberOfFixedImageRegions, unsigned int );
195 
199  virtual void SetMovingImage( const MovingImageType * _arg, unsigned int pos );
200 
202  virtual void SetMovingImage( const MovingImageType * _arg )
203  {
204  this->SetMovingImage( _arg, 0 );
205  }
206 
207 
209  virtual const MovingImageType * GetMovingImage( unsigned int pos ) const;
210 
212  virtual const MovingImageType * GetMovingImage( void ) const
213  {
214  return this->GetMovingImage( 0 );
215  }
216 
217 
219  itkSetNumberOfMacro( MovingImage );
220 
222  itkGetConstMacro( NumberOfMovingImages, unsigned int );
223 
227  virtual void SetMovingImageMask( MovingImageMaskType * _arg, unsigned int pos );
228 
230  virtual void SetMovingImageMask( MovingImageMaskType * _arg )
231  {
232  this->SetMovingImageMask( _arg, 0 );
233  }
234 
235 
237  virtual MovingImageMaskType * GetMovingImageMask( unsigned int pos ) const;
238 
240  virtual MovingImageMaskType * GetMovingImageMask( void ) const
241  {
242  return this->GetMovingImageMask( 0 );
243  }
244 
245 
247  itkSetNumberOfMacro( MovingImageMask );
248 
250  itkGetConstMacro( NumberOfMovingImageMasks, unsigned int );
251 
257  virtual void SetInterpolator( InterpolatorType * _arg, unsigned int pos );
258 
260  virtual void SetInterpolator( InterpolatorType * _arg )
261  {
262  return this->SetInterpolator( _arg, 0 );
263  }
264 
265 
267  virtual InterpolatorType * GetInterpolator( unsigned int pos ) const;
268 
270  virtual InterpolatorType * GetInterpolator( void ) const
271  {
272  return this->GetInterpolator( 0 );
273  }
274 
275 
277  itkSetNumberOfMacro( Interpolator );
278 
280  itkGetConstMacro( NumberOfInterpolators, unsigned int );
281 
283  itkGetConstMacro( InterpolatorsAreBSpline, bool );
284 
290  virtual void SetFixedImageInterpolator( FixedImageInterpolatorType * _arg, unsigned int pos );
291 
293  virtual void SetFixedImageInterpolator( FixedImageInterpolatorType * _arg )
294  {
295  return this->SetFixedImageInterpolator( _arg, 0 );
296  }
297 
298 
300  virtual FixedImageInterpolatorType * GetFixedImageInterpolator( unsigned int pos ) const;
301 
303  virtual FixedImageInterpolatorType * GetFixedImageInterpolator( void ) const
304  {
305  return this->GetFixedImageInterpolator( 0 );
306  }
307 
308 
310  itkSetNumberOfMacro( FixedImageInterpolator );
311 
313  itkGetConstMacro( NumberOfFixedImageInterpolators, unsigned int );
314 
318  virtual void Initialize( void ) throw ( ExceptionObject );
319 
320 protected:
321 
324 
326  virtual ~MultiInputImageToImageMetricBase() {}
327 
333 
336  typedef typename BSplineInterpolatorType::Pointer BSplineInterpolatorPointer;
337  typedef std::vector< BSplineInterpolatorPointer > BSplineInterpolatorVectorType;
338 
340  virtual void InitializeImageSampler( void ) throw ( ExceptionObject );
341 
345  virtual void CheckForBSplineInterpolators( void );
346 
351  const MovingImagePointType & mappedPoint,
352  RealType & movingImageValue,
353  MovingImageDerivativeType * gradient ) const;
354 
356  virtual bool IsInsideMovingMask(
357  const MovingImagePointType & mappedPoint ) const;
358 
360  FixedImageVectorType m_FixedImageVector;
361  FixedImageMaskVectorType m_FixedImageMaskVector;
362  FixedImageRegionVectorType m_FixedImageRegionVector;
363  MovingImageVectorType m_MovingImageVector;
364  MovingImageMaskVectorType m_MovingImageMaskVector;
365  InterpolatorVectorType m_InterpolatorVector;
366  FixedImageInterpolatorVectorType m_FixedImageInterpolatorVector;
367 
369  BSplineInterpolatorVectorType m_BSplineInterpolatorVector;
370 
371 private:
372 
373  MultiInputImageToImageMetricBase( const Self & ); // purposely not implemented
374  void operator=( const Self & ); // purposely not implemented
375 
377  FixedImageRegionType m_DummyFixedImageRegion;
378 
379  unsigned int m_NumberOfFixedImages;
386 
387 };
388 
389 } // end namespace itk
390 
391 #undef itkSetNumberOfMacro
392 
393 #ifndef ITK_MANUAL_INSTANTIATION
394 #include "itkMultiInputImageToImageMetricBase.hxx"
395 #endif
396 
397 #endif // end #ifndef __itkMultiInputImageToImageMetricBase_h
Superclass::FixedImageConstPointer FixedImageConstPointer
virtual void SetFixedImageInterpolator(FixedImageInterpolatorType *_arg)
virtual void SetMovingImageMask(MovingImageMaskType *_arg)
virtual void SetFixedImageRegion(const FixedImageRegionType _arg, unsigned int pos)
Superclass::CoordinateRepresentationType CoordinateRepresentationType
std::vector< InterpolatorPointer > InterpolatorVectorType
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::FixedImageMaskPointer FixedImageMaskPointer
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
virtual FixedImageMaskType * GetFixedImageMask(void) const
virtual void SetFixedImageInterpolator(FixedImageInterpolatorType *_arg, unsigned int pos)
Superclass::GradientPixelType GradientPixelType
Superclass::FixedImageRegionType FixedImageRegionType
Implements a metric base class that takes multiple inputs.
std::vector< FixedImageConstPointer > FixedImageVectorType
Superclass::TransformJacobianType TransformJacobianType
virtual const FixedImageType * GetFixedImage(void) const
MovingImageType::IndexType MovingImageIndexType
virtual void SetInterpolator(InterpolatorType *_arg, unsigned int pos)
BSplineInterpolatorType::Pointer BSplineInterpolatorPointer
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
virtual InterpolatorType * GetInterpolator(void) const
FixedImageInterpolatorType::Pointer FixedImageInterpolatorPointer
virtual void SetFixedImageMask(FixedImageMaskType *_arg, unsigned int pos)
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
Superclass::BSplineInterpolatorType BSplineInterpolatorType
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::CoordinateRepresentationType CoordinateRepresentationType
virtual void SetFixedImage(const FixedImageType *_arg, unsigned int pos)
virtual bool EvaluateMovingImageValueAndDerivative(const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient) const
TransformType::OutputPointType MovingImagePointType
InterpolateImageFunction< FixedImageType, CoordinateRepresentationType > FixedImageInterpolatorType
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
Superclass::MovingImageMaskType MovingImageMaskType
virtual void SetMovingImage(const MovingImageType *_arg, unsigned int pos)
virtual void SetInterpolator(InterpolatorType *_arg)
virtual bool IsInsideMovingMask(const MovingImagePointType &mappedPoint) const
virtual FixedImageInterpolatorType * GetFixedImageInterpolator(void) const
Superclass::GradientImageType GradientImageType
Superclass::TransformPointer TransformPointer
Superclass::GradientImageFilterType GradientImageFilterType
virtual void SetMovingImage(const MovingImageType *_arg)
virtual void InitializeImageSampler(void)
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
virtual void SetFixedImageMask(FixedImageMaskType *_arg)
std::vector< FixedImageRegionType > FixedImageRegionVectorType
Superclass::MovingImageDerivativeType MovingImageDerivativeType
std::vector< FixedImageInterpolatorPointer > FixedImageInterpolatorVectorType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::GradientImageFilterType GradientImageFilterType
std::vector< MovingImageConstPointer > MovingImageVectorType
Superclass::InterpolatorType InterpolatorType
Superclass::TransformJacobianType TransformJacobianType
virtual const FixedImageRegionType & GetFixedImageRegion(void) const
virtual const MovingImageType * GetMovingImage(void) const
std::vector< BSplineInterpolatorPointer > BSplineInterpolatorVectorType
Superclass::MovingImagePixelType MovingImagePixelType
virtual void CheckForBSplineInterpolators(void)
Superclass::TransformParametersType TransformParametersType
std::vector< MovingImageMaskPointer > MovingImageMaskVectorType
FixedImageInterpolatorVectorType m_FixedImageInterpolatorVector
virtual void SetFixedImageRegion(const FixedImageRegionType _arg)
Superclass::MovingImageMaskPointer MovingImageMaskPointer
std::vector< FixedImageMaskPointer > FixedImageMaskVectorType
virtual void SetMovingImageMask(MovingImageMaskType *_arg, unsigned int pos)
Superclass::FixedImageMaskType FixedImageMaskType
virtual void SetFixedImage(const FixedImageType *_arg)
virtual MovingImageMaskType * GetMovingImageMask(void) const
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientImagePointer GradientImagePointer


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