ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCompareHistogramImageToImageMetric.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkCompareHistogramImageToImageMetric_h
00019 #define __itkCompareHistogramImageToImageMetric_h
00020 
00021 #include "itkHistogramImageToImageMetric.h"
00022 
00023 namespace itk
00024 {
00055 template< class TFixedImage, class TMovingImage >
00056 class ITK_EXPORT CompareHistogramImageToImageMetric:
00057   public HistogramImageToImageMetric< TFixedImage, TMovingImage >
00058 {
00059 public:
00061   typedef CompareHistogramImageToImageMetric                       Self;
00062   typedef HistogramImageToImageMetric< TFixedImage, TMovingImage > Superclass;
00063   typedef SmartPointer< Self >                                     Pointer;
00064   typedef SmartPointer< const Self >                               ConstPointer;
00065 
00067   itkTypeMacro(CompareHistogramImageToImageMetric,
00068                HistogramImageToImageMetric);
00069 
00071   typedef typename Superclass::RealType         RealType;
00072   typedef typename Superclass::TransformType    TransformType;
00073   typedef typename Superclass::TransformPointer TransformPointer;
00074   typedef typename TransformType::ConstPointer  TransformConstPointer;
00075 
00076   typedef typename Superclass::TransformParametersType TransformParametersType;
00077   typedef typename Superclass::TransformJacobianType   TransformJacobianType;
00078   typedef typename Superclass::GradientPixelType       GradientPixelType;
00079 
00080   typedef typename Superclass::MeasureType            MeasureType;
00081   typedef typename Superclass::DerivativeType         DerivativeType;
00082   typedef typename Superclass::FixedImageType         FixedImageType;
00083   typedef typename Superclass::MovingImageType        MovingImageType;
00084   typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
00085   typedef typename Superclass::MovingImageConstPointer
00086   MovingImageConstPointer;
00087 
00088   typedef typename Superclass::HistogramType            HistogramType;
00089   typedef typename Superclass::HistogramSizeType        HistogramSizeType;
00090   typedef typename HistogramType::MeasurementVectorType HistogramMeasurementVectorType;
00091   typedef typename HistogramType::AbsoluteFrequencyType HistogramAbsoluteFrequencyType;
00092   typedef HistogramAbsoluteFrequencyType                HistogramFrequencyType;
00093 
00094   typedef typename HistogramType::Iterator HistogramIteratorType;
00095   typedef typename HistogramType::Pointer  HistogramPointerType;
00096 
00097   typedef typename Superclass::InterpolatorType    InterpolatorType;
00098   typedef typename Superclass::InterpolatorPointer InterpolatorPointer;
00099 
00100   typedef typename Superclass::FixedImageRegionType
00101   FixedImageRegionType;
00102 
00104   itkSetMacro(TrainingHistogram, HistogramPointerType);
00105 
00107   itkGetConstReferenceMacro(TrainingHistogram, HistogramPointerType);
00108 
00110   itkSetConstObjectMacro(TrainingFixedImage, FixedImageType);
00111 
00113   itkGetConstObjectMacro(TrainingFixedImage, FixedImageType);
00114 
00116   itkSetConstObjectMacro(TrainingMovingImage, MovingImageType);
00117 
00119   itkGetConstObjectMacro(TrainingMovingImage, MovingImageType);
00120 
00122   itkSetObjectMacro(TrainingTransform, TransformType);
00123 
00125   itkGetObjectMacro(TrainingTransform, TransformType);
00126 
00128   itkSetObjectMacro(TrainingInterpolator, InterpolatorType);
00129 
00131   itkGetObjectMacro(TrainingInterpolator, InterpolatorType);
00132 
00134   itkSetMacro(TrainingFixedImageRegion, FixedImageRegionType);
00135 
00137   itkGetConstReferenceMacro(TrainingFixedImageRegion, FixedImageRegionType);
00138 
00140   unsigned int GetNumberOfParameters(void) const
00141   { return this->GetTransform()->GetNumberOfParameters(); }
00142 
00145   void Initialize()
00146   throw ( ExceptionObject );
00147 
00148 protected:
00151   CompareHistogramImageToImageMetric();
00152   virtual ~CompareHistogramImageToImageMetric(){}
00153   void PrintSelf(std::ostream & os, Indent indent) const;
00155 
00157   void FormTrainingHistogram()
00158   throw ( ExceptionObject );
00159 
00162   virtual MeasureType EvaluateMeasure(HistogramType & histogram) const = 0;
00163 
00164 private:
00165   // Purposely not implemented.
00166   CompareHistogramImageToImageMetric(Self const &);
00167   void operator=(Self const &); // Purposely not implemented.
00168 
00169   FixedImageConstPointer  m_TrainingFixedImage;
00170   MovingImageConstPointer m_TrainingMovingImage;
00171   TransformPointer        m_TrainingTransform;
00172   InterpolatorPointer     m_TrainingInterpolator;
00173   FixedImageRegionType    m_TrainingFixedImageRegion;
00174   HistogramPointerType    m_TrainingHistogram;
00175 };
00176 } // End namespace itk.
00177 
00178 #ifndef ITK_MANUAL_INSTANTIATION
00179 #include "itkCompareHistogramImageToImageMetric.hxx"
00180 #endif
00181 
00182 #endif // __itkCompareHistogramImageToImageMetric_h
00183