go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkCombinationImageToImageMetric.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 __itkCombinationImageToImageMetric_h
16 #define __itkCombinationImageToImageMetric_h
17 
20 
21 namespace itk
22 {
23 
55 template <class TFixedImage, class TMovingImage>
57  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
58 {
59 public:
63  TFixedImage, TMovingImage > Superclass;
64  typedef SmartPointer<Self> Pointer;
65  typedef SmartPointer<const Self> ConstPointer;
66 
69 
71  itkNewMacro( Self );
72 
74  itkStaticConstMacro( MovingImageDimension, unsigned int,
75  TMovingImage::ImageDimension );
76  itkStaticConstMacro( FixedImageDimension, unsigned int,
77  TFixedImage::ImageDimension );
78 
83  //typedef typename Superclass::MovingImagePointer MovingImagePointer;
86  //typedef typename Superclass::FixedImagePointer FixedImagePointer;
90  typedef typename TransformType::Pointer TransformPointer;
97  typedef typename Superclass::RealType RealType;
109  //typedef typename Superclass::DerivativeValueType DerivativeValueType;
111 
115 
131  typedef typename ImageMetricType::Pointer ImageMetricPointer;
133  typedef typename SingleValuedCostFunctionType::Pointer SingleValuedCostFunctionPointer;
134 
135  typedef typename FixedImageType::PixelType FixedImagePixelType;
136  typedef typename MovingImageType::RegionType MovingImageRegionType;
137  typedef FixedArray< double,
138  itkGetStaticConstMacro(MovingImageDimension) > MovingImageDerivativeScalesType;
139 
141  typedef PointSet< CoordinateRepresentationType,
142  TFixedImage::ImageDimension,
143  DefaultStaticMeshTraits<
145  TFixedImage::ImageDimension,
146  TFixedImage::ImageDimension,
149  typedef PointSet< CoordinateRepresentationType,
150  TMovingImage::ImageDimension,
151  DefaultStaticMeshTraits<
153  TMovingImage::ImageDimension,
154  TMovingImage::ImageDimension,
159 
165  void SetNumberOfMetrics( unsigned int count );
166 
168  itkGetConstMacro( NumberOfMetrics, unsigned int );
169 
174  void SetMetric( SingleValuedCostFunctionType * metric, unsigned int pos );
175 
177  SingleValuedCostFunctionType * GetMetric( unsigned int count ) const;
178 
180  void SetMetricWeight( double weight, unsigned int pos );
181 
183  double GetMetricWeight( unsigned int pos ) const;
184 
186  void SetMetricRelativeWeight( double weight, unsigned int pos );
187 
189  double GetMetricRelativeWeight( unsigned int pos ) const;
190 
192  itkSetMacro( UseRelativeWeights, bool );
193  itkGetMacro( UseRelativeWeights, bool );
194 
200  void SetUseMetric( const bool use, const unsigned int pos );
201 
203  void SetUseAllMetrics( void );
204 
206  bool GetUseMetric( const unsigned int pos ) const;
207 
209  MeasureType GetMetricValue( unsigned int pos ) const;
210 
212  const DerivativeType & GetMetricDerivative( unsigned int pos ) const;
213 
215  double GetMetricDerivativeMagnitude( unsigned int pos ) const;
216 
218  std::size_t GetMetricComputationTime( unsigned int pos ) const;
219 
225  virtual void SetTransform( TransformType * _arg );
226 
237  virtual void SetTransform( TransformType * _arg, unsigned int pos );
238 
242  virtual const TransformType * GetTransform( unsigned int pos ) const;
243 
245  virtual const TransformType * GetTransform( void ) const
246  {
247  return this->GetTransform( 0 );
248  };
249 
251  virtual void SetInterpolator( InterpolatorType *_arg );
252 
254  virtual void SetInterpolator( InterpolatorType * _arg, unsigned int pos );
255 
259  virtual const InterpolatorType * GetInterpolator( unsigned int pos ) const;
260 
262  virtual const InterpolatorType * GetInterpolator( void ) const
263  {
264  return this->GetInterpolator(0);
265  };
266 
268  virtual void SetFixedImage( const FixedImageType *_arg );
269 
271  virtual void SetFixedImage( const FixedImageType *_arg, unsigned int pos );
272 
276  virtual const FixedImageType * GetFixedImage( unsigned int pos ) const;
277 
279  virtual const FixedImageType * GetFixedImage( void ) const
280  {
281  return this->GetFixedImage(0);
282  };
283 
285  virtual void SetFixedImageMask( FixedImageMaskType *_arg );
286 
288  virtual void SetFixedImageMask( FixedImageMaskType *_arg, unsigned int pos );
289 
293  virtual const FixedImageMaskType * GetFixedImageMask( unsigned int pos ) const;
294 
296  virtual const FixedImageMaskType * GetFixedImageMask( void ) const
297  {
298  return this->GetFixedImageMask(0);
299  };
300 
302  virtual void SetFixedImageRegion( const FixedImageRegionType _arg );
303 
305  virtual void SetFixedImageRegion( const FixedImageRegionType _arg, unsigned int pos );
306 
310  virtual const FixedImageRegionType & GetFixedImageRegion( unsigned int pos ) const;
311 
313  virtual const FixedImageRegionType & GetFixedImageRegion( void ) const
314  {
315  return this->GetFixedImageRegion(0);
316  };
317 
319  virtual void SetMovingImage( const MovingImageType *_arg );
320 
322  virtual void SetMovingImage( const MovingImageType *_arg, unsigned int pos );
323 
327  virtual const MovingImageType * GetMovingImage( unsigned int pos ) const;
328 
330  virtual const MovingImageType * GetMovingImage( void ) const
331  {
332  return this->GetMovingImage(0);
333  };
334 
336  virtual void SetMovingImageMask( MovingImageMaskType *_arg );
337 
339  virtual void SetMovingImageMask( MovingImageMaskType *_arg, unsigned int pos );
340 
344  virtual const MovingImageMaskType * GetMovingImageMask( unsigned int pos ) const;
345 
347  virtual const MovingImageMaskType * GetMovingImageMask( void ) const
348  {
349  return this->GetMovingImageMask(0);
350  };
351 
355  virtual const unsigned long & GetNumberOfPixelsCounted( void ) const;
356 
358  virtual void Initialize( void ) throw ( ExceptionObject );
359 
365  virtual MeasureType GetValue( const ParametersType & parameters ) const;
366 
368  virtual void GetDerivative(
369  const ParametersType & parameters,
370  DerivativeType & derivative ) const;
371 
373  virtual void GetValueAndDerivative(
374  const ParametersType & parameters,
375  MeasureType & value,
376  DerivativeType & derivative ) const;
377 
379  virtual void GetSelfHessian(
380  const TransformParametersType & parameters,
381  HessianType & H ) const;
382 
386  virtual unsigned long GetMTime() const;
387 
388 protected:
390  virtual ~CombinationImageToImageMetric() {};
391  void PrintSelf( std::ostream& os, Indent indent ) const;
392 
394  unsigned int m_NumberOfMetrics;
395  std::vector< SingleValuedCostFunctionPointer > m_Metrics;
396  std::vector< double > m_MetricWeights;
397  std::vector< double > m_MetricRelativeWeights;
399  std::vector< bool > m_UseMetric;
400  mutable std::vector< MeasureType > m_MetricValues;
401  mutable std::vector< DerivativeType > m_MetricDerivatives;
402  mutable std::vector< double > m_MetricDerivativesMagnitude;
403  mutable std::vector< std::size_t > m_MetricComputationTime;
404 
408 
409 private:
410  CombinationImageToImageMetric(const Self&); //purposely not implemented
411  void operator=(const Self&); //purposely not implemented
412 
413 }; // end class CombinationImageToImageMetric
414 
415 } // end namespace itk
416 
417 #ifndef ITK_MANUAL_INSTANTIATION
418 #include "itkCombinationImageToImageMetric.txx"
419 #endif
420 
421 #endif // end #ifndef __itkCombinationImageToImageMetric_h
422 
423 
424 


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