ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkCompareHistogramImageToImageMetric.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkCompareHistogramImageToImageMetric_h
19 #define __itkCompareHistogramImageToImageMetric_h
20 
22 
23 namespace itk
24 {
55 template< class TFixedImage, class TMovingImage >
57  public HistogramImageToImageMetric< TFixedImage, TMovingImage >
58 {
59 public:
65 
69 
71  typedef typename Superclass::RealType RealType;
72  typedef typename Superclass::TransformType TransformType;
73  typedef typename Superclass::TransformPointer TransformPointer;
74  typedef typename TransformType::ConstPointer TransformConstPointer;
75 
76  typedef typename Superclass::TransformParametersType TransformParametersType;
77  typedef typename Superclass::TransformJacobianType TransformJacobianType;
78  typedef typename Superclass::GradientPixelType GradientPixelType;
79 
80  typedef typename Superclass::MeasureType MeasureType;
81  typedef typename Superclass::DerivativeType DerivativeType;
82  typedef typename Superclass::FixedImageType FixedImageType;
83  typedef typename Superclass::MovingImageType MovingImageType;
84  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
85  typedef typename Superclass::MovingImageConstPointer
87 
88  typedef typename Superclass::HistogramType HistogramType;
89  typedef typename Superclass::HistogramSizeType HistogramSizeType;
90  typedef typename HistogramType::MeasurementVectorType HistogramMeasurementVectorType;
91  typedef typename HistogramType::AbsoluteFrequencyType HistogramAbsoluteFrequencyType;
93 
94  typedef typename HistogramType::Iterator HistogramIteratorType;
96 
97  typedef typename Superclass::InterpolatorType InterpolatorType;
98  typedef typename Superclass::InterpolatorPointer InterpolatorPointer;
99 
100  typedef typename Superclass::FixedImageRegionType
102 
104  itkSetMacro(TrainingHistogram, HistogramPointerType);
105  itkGetConstReferenceMacro(TrainingHistogram, HistogramPointerType);
107 
109  itkSetConstObjectMacro(TrainingFixedImage, FixedImageType);
110 
112  itkSetConstObjectMacro(TrainingMovingImage, MovingImageType);
113  itkGetConstObjectMacro(TrainingMovingImage, MovingImageType);
115 
117  itkSetObjectMacro(TrainingTransform, TransformType);
118  itkGetModifiableObjectMacro(TrainingTransform, TransformType);
120 
122  itkSetObjectMacro(TrainingInterpolator, InterpolatorType);
123  itkGetModifiableObjectMacro(TrainingInterpolator, InterpolatorType);
125 
127  itkSetMacro(TrainingFixedImageRegion, FixedImageRegionType);
128  itkGetConstReferenceMacro(TrainingFixedImageRegion, FixedImageRegionType);
130 
132  unsigned int GetNumberOfParameters(void) const
133  { return this->GetTransform()->GetNumberOfParameters(); }
134 
137  void Initialize()
138  throw ( ExceptionObject );
139 
140 protected:
144  virtual ~CompareHistogramImageToImageMetric(){}
145  void PrintSelf(std::ostream & os, Indent indent) const;
147 
149  void FormTrainingHistogram()
150  throw ( ExceptionObject );
151 
154  virtual MeasureType EvaluateMeasure(HistogramType & histogram) const = 0;
155 
156 private:
157  // Purposely not implemented.
159  void operator=(Self const &); // Purposely not implemented.
160 
161  FixedImageConstPointer m_TrainingFixedImage;
162  MovingImageConstPointer m_TrainingMovingImage;
163  TransformPointer m_TrainingTransform;
164  InterpolatorPointer m_TrainingInterpolator;
165  FixedImageRegionType m_TrainingFixedImageRegion;
166  HistogramPointerType m_TrainingHistogram;
167 };
168 } // End namespace itk.
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 #include "itkCompareHistogramImageToImageMetric.hxx"
172 #endif
173 
174 #endif // __itkCompareHistogramImageToImageMetric_h
175