ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkHistogramImageToImageMetric.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 __itkHistogramImageToImageMetric_h
19 #define __itkHistogramImageToImageMetric_h
20 
21 #include "itkHistogram.h"
22 #include "itkImageToImageMetric.h"
23 
24 namespace itk
25 {
38 template< class TFixedImage, class TMovingImage >
39 class ITK_EXPORT HistogramImageToImageMetric:
40  public ImageToImageMetric< TFixedImage, TMovingImage >
41 {
42 public:
48 
51 
53  typedef typename Superclass::RealType RealType;
56  typedef typename Superclass::TransformParametersType TransformParametersType;
57  typedef typename Superclass::TransformJacobianType TransformJacobianType;
58  typedef typename Superclass::GradientPixelType GradientPixelType;
59  typedef typename Superclass::InputPointType InputPointType;
60  typedef typename Superclass::OutputPointType OutputPointType;
61  typedef typename Superclass::MeasureType MeasureType;
62  typedef typename Superclass::DerivativeType DerivativeType;
63  typedef typename Superclass::FixedImageType FixedImageType;
64  typedef typename Superclass::FixedImageType::PixelType FixedImagePixelType;
65  typedef typename Superclass::MovingImageType MovingImageType;
66  typedef typename Superclass::MovingImageType::PixelType MovingImagePixelType;
67  typedef typename Superclass::FixedImageConstPointer
69  typedef typename Superclass::MovingImageConstPointer
71 
76 
80 
82  void Initialize()
83  throw ( ExceptionObject );
84 
87  void SetTransform(TransformType *transform);
88 
91  itkSetMacro(HistogramSize, HistogramSizeType);
92 
94  itkGetConstReferenceMacro(HistogramSize, HistogramSizeType);
95 
98  itkSetMacro(UpperBoundIncreaseFactor, double);
99  itkGetConstMacro(UpperBoundIncreaseFactor, double);
101 
103  itkSetMacro(PaddingValue, FixedImagePixelType);
104 
106  itkGetConstReferenceMacro(PaddingValue, FixedImagePixelType);
107 
111  itkGetConstReferenceMacro(Histogram, HistogramPointer);
112 
116  itkSetMacro(UsePaddingValue, bool);
117  itkGetConstMacro(UsePaddingValue, bool);
119 
121  itkSetMacro(DerivativeStepLength, double);
122 
124  itkGetConstMacro(DerivativeStepLength, double);
125 
127  typedef Array< double > ScalesType;
128 
130  itkSetMacro(DerivativeStepLengthScales, ScalesType);
131 
133  itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
134 
136  MeasureType GetValue(const TransformParametersType & parameters) const;
137 
139  void GetDerivative(const TransformParametersType & parameters,
140  DerivativeType & derivative) const;
141 
143  void GetValueAndDerivative(const TransformParametersType & parameters,
144  MeasureType & Value,
145  DerivativeType & Derivative) const;
146 
150  void SetLowerBound(const MeasurementVectorType & bound);
151 
155  void SetUpperBound(const MeasurementVectorType & bound);
156 
157 protected:
161  virtual ~HistogramImageToImageMetric() {}
162 
165 
168 
171 
174 
178 
182 
185  void ComputeHistogram(const TransformParametersType & parameters,
186  HistogramType & histogram) const;
187 
190  void ComputeHistogram(const TransformParametersType & parameters,
191  unsigned int parameter,
192  double step,
193  HistogramType & histogram) const;
194 
196  void CopyHistogram(HistogramType & target, HistogramType & source) const;
197 
200  virtual MeasureType EvaluateMeasure(HistogramType & histogram) const = 0;
201 
203  void PrintSelf(std::ostream & os, Indent indent) const;
204 
205 private:
206  HistogramImageToImageMetric(const Self &); //purposely not implemented
207  void operator=(const Self &); //purposely not implemented
208 
211 
216 
219 
222 
226 };
227 } // end namespace itk
228 
229 #ifndef ITK_MANUAL_INSTANTIATION
230 #include "itkHistogramImageToImageMetric.hxx"
231 #endif
232 
233 #endif // __itkHistogramImageToImageMetric_h
234