Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __itkPatternIntensityImageToImageMetric_h
00015 #define __itkPatternIntensityImageToImageMetric_h
00016
00017 #include "itkAdvancedImageToImageMetric.h"
00018
00019 #include "itkPoint.h"
00020 #include "itkCastImageFilter.h"
00021 #include "itkResampleImageFilter.h"
00022 #include "itkMultiplyByConstantImageFilter.h"
00023 #include "itkSubtractImageFilter.h"
00024 #include "itkOptimizer.h"
00025 #include "itkRescaleIntensityImageFilter.h"
00026 #include "itkAdvancedCombinationTransform.h"
00027 #include "itkAdvancedRayCastInterpolateImageFunction.h"
00028
00029 namespace itk
00030 {
00031
00040 template < class TFixedImage, class TMovingImage >
00041 class ITK_EXPORT PatternIntensityImageToImageMetric :
00042 public AdvancedImageToImageMetric< TFixedImage, TMovingImage>
00043 {
00044 public:
00045
00047 typedef PatternIntensityImageToImageMetric Self;
00048 typedef AdvancedImageToImageMetric<
00049 TFixedImage, TMovingImage > Superclass;
00050 typedef SmartPointer<Self> Pointer;
00051 typedef SmartPointer<const Self> ConstPointer;
00052
00054 itkNewMacro( Self );
00055
00057 itkTypeMacro( PatternIntensityImageToImageMetric, ImageToImageMetric );
00058
00060 typedef typename
00061 Superclass::CoordinateRepresentationType CoordinateRepresentationType;
00062 typedef typename Superclass::MovingImageType MovingImageType;
00063 typedef typename Superclass::MovingImagePixelType MovingImagePixelType;
00064 typedef typename Superclass::MovingImagePointer MovingImagePointer;
00065 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
00066 typedef typename Superclass::FixedImageType FixedImageType;
00067 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
00068 typedef typename Superclass::FixedImageRegionType FixedImageRegionType;
00069 typedef typename Superclass::TransformType TransformType;
00070 typedef typename TransformType::ScalarType ScalarType;
00071 typedef typename Superclass::TransformPointer TransformPointer;
00072 typedef typename Superclass::InputPointType InputPointType;
00073 typedef typename Superclass::OutputPointType OutputPointType;
00074 typedef typename Superclass::TransformParametersType TransformParametersType;
00075 typedef typename Superclass::TransformJacobianType TransformJacobianType;
00076 typedef typename Superclass::InterpolatorType InterpolatorType;
00077 typedef typename Superclass::InterpolatorPointer InterpolatorPointer;
00078 typedef typename Superclass::RealType RealType;
00079 typedef typename Superclass::GradientPixelType GradientPixelType;
00080 typedef typename Superclass::GradientImageType GradientImageType;
00081 typedef typename Superclass::GradientImagePointer GradientImagePointer;
00082 typedef typename Superclass::GradientImageFilterType GradientImageFilterType;
00083 typedef typename Superclass::GradientImageFilterPointer GradientImageFilterPointer;
00084 typedef typename Superclass::FixedImageMaskType FixedImageMaskType;
00085 typedef typename Superclass::FixedImageMaskPointer FixedImageMaskPointer;
00086 typedef typename Superclass::MovingImageMaskType MovingImageMaskType;
00087 typedef typename Superclass::MovingImageMaskPointer MovingImageMaskPointer;
00088 typedef typename Superclass::MeasureType MeasureType;
00089 typedef typename Superclass::DerivativeType DerivativeType;
00090 typedef typename Superclass::ParametersType ParametersType;
00091 typedef typename Superclass::FixedImagePixelType FixedImagePixelType;
00092 typedef typename Superclass::MovingImageRegionType MovingImageRegionType;
00093 typedef typename Superclass::ImageSamplerType ImageSamplerType;
00094 typedef typename Superclass::ImageSamplerPointer ImageSamplerPointer;
00095 typedef typename Superclass::ImageSampleContainerType ImageSampleContainerType;
00096 typedef typename
00097 Superclass::ImageSampleContainerPointer ImageSampleContainerPointer;
00098 typedef typename Superclass::FixedImageLimiterType FixedImageLimiterType;
00099 typedef typename Superclass::MovingImageLimiterType MovingImageLimiterType;
00100 typedef typename
00101 Superclass::FixedImageLimiterOutputType FixedImageLimiterOutputType;
00102 typedef typename
00103 Superclass::MovingImageLimiterOutputType MovingImageLimiterOutputType;
00104 typedef typename
00105 Superclass::MovingImageDerivativeScalesType MovingImageDerivativeScalesType;
00106 typedef typename itk::Optimizer OptimizerType;
00107 typedef typename OptimizerType::ScalesType ScalesType;
00108
00110 itkStaticConstMacro( FixedImageDimension, unsigned int,
00111 FixedImageType::ImageDimension );
00112
00113 typedef itk::Image< FixedImagePixelType,
00114 itkGetStaticConstMacro( FixedImageDimension ) > TransformedMovingImageType;
00115 typedef typename itk::AdvancedCombinationTransform<
00116 ScalarType, FixedImageDimension> CombinationTransformType;
00117 typedef typename CombinationTransformType::Pointer CombinationTransformPointer;
00118 typedef typename itk::AdvancedRayCastInterpolateImageFunction<
00119 MovingImageType, ScalarType > RayCastInterpolatorType;
00120 typedef typename RayCastInterpolatorType::Pointer RayCastInterpolatorPointer;
00121 typedef itk::ResampleImageFilter<
00122 MovingImageType, TransformedMovingImageType > TransformMovingImageFilterType;
00123 typedef itk::RescaleIntensityImageFilter<
00124 TransformedMovingImageType,TransformedMovingImageType >
00125 RescaleIntensityImageFilterType;
00126
00127 typedef itk::SubtractImageFilter<
00128 FixedImageType, TransformedMovingImageType, TransformedMovingImageType >
00129 DifferenceImageFilterType;
00130
00131 typedef itk::MultiplyByConstantImageFilter<
00132 TransformedMovingImageType, double ,TransformedMovingImageType>
00133 MultiplyByConstantImageFilterType;
00134
00136 itkStaticConstMacro( MovingImageDimension, unsigned int,
00137 MovingImageType::ImageDimension );
00138
00140 virtual MeasureType GetValue( const TransformParametersType & parameters ) const;
00141
00143 virtual void GetDerivative( const TransformParametersType & parameters,
00144 DerivativeType & derivative ) const;
00145
00147 virtual void GetValueAndDerivative( const TransformParametersType & parameters,
00148 MeasureType& Value, DerivativeType& Derivative ) const;
00149
00155 virtual void Initialize(void) throw ( ExceptionObject );
00156
00158 itkSetMacro( Scales , ScalesType );
00159 itkGetConstReferenceMacro( Scales, ScalesType );
00160
00162 itkSetMacro( NoiseConstant , double );
00163 itkGetConstReferenceMacro( NoiseConstant, double );
00164
00166 itkSetMacro( OptimizeNormalizationFactor , bool );
00167 itkGetConstReferenceMacro( OptimizeNormalizationFactor, bool );
00168
00169 protected:
00170 PatternIntensityImageToImageMetric();
00171 virtual ~PatternIntensityImageToImageMetric() {};
00172 void PrintSelf(std::ostream& os, Indent indent) const;
00173
00175 MeasureType ComputePIFixed( void ) const;
00176
00178 MeasureType ComputePIDiff( const TransformParametersType ¶meters, float scalingfactor ) const;
00179
00180 private:
00181 PatternIntensityImageToImageMetric(const Self&);
00182 void operator=(const Self&);
00183
00184 typename TransformMovingImageFilterType::Pointer m_TransformMovingImageFilter;
00185 typename DifferenceImageFilterType::Pointer m_DifferenceImageFilter;
00186 typename RescaleIntensityImageFilterType::Pointer m_RescaleImageFilter;
00187 typename MultiplyByConstantImageFilterType::Pointer m_MultiplyByConstantImageFilter;
00188 double m_NoiseConstant;
00189 unsigned int m_NeighborhoodRadius;
00190 double m_DerivativeDelta;
00191 double m_NormalizationFactor;
00192 double m_Rescalingfactor;
00193 bool m_OptimizeNormalizationFactor;
00194 ScalesType m_Scales;
00195 MeasureType m_FixedMeasure;
00196 CombinationTransformPointer m_CombinationTransform;
00197
00198 };
00199
00200 }
00201
00202 #ifndef ITK_MANUAL_INSTANTIATION
00203 #include "itkPatternIntensityImageToImageMetric.hxx"
00204 #endif
00205
00206 #endif // end #ifndef __itkPatternIntensityImageToImageMetric_h
00207