ITK  4.9.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 >
40  public ImageToImageMetric< TFixedImage, TMovingImage >
41 {
42 public:
48 
51 
53  typedef typename Superclass::RealType RealType;
64  typedef typename Superclass::FixedImageType::PixelType FixedImagePixelType;
66  typedef typename Superclass::MovingImageType::PixelType MovingImagePixelType;
67  typedef typename Superclass::FixedImageConstPointer
71 
76 
80 
82  void Initialize() throw ( ExceptionObject ) 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() {}
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  HistogramImageToImageMetric(const Self &) ITK_DELETE_FUNCTION;
212  void operator=(const Self &) ITK_DELETE_FUNCTION;
213 
216 
221 
224 
227 
231 };
232 } // end namespace itk
233 
234 #ifndef ITK_MANUAL_INSTANTIATION
235 #include "itkHistogramImageToImageMetric.hxx"
236 #endif
237 
238 #endif // itkHistogramImageToImageMetric_h
Array class with size defined at construction time.
Definition: itkArray.h:50
Superclass::TransformPointer TransformPointer
TransformType::OutputPointType OutputPointType
Light weight base class for most itk classes.
TransformType::InputPointType InputPointType
void SetLowerBound(const MeasurementVectorType &bound)
Superclass::FixedImageType::PixelType FixedImagePixelType
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
TransformType::Pointer TransformPointer
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
void ComputeHistogram(const TransformParametersType &parameters, HistogramType &histogram) const
NumericTraits< MovingImagePixelType >::RealType RealType
Superclass::DerivativeType DerivativeType
MovingImageType::ConstPointer MovingImageConstPointer
void SetUpperBound(const MeasurementVectorType &bound)
void CopyHistogram(HistogramType &target, HistogramType &source) const
MeasureType GetValue(const TransformParametersType &parameters) const override
Superclass::FixedImageConstPointer FixedImageConstPointerType
Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
const MeasurementVectorType & GetUpperBound() const
Statistics::Histogram< double > HistogramType
Standard exception handling object.
HistogramType::MeasurementVectorType MeasurementVectorType
virtual MeasureType EvaluateMeasure(HistogramType &histogram) const =0
Superclass::TransformParametersType TransformParametersType
TransformType::JacobianType TransformJacobianType
Superclass::TransformJacobianType TransformJacobianType
Superclass::GradientPixelType GradientPixelType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
FixedImageType::ConstPointer FixedImageConstPointer
const MeasurementVectorType & GetLowerBound() const
Computes similarity between two objects to be registered.
Superclass::MeasureType MeasureType
CovariantVector< RealType, itkGetStaticConstMacro(MovingImageDimension) > GradientPixelType
Transform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingImageDimension), itkGetStaticConstMacro(FixedImageDimension) > TransformType
Computes similarity between regions of two images.
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
TransformType::ParametersType TransformParametersType
void SetTransform(TransformType *transform) override
void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::MovingImageType::PixelType MovingImagePixelType
Superclass::MovingImageConstPointer MovingImageConstPointerType
ImageToImageMetric< TFixedImage, TMovingImage > Superclass