Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __itkCombinationImageToImageMetric_h
00016 #define __itkCombinationImageToImageMetric_h
00017
00018 #include "itkAdvancedImageToImageMetric.h"
00019 #include "itkSingleValuedPointSetToPointSetMetric.h"
00020
00021 namespace itk
00022 {
00023
00057 template <class TFixedImage, class TMovingImage>
00058 class CombinationImageToImageMetric :
00059 public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
00060 {
00061 public:
00063 typedef CombinationImageToImageMetric Self;
00064 typedef AdvancedImageToImageMetric<
00065 TFixedImage, TMovingImage > Superclass;
00066 typedef SmartPointer<Self> Pointer;
00067 typedef SmartPointer<const Self> ConstPointer;
00068
00070 itkTypeMacro( CombinationImageToImageMetric, AdvancedImageToImageMetric );
00071
00073 itkNewMacro( Self );
00074
00076 itkStaticConstMacro( MovingImageDimension, unsigned int,
00077 TMovingImage::ImageDimension );
00078 itkStaticConstMacro( FixedImageDimension, unsigned int,
00079 TFixedImage::ImageDimension );
00080
00082 typedef typename Superclass::CoordinateRepresentationType CoordinateRepresentationType;
00083 typedef typename Superclass::MovingImageType MovingImageType;
00084 typedef typename Superclass::MovingImagePixelType MovingImagePixelType;
00085
00086 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
00087 typedef typename Superclass::FixedImageType FixedImageType;
00088
00089 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
00090 typedef typename Superclass::FixedImageRegionType FixedImageRegionType;
00091 typedef typename Superclass::AdvancedTransformType TransformType;
00092 typedef typename TransformType::Pointer TransformPointer;
00093 typedef typename Superclass::InputPointType InputPointType;
00094 typedef typename Superclass::OutputPointType OutputPointType;
00095 typedef typename Superclass::TransformParametersType TransformParametersType;
00096 typedef typename Superclass::TransformJacobianType TransformJacobianType;
00097 typedef typename Superclass::InterpolatorType InterpolatorType;
00098 typedef typename Superclass::InterpolatorPointer InterpolatorPointer;
00099 typedef typename Superclass::RealType RealType;
00100 typedef typename Superclass::GradientPixelType GradientPixelType;
00101 typedef typename Superclass::GradientImageType GradientImageType;
00102 typedef typename Superclass::GradientImagePointer GradientImagePointer;
00103 typedef typename Superclass::GradientImageFilterType GradientImageFilterType;
00104 typedef typename Superclass::GradientImageFilterPointer GradientImageFilterPointer;
00105 typedef typename Superclass::FixedImageMaskType FixedImageMaskType;
00106 typedef typename Superclass::FixedImageMaskPointer FixedImageMaskPointer;
00107 typedef typename Superclass::MovingImageMaskType MovingImageMaskType;
00108 typedef typename Superclass::MovingImageMaskPointer MovingImageMaskPointer;
00109 typedef typename Superclass::MeasureType MeasureType;
00110 typedef typename Superclass::DerivativeType DerivativeType;
00111
00112 typedef typename Superclass::ParametersType ParametersType;
00113
00115 typedef typename Superclass::HessianValueType HessianValueType;
00116 typedef typename Superclass::HessianType HessianType;
00117
00118
00133 typedef Superclass ImageMetricType;
00134 typedef typename ImageMetricType::Pointer ImageMetricPointer;
00135 typedef SingleValuedCostFunction SingleValuedCostFunctionType;
00136 typedef typename SingleValuedCostFunctionType::Pointer SingleValuedCostFunctionPointer;
00137
00138 typedef typename FixedImageType::PixelType FixedImagePixelType;
00139 typedef typename MovingImageType::RegionType MovingImageRegionType;
00140 typedef FixedArray< double,
00141 itkGetStaticConstMacro(MovingImageDimension) > MovingImageDerivativeScalesType;
00142
00144 typedef PointSet< CoordinateRepresentationType,
00145 TFixedImage::ImageDimension,
00146 DefaultStaticMeshTraits<
00147 CoordinateRepresentationType,
00148 TFixedImage::ImageDimension,
00149 TFixedImage::ImageDimension,
00150 CoordinateRepresentationType, CoordinateRepresentationType,
00151 CoordinateRepresentationType > > FixedPointSetType;
00152 typedef PointSet< CoordinateRepresentationType,
00153 TMovingImage::ImageDimension,
00154 DefaultStaticMeshTraits<
00155 CoordinateRepresentationType,
00156 TMovingImage::ImageDimension,
00157 TMovingImage::ImageDimension,
00158 CoordinateRepresentationType, CoordinateRepresentationType,
00159 CoordinateRepresentationType > > MovingPointSetType;
00160 typedef SingleValuedPointSetToPointSetMetric<
00161 FixedPointSetType, MovingPointSetType > PointSetMetricType;
00162
00168 void SetNumberOfMetrics( unsigned int count );
00169
00171 itkGetConstMacro( NumberOfMetrics, unsigned int );
00172
00177 void SetMetric( SingleValuedCostFunctionType * metric, unsigned int pos );
00178
00180 SingleValuedCostFunctionType * GetMetric( unsigned int count ) const;
00181
00183 void SetMetricWeight( double weight, unsigned int pos );
00184
00186 double GetMetricWeight( unsigned int pos ) const;
00187
00193 void SetUseMetric( const bool use, const unsigned int pos );
00194
00196 void SetUseAllMetrics( void );
00197
00199 bool GetUseMetric( const unsigned int pos ) const;
00200
00202 MeasureType GetMetricValue( unsigned int pos ) const;
00203
00205 const DerivativeType & GetMetricDerivative( unsigned int pos ) const;
00206
00212 virtual void SetTransform( TransformType * _arg );
00213
00224 virtual void SetTransform( TransformType * _arg, unsigned int pos );
00225
00229 virtual const TransformType * GetTransform( unsigned int pos ) const;
00230
00232 virtual const TransformType * GetTransform( void ) const
00233 {
00234 return this->GetTransform( 0 );
00235 };
00236
00238 virtual void SetInterpolator( InterpolatorType *_arg );
00239
00241 virtual void SetInterpolator( InterpolatorType * _arg, unsigned int pos );
00242
00246 virtual const InterpolatorType * GetInterpolator( unsigned int pos ) const;
00247
00249 virtual const InterpolatorType * GetInterpolator( void ) const
00250 {
00251 return this->GetInterpolator(0);
00252 };
00253
00255 virtual void SetFixedImage( const FixedImageType *_arg );
00256
00258 virtual void SetFixedImage( const FixedImageType *_arg, unsigned int pos );
00259
00263 virtual const FixedImageType * GetFixedImage( unsigned int pos ) const;
00264
00266 virtual const FixedImageType * GetFixedImage( void ) const
00267 {
00268 return this->GetFixedImage(0);
00269 };
00270
00272 virtual void SetFixedImageMask( FixedImageMaskType *_arg );
00273
00275 virtual void SetFixedImageMask( FixedImageMaskType *_arg, unsigned int pos );
00276
00280 virtual const FixedImageMaskType * GetFixedImageMask( unsigned int pos ) const;
00281
00283 virtual const FixedImageMaskType * GetFixedImageMask( void ) const
00284 {
00285 return this->GetFixedImageMask(0);
00286 };
00287
00289 virtual void SetFixedImageRegion( const FixedImageRegionType _arg );
00290
00292 virtual void SetFixedImageRegion( const FixedImageRegionType _arg, unsigned int pos );
00293
00297 virtual const FixedImageRegionType & GetFixedImageRegion( unsigned int pos ) const;
00298
00300 virtual const FixedImageRegionType & GetFixedImageRegion( void ) const
00301 {
00302 return this->GetFixedImageRegion(0);
00303 };
00304
00306 virtual void SetMovingImage( const MovingImageType *_arg );
00307
00309 virtual void SetMovingImage( const MovingImageType *_arg, unsigned int pos );
00310
00314 virtual const MovingImageType * GetMovingImage( unsigned int pos ) const;
00315
00317 virtual const MovingImageType * GetMovingImage( void ) const
00318 {
00319 return this->GetMovingImage(0);
00320 };
00321
00323 virtual void SetMovingImageMask( MovingImageMaskType *_arg );
00324
00326 virtual void SetMovingImageMask( MovingImageMaskType *_arg, unsigned int pos );
00327
00331 virtual const MovingImageMaskType * GetMovingImageMask( unsigned int pos ) const;
00332
00334 virtual const MovingImageMaskType * GetMovingImageMask( void ) const
00335 {
00336 return this->GetMovingImageMask(0);
00337 };
00338
00342 virtual const unsigned long & GetNumberOfPixelsCounted( void ) const;
00343
00345 virtual void Initialize( void ) throw ( ExceptionObject );
00346
00352 virtual MeasureType GetValue( const ParametersType & parameters ) const;
00353
00355 virtual void GetDerivative(
00356 const ParametersType & parameters,
00357 DerivativeType & derivative ) const;
00358
00360 virtual void GetValueAndDerivative(
00361 const ParametersType & parameters,
00362 MeasureType & value,
00363 DerivativeType & derivative ) const;
00364
00366 virtual void GetSelfHessian( const TransformParametersType & parameters, HessianType & H ) const;
00367
00371 virtual unsigned long GetMTime() const;
00372
00373 protected:
00374 CombinationImageToImageMetric();
00375 virtual ~CombinationImageToImageMetric() {};
00376 void PrintSelf( std::ostream& os, Indent indent ) const;
00377
00379 unsigned int m_NumberOfMetrics;
00380 std::vector< SingleValuedCostFunctionPointer > m_Metrics;
00381 std::vector< double > m_MetricWeights;
00382 std::vector< bool > m_UseMetric;
00383 mutable std::vector< MeasureType > m_MetricValues;
00384 mutable std::vector< DerivativeType > m_MetricDerivatives;
00385
00387 FixedImageRegionType m_NullFixedImageRegion;
00388 DerivativeType m_NullDerivative;
00389
00390 private:
00391 CombinationImageToImageMetric(const Self&);
00392 void operator=(const Self&);
00393
00394 };
00395
00396 }
00397
00398 #ifndef ITK_MANUAL_INSTANTIATION
00399 #include "itkCombinationImageToImageMetric.txx"
00400 #endif
00401
00402 #endif // end #ifndef __itkCombinationImageToImageMetric_h
00403
00404
00405