ITK  5.2.0
Insight Toolkit
itkHistogramImageToImageMetric.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 : public ImageToImageMetric<TFixedImage, TMovingImage>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_ASSIGN(HistogramImageToImageMetric);
43 
49 
52 
54  using RealType = typename Superclass::RealType;
55  using TransformType = typename Superclass::TransformType;
56  using TransformPointer = typename Superclass::TransformPointer;
57  using TransformParametersType = typename Superclass::TransformParametersType;
58  using TransformJacobianType = typename Superclass::TransformJacobianType;
59  using GradientPixelType = typename Superclass::GradientPixelType;
60  using InputPointType = typename Superclass::InputPointType;
61  using OutputPointType = typename Superclass::OutputPointType;
62  using MeasureType = typename Superclass::MeasureType;
63  using DerivativeType = typename Superclass::DerivativeType;
64  using FixedImageType = typename Superclass::FixedImageType;
65  using FixedImagePixelType = typename Superclass::FixedImageType::PixelType;
66  using MovingImageType = typename Superclass::MovingImageType;
67  using MovingImagePixelType = typename Superclass::MovingImageType::PixelType;
68  using FixedImageConstPointerType = typename Superclass::FixedImageConstPointer;
69  using MovingImageConstPointerType = typename Superclass::MovingImageConstPointer;
70 
75 
79 
81  void
82  Initialize() override;
83 
86  void
87  SetTransform(TransformType * transform) override;
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 
128 
130  itkSetMacro(DerivativeStepLengthScales, ScalesType);
131 
133  itkGetConstReferenceMacro(DerivativeStepLengthScales, ScalesType);
134 
137  GetValue(const TransformParametersType & parameters) const override;
138 
140  void
141  GetDerivative(const TransformParametersType & parameters, DerivativeType & derivative) const override;
142 
144  void
145  GetValueAndDerivative(const TransformParametersType & parameters,
146  MeasureType & Value,
147  DerivativeType & Derivative) const override;
148 
152  void
153  SetLowerBound(const MeasurementVectorType & bound);
154 
156  const MeasurementVectorType &
157  GetLowerBound() const;
158 
162  void
163  SetUpperBound(const MeasurementVectorType & bound);
164 
166  const MeasurementVectorType &
167  GetUpperBound() const;
168 
169 protected:
173  ~HistogramImageToImageMetric() override = default;
175 
178 
181 
184 
187 
191 
195 
198  void
199  ComputeHistogram(const TransformParametersType & parameters, HistogramType & histogram) const;
200 
203  void
204  ComputeHistogram(const TransformParametersType & parameters,
205  unsigned int parameter,
206  double step,
207  HistogramType & histogram) const;
208 
210  void
211  CopyHistogram(HistogramType & target, HistogramType & source) const;
212 
215  virtual MeasureType
216  EvaluateMeasure(HistogramType & histogram) const = 0;
217 
219  void
220  PrintSelf(std::ostream & os, Indent indent) const override;
221 
222 private:
225 
230 
233 
236 
240 };
241 } // end namespace itk
242 
243 #ifndef ITK_MANUAL_INSTANTIATION
244 # include "itkHistogramImageToImageMetric.hxx"
245 #endif
246 
247 #endif // itkHistogramImageToImageMetric_h
itk::HistogramImageToImageMetric::m_DerivativeStepLengthScales
ScalesType m_DerivativeStepLengthScales
Definition: itkHistogramImageToImageMetric.h:235
itk::HistogramImageToImageMetric::m_HistogramSize
HistogramSizeType m_HistogramSize
Definition: itkHistogramImageToImageMetric.h:177
itk::HistogramImageToImageMetric::m_UsePaddingValue
bool m_UsePaddingValue
Definition: itkHistogramImageToImageMetric.h:229
itk::ImageToImageMetric
Computes similarity between regions of two images.
Definition: itkImageToImageMetric.h:52
itk::SingleValuedCostFunction::MeasureType
double MeasureType
Definition: itkSingleValuedCostFunction.h:50
itk::HistogramImageToImageMetric::m_UpperBoundIncreaseFactor
double m_UpperBoundIncreaseFactor
Definition: itkHistogramImageToImageMetric.h:186
itk::HistogramImageToImageMetric::FixedImagePixelType
typename Superclass::FixedImageType::PixelType FixedImagePixelType
Definition: itkHistogramImageToImageMetric.h:65
itk::HistogramImageToImageMetric::m_LowerBoundSetByUser
bool m_LowerBoundSetByUser
Definition: itkHistogramImageToImageMetric.h:190
itk::HistogramImageToImageMetric::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkHistogramImageToImageMetric.h:78
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::HistogramImageToImageMetric::MovingImageType
typename Superclass::MovingImageType MovingImageType
Definition: itkHistogramImageToImageMetric.h:66
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::HistogramImageToImageMetric::OutputPointType
typename Superclass::OutputPointType OutputPointType
Definition: itkHistogramImageToImageMetric.h:61
itk::HistogramImageToImageMetric::TransformJacobianType
typename Superclass::TransformJacobianType TransformJacobianType
Definition: itkHistogramImageToImageMetric.h:58
itk::HistogramImageToImageMetric::FixedImageConstPointerType
typename Superclass::FixedImageConstPointer FixedImageConstPointerType
Definition: itkHistogramImageToImageMetric.h:68
itk::Statistics::Histogram::MeasurementVectorType
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
itk::Statistics::Histogram
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
itk::HistogramImageToImageMetric::GradientPixelType
typename Superclass::GradientPixelType GradientPixelType
Definition: itkHistogramImageToImageMetric.h:59
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkHistogram.h
itk::HistogramImageToImageMetric::InputPointType
typename Superclass::InputPointType InputPointType
Definition: itkHistogramImageToImageMetric.h:60
itkImageToImageMetric.h
itk::HistogramImageToImageMetric::m_PaddingValue
FixedImagePixelType m_PaddingValue
Definition: itkHistogramImageToImageMetric.h:224
itk::HistogramImageToImageMetric::MovingImageConstPointerType
typename Superclass::MovingImageConstPointer MovingImageConstPointerType
Definition: itkHistogramImageToImageMetric.h:69
itk::HistogramImageToImageMetric::m_UpperBoundSetByUser
bool m_UpperBoundSetByUser
Definition: itkHistogramImageToImageMetric.h:194
itk::HistogramImageToImageMetric::m_DerivativeStepLength
double m_DerivativeStepLength
Definition: itkHistogramImageToImageMetric.h:232
itk::HistogramImageToImageMetric::HistogramSizeType
typename HistogramType::SizeType HistogramSizeType
Definition: itkHistogramImageToImageMetric.h:77
itk::HistogramImageToImageMetric::m_LowerBound
MeasurementVectorType m_LowerBound
Definition: itkHistogramImageToImageMetric.h:180
itk::HistogramImageToImageMetric::RealType
typename Superclass::RealType RealType
Definition: itkHistogramImageToImageMetric.h:54
itk::HistogramImageToImageMetric::FixedImageType
typename Superclass::FixedImageType FixedImageType
Definition: itkHistogramImageToImageMetric.h:64
itk::HistogramImageToImageMetric::TransformPointer
typename Superclass::TransformPointer TransformPointer
Definition: itkHistogramImageToImageMetric.h:56
itk::HistogramImageToImageMetric::TransformType
typename Superclass::TransformType TransformType
Definition: itkHistogramImageToImageMetric.h:55
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::HistogramImageToImageMetric::TransformParametersType
typename Superclass::TransformParametersType TransformParametersType
Definition: itkHistogramImageToImageMetric.h:57
itk::HistogramImageToImageMetric::m_UpperBound
MeasurementVectorType m_UpperBound
Definition: itkHistogramImageToImageMetric.h:183
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itk::HistogramImageToImageMetric::m_Histogram
HistogramPointer m_Histogram
Definition: itkHistogramImageToImageMetric.h:239
itk::HistogramImageToImageMetric::MeasurementVectorType
typename HistogramType::MeasurementVectorType MeasurementVectorType
Definition: itkHistogramImageToImageMetric.h:76
itk::HistogramImageToImageMetric
Computes similarity between two objects to be registered.
Definition: itkHistogramImageToImageMetric.h:39
itk::HistogramImageToImageMetric::MovingImagePixelType
typename Superclass::MovingImageType::PixelType MovingImagePixelType
Definition: itkHistogramImageToImageMetric.h:67