00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOptMeanSquaresImageToImageMetric_h
00018 #define __itkOptMeanSquaresImageToImageMetric_h
00019
00020 #include "itkOptImageToImageMetric.h"
00021 #include "itkCovariantVector.h"
00022 #include "itkPoint.h"
00023 #include "itkIndex.h"
00024
00025 #include "itkMultiThreader.h"
00026
00027 namespace itk
00028 {
00029
00030 template <class TFixedImage,class TMovingImage >
00031 class ITK_EXPORT MeanSquaresImageToImageMetric :
00032 public ImageToImageMetric< TFixedImage, TMovingImage >
00033 {
00034 public:
00035
00037 typedef MeanSquaresImageToImageMetric Self;
00038 typedef ImageToImageMetric< TFixedImage, TMovingImage > Superclass;
00039 typedef SmartPointer<Self> Pointer;
00040 typedef SmartPointer<const Self> ConstPointer;
00041
00043 itkNewMacro(Self);
00044
00046 itkTypeMacro(MeanSquaresImageToImageMetric, ImageToImageMetric);
00047
00049 typedef typename Superclass::TransformType TransformType;
00050 typedef typename Superclass::TransformPointer TransformPointer;
00051 typedef typename Superclass::TransformJacobianType TransformJacobianType;
00052 typedef typename Superclass::InterpolatorType InterpolatorType;
00053 typedef typename Superclass::MeasureType MeasureType;
00054 typedef typename Superclass::DerivativeType DerivativeType;
00055 typedef typename Superclass::ParametersType ParametersType;
00056 typedef typename Superclass::FixedImageType FixedImageType;
00057 typedef typename Superclass::MovingImageType MovingImageType;
00058 typedef typename Superclass::MovingImagePointType MovingImagePointType;
00059 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
00060 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
00061 typedef typename Superclass::CoordinateRepresentationType
00062 CoordinateRepresentationType;
00063 typedef typename Superclass::FixedImageSampleContainer
00064 FixedImageSampleContainer;
00065 typedef typename Superclass::ImageDerivativesType ImageDerivativesType;
00066 typedef typename Superclass::WeightsValueType WeightsValueType;
00067 typedef typename Superclass::IndexValueType IndexValueType;
00068
00069
00070 typedef typename Superclass::FixedImagePointType FixedImagePointType;
00071
00073 itkStaticConstMacro( MovingImageDimension, unsigned int,
00074 MovingImageType::ImageDimension );
00075
00083 virtual void Initialize(void) throw ( ExceptionObject );
00084
00086 MeasureType GetValue( const ParametersType & parameters ) const;
00087
00089 void GetDerivative( const ParametersType & parameters,
00090 DerivativeType & Derivative ) const;
00091
00093 void GetValueAndDerivative( const ParametersType & parameters,
00094 MeasureType & Value,
00095 DerivativeType & Derivative ) const;
00096
00097 protected:
00098
00099 MeanSquaresImageToImageMetric();
00100 virtual ~MeanSquaresImageToImageMetric();
00101 void PrintSelf(std::ostream& os, Indent indent) const;
00102
00103 private:
00104
00105
00106 MeanSquaresImageToImageMetric(const Self &);
00107
00108 void operator=(const Self &);
00109
00110 inline bool GetValueThreadProcessSample( unsigned int threadID,
00111 unsigned long fixedImageSample,
00112 const MovingImagePointType & mappedPoint,
00113 double movingImageValue ) const;
00114
00115 inline bool GetValueAndDerivativeThreadProcessSample( unsigned int threadID,
00116 unsigned long fixedImageSample,
00117 const MovingImagePointType & mappedPoint,
00118 double movingImageValue,
00119 const ImageDerivativesType &
00120 movingImageGradientValue ) const;
00121
00122 MeasureType * m_ThreaderMSE;
00123 DerivativeType * m_ThreaderMSEDerivatives;
00124
00125 };
00126
00127 }
00128
00129 #ifndef ITK_MANUAL_INSTANTIATION
00130 #include "itkOptMeanSquaresImageToImageMetric.txx"
00131 #endif
00132
00133 #endif
00134