ITK  4.3.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 
107  itkGetConstReferenceMacro(TrainingHistogram, HistogramPointerType);
108 
110  itkSetConstObjectMacro(TrainingFixedImage, FixedImageType);
111 
113  itkGetConstObjectMacro(TrainingFixedImage, FixedImageType);
114 
116  itkSetConstObjectMacro(TrainingMovingImage, MovingImageType);
117 
119  itkGetConstObjectMacro(TrainingMovingImage, MovingImageType);
120 
122  itkSetObjectMacro(TrainingTransform, TransformType);
123 
125  itkGetObjectMacro(TrainingTransform, TransformType);
126 
128  itkSetObjectMacro(TrainingInterpolator, InterpolatorType);
129 
131  itkGetObjectMacro(TrainingInterpolator, InterpolatorType);
132 
134  itkSetMacro(TrainingFixedImageRegion, FixedImageRegionType);
135 
137  itkGetConstReferenceMacro(TrainingFixedImageRegion, FixedImageRegionType);
138 
140  unsigned int GetNumberOfParameters(void) const
141  { return this->GetTransform()->GetNumberOfParameters(); }
142 
145  void Initialize()
146  throw ( ExceptionObject );
147 
148 protected:
152  virtual ~CompareHistogramImageToImageMetric(){}
153  void PrintSelf(std::ostream & os, Indent indent) const;
155 
157  void FormTrainingHistogram()
158  throw ( ExceptionObject );
159 
162  virtual MeasureType EvaluateMeasure(HistogramType & histogram) const = 0;
163 
164 private:
165  // Purposely not implemented.
167  void operator=(Self const &); // Purposely not implemented.
168 
169  FixedImageConstPointer m_TrainingFixedImage;
170  MovingImageConstPointer m_TrainingMovingImage;
171  TransformPointer m_TrainingTransform;
172  InterpolatorPointer m_TrainingInterpolator;
173  FixedImageRegionType m_TrainingFixedImageRegion;
174  HistogramPointerType m_TrainingHistogram;
175 };
176 } // End namespace itk.
177 
178 #ifndef ITK_MANUAL_INSTANTIATION
179 #include "itkCompareHistogramImageToImageMetric.hxx"
180 #endif
181 
182 #endif // __itkCompareHistogramImageToImageMetric_h
183