ITK  5.0.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:
43  ITK_DISALLOW_COPY_AND_ASSIGN(HistogramImageToImageMetric);
44 
50 
53 
55  using RealType = typename Superclass::RealType;
56  using TransformType = typename Superclass::TransformType;
57  using TransformPointer = typename Superclass::TransformPointer;
58  using TransformParametersType = typename Superclass::TransformParametersType;
59  using TransformJacobianType = typename Superclass::TransformJacobianType;
60  using GradientPixelType = typename Superclass::GradientPixelType;
61  using InputPointType = typename Superclass::InputPointType;
62  using OutputPointType = typename Superclass::OutputPointType;
63  using MeasureType = typename Superclass::MeasureType;
64  using DerivativeType = typename Superclass::DerivativeType;
65  using FixedImageType = typename Superclass::FixedImageType;
66  using FixedImagePixelType = typename Superclass::FixedImageType::PixelType;
67  using MovingImageType = typename Superclass::MovingImageType;
68  using MovingImagePixelType = typename Superclass::MovingImageType::PixelType;
69  using FixedImageConstPointerType = typename Superclass::FixedImageConstPointer;
70  using MovingImageConstPointerType = typename Superclass::MovingImageConstPointer;
71 
76 
80 
82  void Initialize() override;
83 
86  void SetTransform(TransformType *transform) 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 
127 
129  itkSetMacro(DerivativeStepLengthScales, ScalesType);
130 
132  itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
133 
135  MeasureType GetValue(const TransformParametersType & parameters) const override;
136 
138  void GetDerivative(const TransformParametersType & parameters,
139  DerivativeType & derivative) const override;
140 
142  void GetValueAndDerivative(const TransformParametersType & parameters,
143  MeasureType & Value,
144  DerivativeType & Derivative) const 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  ~HistogramImageToImageMetric() override = default;
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 override;
210 
211 private:
214 
219 
222 
225 
229 };
230 } // end namespace itk
231 
232 #ifndef ITK_MANUAL_INSTANTIATION
233 #include "itkHistogramImageToImageMetric.hxx"
234 #endif
235 
236 #endif // itkHistogramImageToImageMetric_h
Array class with size defined at construction time.
Definition: itkArray.h:46
Light weight base class for most itk classes.
typename Superclass::FixedImageType::PixelType FixedImagePixelType
typename Superclass::MovingImageType MovingImageType
typename Superclass::TransformJacobianType TransformJacobianType
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
typename Superclass::FixedImageConstPointer FixedImageConstPointerType
typename HistogramType::Pointer HistogramPointer
typename Superclass::OutputPointType OutputPointType
typename Superclass::MovingImageConstPointer MovingImageConstPointerType
typename Superclass::TransformParametersType TransformParametersType
typename Superclass::InputPointType InputPointType
typename Superclass::GradientPixelType GradientPixelType
typename Superclass::FixedImageType FixedImageType
typename HistogramType::SizeType HistogramSizeType
typename Superclass::TransformPointer TransformPointer
typename Superclass::TransformType TransformType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:102
typename HistogramType::MeasurementVectorType MeasurementVectorType
Computes similarity between two objects to be registered.
typename Superclass::MovingImageType::PixelType MovingImagePixelType
Computes similarity between regions of two images.