ITK  4.3.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;
54  typedef typename Superclass::TransformType TransformType;
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 
153  const MeasurementVectorType & GetLowerBound() const;
154 
158  void SetUpperBound(const MeasurementVectorType & bound);
159 
161  const MeasurementVectorType & GetUpperBound() const;
162 
163 protected:
167  virtual ~HistogramImageToImageMetric() {}
168 
171 
174 
177 
180 
184 
188 
191  void ComputeHistogram(const TransformParametersType & parameters,
192  HistogramType & histogram) const;
193 
196  void ComputeHistogram(const TransformParametersType & parameters,
197  unsigned int parameter,
198  double step,
199  HistogramType & histogram) const;
200 
202  void CopyHistogram(HistogramType & target, HistogramType & source) const;
203 
206  virtual MeasureType EvaluateMeasure(HistogramType & histogram) const = 0;
207 
209  void PrintSelf(std::ostream & os, Indent indent) const;
210 
211 private:
212  HistogramImageToImageMetric(const Self &); //purposely not implemented
213  void operator=(const Self &); //purposely not implemented
214 
217 
222 
225 
228 
232 };
233 } // end namespace itk
234 
235 #ifndef ITK_MANUAL_INSTANTIATION
236 #include "itkHistogramImageToImageMetric.hxx"
237 #endif
238 
239 #endif // __itkHistogramImageToImageMetric_h
240