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  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 #ifndef __itkMultiInputImageToImageMetricBase_h
15 #define __itkMultiInputImageToImageMetricBase_h
16 
18 #include <vector>
19 
21 #define itkSetNumberOfMacro( name ) \
22  virtual void SetNumberOf##name##s( const unsigned int _arg ) \
23  { \
24  if ( this->m_NumberOf##name##s != _arg ) \
25  { \
26  this->m_##name##Vector.resize( _arg ); \
27  this->m_NumberOf##name##s = _arg; \
28  this->Modified(); \
29  } \
30  } // comments for allowing ; after calling the macro
31 
32 
33 namespace itk
34 {
35 
45 template <class TFixedImage, class TMovingImage>
47  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
48 {
49 public:
50 
54  TFixedImage, TMovingImage > Superclass;
55  typedef SmartPointer<Self> Pointer;
56  typedef SmartPointer<const Self> ConstPointer;
57 
60 
62  itkStaticConstMacro( MovingImageDimension, unsigned int,
63  TMovingImage::ImageDimension );
64  itkStaticConstMacro( FixedImageDimension, unsigned int,
65  TFixedImage::ImageDimension );
66 
85  typedef typename Superclass::RealType RealType;
98 
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 
124  virtual const FixedImageType * GetFixedImage( unsigned int pos ) const;
125 
127  virtual const FixedImageType * GetFixedImage( void ) const
128  {
129  return this->GetFixedImage( 0 );
130  };
131 
133  itkSetNumberOfMacro( FixedImage );
134 
136  itkGetConstMacro( NumberOfFixedImages, unsigned int );
137 
141  virtual void SetFixedImageMask( FixedImageMaskType *_arg, unsigned int pos );
142 
144  virtual void SetFixedImageMask( FixedImageMaskType *_arg )
145  {
146  this->SetFixedImageMask( _arg, 0 );
147  };
148 
150  virtual FixedImageMaskType * GetFixedImageMask( unsigned int pos ) const;
151 
153  virtual FixedImageMaskType * GetFixedImageMask( void ) const
154  {
155  return this->GetFixedImageMask( 0 );
156  };
157 
159  itkSetNumberOfMacro( FixedImageMask );
160 
162  itkGetConstMacro( NumberOfFixedImageMasks, unsigned int );
163 
167  virtual void SetFixedImageRegion( const FixedImageRegionType _arg, unsigned int pos );
168 
170  virtual void SetFixedImageRegion( const FixedImageRegionType _arg )
171  {
172  this->SetFixedImageRegion( _arg, 0 );
173  };
174 
176  virtual const FixedImageRegionType & GetFixedImageRegion( unsigned int pos ) const;
177 
179  virtual const FixedImageRegionType & GetFixedImageRegion( void ) const
180  {
181  return this->GetFixedImageRegion( 0 );
182  };
183 
185  itkSetNumberOfMacro( FixedImageRegion );
186 
188  itkGetConstMacro( NumberOfFixedImageRegions, unsigned int );
189 
193  virtual void SetMovingImage( const MovingImageType *_arg, unsigned int pos );
194 
196  virtual void SetMovingImage( const MovingImageType *_arg )
197  {
198  this->SetMovingImage( _arg, 0 );
199  };
200 
202  virtual const MovingImageType * GetMovingImage( unsigned int pos ) const;
203 
205  virtual const MovingImageType * GetMovingImage( void ) const
206  {
207  return this->GetMovingImage( 0 );
208  };
209 
211  itkSetNumberOfMacro( MovingImage );
212 
214  itkGetConstMacro( NumberOfMovingImages, unsigned int );
215 
219  virtual void SetMovingImageMask( MovingImageMaskType *_arg, unsigned int pos );
220 
223  {
224  this->SetMovingImageMask( _arg, 0 );
225  };
226 
228  virtual MovingImageMaskType * GetMovingImageMask( unsigned int pos ) const;
229 
231  virtual MovingImageMaskType * GetMovingImageMask( void ) const
232  {
233  return this->GetMovingImageMask( 0 );
234  };
235 
237  itkSetNumberOfMacro( MovingImageMask );
238 
240  itkGetConstMacro( NumberOfMovingImageMasks, unsigned int );
241 
247  virtual void SetInterpolator( InterpolatorType *_arg, unsigned int pos );
248 
250  virtual void SetInterpolator( InterpolatorType *_arg )
251  {
252  return this->SetInterpolator( _arg, 0 );
253  };
254 
256  virtual InterpolatorType * GetInterpolator( unsigned int pos ) const;
257 
259  virtual InterpolatorType * GetInterpolator( void ) const
260  {
261  return this->GetInterpolator( 0 );
262  };
263 
265  itkSetNumberOfMacro( Interpolator );
266 
268  itkGetConstMacro( NumberOfInterpolators, unsigned int );
269 
271  itkGetConstMacro( InterpolatorsAreBSpline, bool );
272 
278  virtual void SetFixedImageInterpolator( FixedImageInterpolatorType *_arg, unsigned int pos );
279 
282  {
283  return this->SetFixedImageInterpolator( _arg, 0 );
284  };
285 
287  virtual FixedImageInterpolatorType * GetFixedImageInterpolator( unsigned int pos ) const;
288 
291  {
292  return this->GetFixedImageInterpolator( 0 );
293  };
294 
296  itkSetNumberOfMacro( FixedImageInterpolator );
297 
299  itkGetConstMacro( NumberOfFixedImageInterpolators, unsigned int );
300 
304  virtual void Initialize( void ) throw ( ExceptionObject );
305 
306 protected:
307 
310 
312  virtual ~MultiInputImageToImageMetricBase() {};
313 
319 
322  typedef typename BSplineInterpolatorType::Pointer BSplineInterpolatorPointer;
323  typedef std::vector<BSplineInterpolatorPointer> BSplineInterpolatorVectorType;
324 
326  virtual void InitializeImageSampler( void ) throw ( ExceptionObject );
327 
331  virtual void CheckForBSplineInterpolators( void );
332 
337  const MovingImagePointType & mappedPoint,
338  RealType & movingImageValue,
339  MovingImageDerivativeType * gradient ) const;
340 
342  virtual bool IsInsideMovingMask(
343  const MovingImagePointType & mappedPoint ) const;
344 
353 
356 
357 private:
358 
359  MultiInputImageToImageMetricBase(const Self&); // purposely not implemented
360  void operator=(const Self&); // purposely not implemented
361 
364 
365  unsigned int m_NumberOfFixedImages;
372 
373 }; // end class MultiInputImageToImageMetricBase
374 
375 } // end namespace itk
376 
377 #undef itkSetNumberOfMacro
378 
379 #ifndef ITK_MANUAL_INSTANTIATION
380 #include "itkMultiInputImageToImageMetricBase.txx"
381 #endif
382 
383 #endif // end #ifndef __itkMultiInputImageToImageMetricBase_h
384 


Generated on 21-03-2014 for elastix by doxygen 1.8.1.2 elastix logo