ITK  5.2.0
Insight Toolkit
itkJointHistogramMutualInformationImageToImageMetricv4.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 
19 #ifndef itkJointHistogramMutualInformationImageToImageMetricv4_h
20 #define itkJointHistogramMutualInformationImageToImageMetricv4_h
21 
23 #include "itkImage.h"
25 
28 
29 namespace itk
30 {
43 template <typename TFixedImage,
44  typename TMovingImage,
45  typename TVirtualImage = TFixedImage,
46  typename TInternalComputationValueType = double,
47  typename TMetricTraits =
48  DefaultImageToImageMetricTraitsv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType>>
50  : public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits>
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_MOVE(JointHistogramMutualInformationImageToImageMetricv4);
54 
57  using Superclass =
61 
63  itkNewMacro(Self);
64 
67 
69  using CoordinateRepresentationType = typename Superclass::CoordinateRepresentationType;
70 
74  using InternalComputationValueType = TInternalComputationValueType;
75 
77  using ParametersType = typename Superclass::ParametersType;
78  using ParametersValueType = typename Superclass::ParametersValueType;
79  using NumberOfParametersType = typename Superclass::NumberOfParametersType;
80 
82  using MeasureType = typename Superclass::MeasureType;
83  using DerivativeType = typename Superclass::DerivativeType;
84  using FixedImagePointType = typename Superclass::FixedImagePointType;
85  using FixedImagePixelType = typename Superclass::FixedImagePixelType;
86  using FixedImageGradientType = typename Superclass::FixedGradientPixelType;
87  using MovingImagePointType = typename Superclass::MovingImagePointType;
88  using MovingImagePixelType = typename Superclass::MovingImagePixelType;
89  using MovingImageGradientType = typename Superclass::MovingGradientPixelType;
90 
91  using FixedTransformJacobianType = typename Superclass::FixedTransformType::JacobianType;
92  using MovingTransformJacobianType = typename Superclass::MovingTransformType::JacobianType;
93 
94  using VirtualImageType = typename Superclass::VirtualImageType;
95  using VirtualIndexType = typename Superclass::VirtualIndexType;
96  using VirtualPointType = typename Superclass::VirtualPointType;
97  using VirtualPointSetType = typename Superclass::VirtualPointSetType;
98 
99  /* Image dimension accessors */
100  static constexpr typename TVirtualImage::ImageDimensionType VirtualImageDimension = TVirtualImage::ImageDimension;
101  static constexpr typename TMovingImage::ImageDimensionType MovingImageDimension = TMovingImage::ImageDimension;
102 
104  using PDFValueType = TInternalComputationValueType;
105 
114 
116  itkGetModifiableObjectMacro(JointPDF, JointPDFType);
117 
118  // Declare the type for the derivative calculation
121  using JPDFGradientImagePointer = typename JPDFGradientImageType::Pointer;
122 
125  using MarginalGradientImagePointer = typename MarginalGradientImageType::Pointer;
126 
132 
138 
139 
141  itkSetClampMacro(NumberOfHistogramBins, SizeValueType, 5, NumericTraits<SizeValueType>::max());
142  itkGetConstReferenceMacro(NumberOfHistogramBins, SizeValueType);
144 
146  itkSetMacro(VarianceForJointPDFSmoothing, TInternalComputationValueType);
147  itkGetMacro(VarianceForJointPDFSmoothing, TInternalComputationValueType);
149 
151  void
152  Initialize() override;
153 
155  GetValue() const override;
156 
157 protected:
160 
164  void
165  InitializeForIteration() const override;
166 
169  ComputeValue() const;
170 
173  inline void
174  ComputeJointPDFPoint(const FixedImagePixelType fixedImageValue,
175  const MovingImagePixelType movingImageValue,
176  JointPDFPointType & jointPDFpoint) const;
177 
179  ThreadedImageRegionPartitioner<Self::VirtualImageDimension>,
181  friend class JointHistogramMutualInformationComputeJointPDFThreaderBase<ThreadedIndexedContainerPartitioner, Self>;
183  ThreadedImageRegionPartitioner<Self::VirtualImageDimension>,
184  Self>;
185  friend class JointHistogramMutualInformationComputeJointPDFThreader<ThreadedIndexedContainerPartitioner, Self>;
186 
188  JointHistogramMutualInformationComputeJointPDFThreader<ThreadedImageRegionPartitioner<Self::VirtualImageDimension>,
189  Self>;
191  JointHistogramMutualInformationComputeJointPDFThreader<ThreadedIndexedContainerPartitioner, Self>;
192 
193  typename JointHistogramMutualInformationDenseComputeJointPDFThreaderType::Pointer
194  m_JointHistogramMutualInformationDenseComputeJointPDFThreader;
195  typename JointHistogramMutualInformationSparseComputeJointPDFThreaderType::Pointer
196  m_JointHistogramMutualInformationSparseComputeJointPDFThreader;
197 
199  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
200  Superclass,
201  Self>;
202  friend class JointHistogramMutualInformationGetValueAndDerivativeThreader<ThreadedIndexedContainerPartitioner,
203  Superclass,
204  Self>;
205 
208  ThreadedImageRegionPartitioner<Superclass::VirtualImageDimension>,
209  Superclass,
210  Self>;
212  JointHistogramMutualInformationGetValueAndDerivativeThreader<ThreadedIndexedContainerPartitioner, Superclass, Self>;
213 
215  void
216  PrintSelf(std::ostream & os, Indent indent) const override;
217 
219  SizeValueType m_JointHistogramTotalCount{ 0 };
220 
221 private:
224 
227 
230 
232  TInternalComputationValueType m_VarianceForJointPDFSmoothing;
233 
236  TInternalComputationValueType m_FixedImageTrueMin;
237  TInternalComputationValueType m_FixedImageTrueMax;
238  TInternalComputationValueType m_MovingImageTrueMin;
239  TInternalComputationValueType m_MovingImageTrueMax;
240  TInternalComputationValueType m_FixedImageBinSize;
241  TInternalComputationValueType m_MovingImageBinSize;
242 
243  TInternalComputationValueType m_JointPDFSum;
245 
246  TInternalComputationValueType m_Log2;
248 };
249 
250 } // end namespace itk
251 
252 #ifndef ITK_MANUAL_INSTANTIATION
253 # include "itkJointHistogramMutualInformationImageToImageMetricv4.hxx"
254 #endif
255 
256 #endif
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFSizeType
typename JointPDFType::SizeType JointPDFSizeType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:136
itk::OptimizerParameters< TInternalComputationValueType >
itk::ImageToImageMetricv4::FixedImageGradientType
typename MetricTraits::FixedImageGradientType FixedImageGradientType
Definition: itkImageToImageMetricv4.h:297
itk::ImageToImageMetricv4::InternalComputationValueType
TInternalComputationValueType InternalComputationValueType
Definition: itkImageToImageMetricv4.h:198
itk::JointHistogramMutualInformationImageToImageMetricv4::PDFValueType
TInternalComputationValueType PDFValueType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:104
itk::ImageToImageMetricv4::FixedTransformJacobianType
typename Superclass::FixedTransformJacobianType FixedTransformJacobianType
Definition: itkImageToImageMetricv4.h:228
itk::GradientRecursiveGaussianImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: itkGradientRecursiveGaussianImageFilter.h:121
itk::JointHistogramMutualInformationImageToImageMetricv4::MarginalPDFPointType
typename MarginalPDFType::PointType MarginalPDFPointType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:109
itk::JointHistogramMutualInformationImageToImageMetricv4::MarginalGradientImagePointer
typename MarginalGradientImageType::Pointer MarginalGradientImagePointer
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:125
itk::JointHistogramMutualInformationImageToImageMetricv4
Computes the mutual information between two images to be registered using the method referenced below...
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:49
itk::ObjectToObjectMetricBaseTemplate::NumberOfParametersType
unsigned int NumberOfParametersType
Definition: itkObjectToObjectMetricBase.h:176
itk::ThreadedImageRegionPartitioner
Class for partitioning of an ImageRegion.
Definition: itkThreadedImageRegionPartitioner.h:45
itk::JointHistogramMutualInformationImageToImageMetricv4::MarginalGradientImageType
typename MarginalGradientFilterType::OutputImageType MarginalGradientImageType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:124
itk::JointHistogramMutualInformationImageToImageMetricv4::m_FixedImageBinSize
TInternalComputationValueType m_FixedImageBinSize
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:240
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::JointHistogramMutualInformationImageToImageMetricv4::m_MovingImageBinSize
TInternalComputationValueType m_MovingImageBinSize
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:241
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFIndexValueType
typename JointPDFType::IndexValueType JointPDFIndexValueType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:113
itk::JointHistogramMutualInformationImageToImageMetricv4::m_MovingImageTrueMin
TInternalComputationValueType m_MovingImageTrueMin
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:238
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkImage.h
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFPointType
typename JointPDFType::PointType JointPDFPointType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:112
itk::SmartPointer< Self >
itk::JointHistogramMutualInformationComputeJointPDFThreaderBase
Compute the JointPDF image.
Definition: itkJointHistogramMutualInformationComputeJointPDFThreaderBase.h:36
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFInterpolatorPointer
typename JointPDFInterpolatorType::Pointer JointPDFInterpolatorPointer
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:129
itk::ImageToImageMetricv4::MovingImagePointType
typename MovingImageType::PointType MovingImagePointType
Definition: itkImageToImageMetricv4.h:246
itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h
itk::JointHistogramMutualInformationImageToImageMetricv4::m_FixedImageTrueMin
TInternalComputationValueType m_FixedImageTrueMin
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:236
itk::ImageToImageMetricv4::FixedImagePointType
typename FixedImageType::PointType FixedImagePointType
Definition: itkImageToImageMetricv4.h:239
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::JointHistogramMutualInformationImageToImageMetricv4::m_JointPDFSpacing
JointPDFSpacingType m_JointPDFSpacing
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:244
itk::LinearInterpolateImageFunction
Linearly interpolate an image at specified positions.
Definition: itkLinearInterpolateImageFunction.h:50
itk::JointHistogramMutualInformationImageToImageMetricv4::m_NumberOfHistogramBins
SizeValueType m_NumberOfHistogramBins
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:235
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::JointHistogramMutualInformationImageToImageMetricv4::m_Padding
JointPDFIndexValueType m_Padding
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:247
itk::JointHistogramMutualInformationImageToImageMetricv4::MarginalPDFIndexType
typename MarginalPDFType::IndexType MarginalPDFIndexType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:108
itk::ObjectToObjectMetricBaseTemplate::CoordinateRepresentationType
TInternalComputationValueType CoordinateRepresentationType
Definition: itkObjectToObjectMetricBase.h:106
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::GradientRecursiveGaussianImageFilter
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
Definition: itkGradientRecursiveGaussianImageFilter.h:59
itkImageToImageMetricv4.h
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFValueType
typename JointPDFType::PixelType JointPDFValueType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:134
itk::JointHistogramMutualInformationImageToImageMetricv4::m_MovingImageTrueMax
TInternalComputationValueType m_MovingImageTrueMax
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:239
itk::CostFunctionTemplate::ParametersValueType
TInternalComputationValueType ParametersValueType
Definition: itkCostFunction.h:52
itk::ImageToImageMetricv4::VirtualIndexType
typename Superclass::VirtualIndexType VirtualIndexType
Definition: itkImageToImageMetricv4.h:261
itk::JointHistogramMutualInformationImageToImageMetricv4::m_FixedImageMarginalPDF
MarginalPDFType::Pointer m_FixedImageMarginalPDF
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:223
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFRegionType
typename JointPDFType::RegionType JointPDFRegionType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:135
itk::JointHistogramMutualInformationImageToImageMetricv4::m_VarianceForJointPDFSmoothing
TInternalComputationValueType m_VarianceForJointPDFSmoothing
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:232
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFSpacingType
typename JointPDFType::SpacingType JointPDFSpacingType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:137
itk::Image::PixelType
TPixel PixelType
Definition: itkImage.h:106
itkJointHistogramMutualInformationComputeJointPDFThreader.h
itk::JointHistogramMutualInformationImageToImageMetricv4::m_JointPDF
JointPDFType::Pointer m_JointPDF
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:229
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::JointHistogramMutualInformationImageToImageMetricv4::m_FixedImageTrueMax
TInternalComputationValueType m_FixedImageTrueMax
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:237
itk::ObjectToObjectMetricBaseTemplate::MeasureType
typename Superclass::MeasureType MeasureType
Definition: itkObjectToObjectMetricBase.h:109
itk::Image::SpacingType
typename Superclass::SpacingType SpacingType
Definition: itkImage.h:154
itk::JointHistogramMutualInformationImageToImageMetricv4::m_MovingImageMarginalPDF
MarginalPDFType::Pointer m_MovingImageMarginalPDF
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:226
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageToImageMetricv4::MovingImageGradientType
typename MetricTraits::MovingImageGradientType MovingImageGradientType
Definition: itkImageToImageMetricv4.h:298
itk::ImageToImageMetricv4::VirtualPointType
typename Superclass::VirtualPointType VirtualPointType
Definition: itkImageToImageMetricv4.h:258
itk::ImageToImageMetricv4
Definition: itkImageToImageMetricv4.h:174
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itk::JointHistogramMutualInformationImageToImageMetricv4::m_Log2
TInternalComputationValueType m_Log2
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:246
itk::JointHistogramMutualInformationGetValueAndDerivativeThreader
Processes points for JointHistogramMutualInformationImageToImageMetricv4 GetValueAndDerivative().
Definition: itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h:34
itk::JointHistogramMutualInformationImageToImageMetricv4::m_JointPDFSum
TInternalComputationValueType m_JointPDFSum
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:243
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::JointHistogramMutualInformationComputeJointPDFThreader
Provide a threaded computation of the joint PDF for JointHistogramMutualInformationImageToImageMetric...
Definition: itkJointHistogramMutualInformationComputeJointPDFThreader.h:44
itk::ImageToImageMetricv4::MovingTransformJacobianType
typename Superclass::MovingTransformJacobianType MovingTransformJacobianType
Definition: itkImageToImageMetricv4.h:229
itk::ImageToImageMetricv4::FixedImagePixelType
typename FixedImageType::PixelType FixedImagePixelType
Definition: itkImageToImageMetricv4.h:235
itk::ImageToImageMetricv4::MovingImagePixelType
typename MovingImageType::PixelType MovingImagePixelType
Definition: itkImageToImageMetricv4.h:242
itk::ObjectToObjectMetricBaseTemplate::DerivativeType
typename Superclass::DerivativeType DerivativeType
Definition: itkObjectToObjectMetricBase.h:112
itk::JointHistogramMutualInformationImageToImageMetricv4::JPDFGradientImageType
typename JPDFGradientFilterType::OutputImageType JPDFGradientImageType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:120
itk::ImageToImageMetricv4::VirtualPointSetType
typename Superclass::VirtualPointSetType VirtualPointSetType
Definition: itkImageToImageMetricv4.h:262
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::JointHistogramMutualInformationImageToImageMetricv4::JPDFGradientImagePointer
typename JPDFGradientImageType::Pointer JPDFGradientImagePointer
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:121
itk::ImageToImageMetricv4::VirtualImageType
typename Superclass::VirtualImageType VirtualImageType
Definition: itkImageToImageMetricv4.h:251
itkBSplineDerivativeKernelFunction.h
itk::JointHistogramMutualInformationImageToImageMetricv4::JointPDFIndexType
typename JointPDFType::IndexType JointPDFIndexType
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:111
itk::JointHistogramMutualInformationImageToImageMetricv4::MarginalPDFInterpolatorPointer
typename MarginalPDFInterpolatorType::Pointer MarginalPDFInterpolatorPointer
Definition: itkJointHistogramMutualInformationImageToImageMetricv4.h:131