ITK  4.13.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< typename TFixedImage, typename TMovingImage >
39 class ITK_TEMPLATE_EXPORT HistogramImageToImageMetric:
40  public ImageToImageMetric< TFixedImage, TMovingImage >
41 {
42 public:
48 
51 
53  typedef typename Superclass::RealType RealType;
54  typedef typename Superclass::TransformType TransformType;
55  typedef typename Superclass::TransformPointer TransformPointer;
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() ITK_OVERRIDE;
83 
86  void SetTransform(TransformType *transform) ITK_OVERRIDE;
87 
90  itkSetMacro(HistogramSize, HistogramSizeType);
91 
93  itkGetConstReferenceMacro(HistogramSize, HistogramSizeType);
94 
97  itkSetMacro(UpperBoundIncreaseFactor, double);
98  itkGetConstMacro(UpperBoundIncreaseFactor, double);
100 
102  itkSetMacro(PaddingValue, FixedImagePixelType);
103 
105  itkGetConstReferenceMacro(PaddingValue, FixedImagePixelType);
106 
110  itkGetConstReferenceMacro(Histogram, HistogramPointer);
111 
115  itkSetMacro(UsePaddingValue, bool);
116  itkGetConstMacro(UsePaddingValue, bool);
118 
120  itkSetMacro(DerivativeStepLength, double);
121 
123  itkGetConstMacro(DerivativeStepLength, double);
124 
126  typedef Array< double > ScalesType;
127 
129  itkSetMacro(DerivativeStepLengthScales, ScalesType);
130 
132  itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
133 
135  MeasureType GetValue(const TransformParametersType & parameters) const ITK_OVERRIDE;
136 
138  void GetDerivative(const TransformParametersType & parameters,
139  DerivativeType & derivative) const ITK_OVERRIDE;
140 
142  void GetValueAndDerivative(const TransformParametersType & parameters,
143  MeasureType & Value,
144  DerivativeType & Derivative) const ITK_OVERRIDE;
145 
149  void SetLowerBound(const MeasurementVectorType & bound);
150 
152  const MeasurementVectorType & GetLowerBound() const;
153 
157  void SetUpperBound(const MeasurementVectorType & bound);
158 
160  const MeasurementVectorType & GetUpperBound() const;
161 
162 protected:
166  virtual ~HistogramImageToImageMetric() ITK_OVERRIDE {}
167 
170 
173 
176 
179 
183 
187 
190  void ComputeHistogram(const TransformParametersType & parameters,
191  HistogramType & histogram) const;
192 
195  void ComputeHistogram(const TransformParametersType & parameters,
196  unsigned int parameter,
197  double step,
198  HistogramType & histogram) const;
199 
201  void CopyHistogram(HistogramType & target, HistogramType & source) const;
202 
205  virtual MeasureType EvaluateMeasure(HistogramType & histogram) const = 0;
206 
208  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
209 
210 private:
211  ITK_DISALLOW_COPY_AND_ASSIGN(HistogramImageToImageMetric);
212 
215 
220 
223 
226 
230 };
231 } // end namespace itk
232 
233 #ifndef ITK_MANUAL_INSTANTIATION
234 #include "itkHistogramImageToImageMetric.hxx"
235 #endif
236 
237 #endif // itkHistogramImageToImageMetric_h
Array class with size defined at construction time.
Definition: itkArray.h:50
Superclass::TransformPointer TransformPointer
Superclass::FixedImageType::PixelType FixedImagePixelType
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
Superclass::FixedImageConstPointer FixedImageConstPointerType
Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
Statistics::Histogram< double > HistogramType
HistogramType::MeasurementVectorType MeasurementVectorType
Superclass::TransformParametersType TransformParametersType
Superclass::TransformJacobianType TransformJacobianType
Superclass::GradientPixelType GradientPixelType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Computes similarity between two objects to be registered.
Computes similarity between regions of two images.
Superclass::MovingImageType::PixelType MovingImagePixelType
Superclass::MovingImageConstPointer MovingImageConstPointerType
ImageToImageMetric< TFixedImage, TMovingImage > Superclass