ITK
6.0.0
Insight Toolkit
|
#include <itkMattesMutualInformationImageToImageMetric.h>
Computes the mutual information between two images to be registered using the method of Mattes et al.
MattesMutualInformationImageToImageMetric computes the mutual information between a fixed and moving image to be registered.
This class is templated over the FixedImage type and the MovingImage type.
The fixed and moving images are set via methods SetFixedImage() and SetMovingImage(). This metric makes use of user specified Transform and Interpolator. The Transform is used to map points from the fixed image to the moving image domain. The Interpolator is used to evaluate the image intensity at user specified geometric points in the moving image. The Transform and Interpolator are set via methods SetTransform() and SetInterpolator().
If a BSplineInterpolationFunction is used, this class obtain image derivatives from the BSpline interpolator. Otherwise, image derivatives are computed using central differencing.
The method GetValue() computes of the mutual information while method GetValueAndDerivative() computes both the mutual information and its derivatives with respect to the transform parameters.
The calculations are based on the method of Mattes et al [1,2] where the probability density distribution are estimated using Parzen histograms. Since the fixed image PDF does not contribute to the derivatives, it does not need to be smooth. Hence, a zero order (box car) BSpline kernel is used for the fixed image intensity PDF. On the other hand, to ensure smoothness a third order BSpline kernel is used for the moving image intensity PDF.
On Initialize(), the FixedImage is uniformly sampled within the FixedImageRegion. The number of samples used can be set via SetNumberOfSpatialSamples(). Typically, the number of spatial samples used should increase with the image size.
The option UseAllPixelOn() disables the random sampling and uses all the pixels of the FixedImageRegion in order to estimate the joint intensity PDF.
During each call of GetValue(), GetDerivatives(), GetValueAndDerivatives(), marginal and joint intensity PDF's values are estimated at discrete position or bins. The number of bins used can be set via SetNumberOfHistogramBins(). To handle data with arbitrary magnitude and dynamic range, the image intensity is scaled such that any contribution to the histogram will fall into a valid bin.
Once the PDF's have been constructed, the mutual information is obtained by double summing over the discrete PDF values.
Notes:
References: [1] "Nonrigid multimodality image registration" D. Mattes, D. R. Haynor, H. Vesselle, T. Lewellen and W. Eubank Medical Imaging 2001: Image Processing, 2001, pp. 1609-1620. [2] "PET-CT Image Registration in the Chest Using Free-form Deformations" D. Mattes, D. R. Haynor, H. Vesselle, T. Lewellen and W. Eubank IEEE Transactions in Medical Imaging. Vol.22, No.1, January 2003. pp.120-128. [3] "Optimization of Mutual Information for MultiResolution Image Registration" P. Thevenaz and M. Unser IEEE Transactions in Image Processing, 9(12) December 2000.
Definition at line 117 of file itkMattesMutualInformationImageToImageMetric.h.
Classes | |
struct | MMIMetricPerThreadStruct |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::Object | |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool val) |
Static Public Member Functions inherited from itk::LightObject | |
static void | BreakOnError () |
static Pointer | New () |
Static Public Attributes | |
static constexpr unsigned int | MovingImageDimension = MovingImageType::ImageDimension |
Static Public Attributes inherited from itk::ImageToImageMetric< TFixedImage, TMovingImage > | |
static constexpr unsigned int | FixedImageDimension = TFixedImage::ImageDimension |
static constexpr unsigned int | MovingImageDimension = TMovingImage::ImageDimension |
Protected Member Functions | |
MattesMutualInformationImageToImageMetric () | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
~MattesMutualInformationImageToImageMetric () override=default | |
Protected Member Functions inherited from itk::ImageToImageMetric< TFixedImage, TMovingImage > | |
virtual void | ComputeImageDerivatives (const MovingImagePointType &mappedPoint, ImageDerivativesType &gradient, ThreadIdType threadId) const |
void | GetValueAndDerivativeMultiThreadedInitiate () const |
void | GetValueAndDerivativeMultiThreadedPostProcessInitiate () const |
virtual void | GetValueAndDerivativeThread (ThreadIdType threadId) const |
virtual void | GetValueAndDerivativeThreadPostProcess (ThreadIdType, bool) const |
virtual void | GetValueAndDerivativeThreadPreProcess (ThreadIdType, bool) const |
virtual bool | GetValueAndDerivativeThreadProcessSample (ThreadIdType, SizeValueType, const MovingImagePointType &, double, const ImageDerivativesType &) const |
ImageToImageMetric () | |
virtual void | PreComputeTransformValues () |
void | PrintSelf (std::ostream &os, Indent indent) const override |
virtual void | SampleFixedImageIndexes (FixedImageSampleContainer &samples) const |
virtual void | SampleFixedImageRegion (FixedImageSampleContainer &samples) const |
virtual void | SampleFullFixedImageRegion (FixedImageSampleContainer &samples) const |
virtual void | SynchronizeTransforms () const |
virtual void | TransformPoint (unsigned int sampleNumber, MovingImagePointType &mappedPoint, bool &sampleOk, double &movingImageValue, ThreadIdType threadId) const |
virtual void | TransformPointWithDerivatives (unsigned int sampleNumber, MovingImagePointType &mappedPoint, bool &sampleOk, double &movingImageValue, ImageDerivativesType &movingImageGradient, ThreadIdType threadId) const |
~ImageToImageMetric () override=default | |
void | GetValueMultiThreadedInitiate () const |
void | GetValueMultiThreadedPostProcessInitiate () const |
virtual void | GetValueThread (ThreadIdType threadId) const |
Protected Member Functions inherited from itk::SingleValuedCostFunction | |
SingleValuedCostFunction ()=default | |
~SingleValuedCostFunction () override | |
Protected Member Functions inherited from itk::CostFunctionTemplate< double > | |
CostFunctionTemplate ()=default | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
~CostFunctionTemplate () override=default | |
Protected Member Functions inherited from itk::Object | |
Object () | |
bool | PrintObservers (std::ostream &os, Indent indent) const |
void | PrintSelf (std::ostream &os, Indent indent) const override |
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
~Object () override | |
Protected Member Functions inherited from itk::LightObject | |
virtual LightObject::Pointer | InternalClone () const |
LightObject () | |
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
virtual void | PrintSelf (std::ostream &os, Indent indent) const |
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
virtual | ~LightObject () |
Private Types | |
using | CubicBSplineDerivativeFunctionType = BSplineDerivativeKernelFunction< 3, PDFValueType > |
using | CubicBSplineFunctionType = BSplineKernelFunction< 3, PDFValueType > |
using | JointPDFDerivativesIndexType = JointPDFDerivativesType::IndexType |
using | JointPDFDerivativesRegionType = JointPDFDerivativesType::RegionType |
using | JointPDFDerivativesSizeType = JointPDFDerivativesType::SizeType |
using | JointPDFDerivativesValueType = JointPDFDerivativesType::PixelType |
using | JointPDFIndexType = JointPDFType::IndexType |
using | JointPDFRegionType = JointPDFType::RegionType |
using | JointPDFSizeType = JointPDFType::SizeType |
using | JointPDFValueType = JointPDFType::PixelType |
using | MarginalPDFType = std::vector< PDFValueType > |
using | PRatioArrayType = Array2D< PRatioType > |
using | PRatioType = PDFValueType |
Private Member Functions | |
void | CommonGetValueProcessing () const |
void | ComputeFixedImageParzenWindowIndices (FixedImageSampleContainer &samples) |
void | ComputePDFDerivatives (ThreadIdType threadId, unsigned int sampleNumber, int pdfMovingIndex, const ImageDerivativesType &movingImageGradientValue, PDFValueType cubicBSplineDerivativeValue) const |
void | GetValueAndDerivativeThreadPostProcess (ThreadIdType threadId, bool withinSampleThread) const override |
void | GetValueAndDerivativeThreadPreProcess (ThreadIdType threadId, bool withinSampleThread) const override |
bool | GetValueAndDerivativeThreadProcessSample (ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType &mappedPoint, double movingImageValue, const ImageDerivativesType &movingImageGradientValue) const override |
void | GetValueThreadPostProcess (ThreadIdType threadId, bool withinSampleThread) const override |
void | GetValueThreadPreProcess (ThreadIdType threadId, bool withinSampleThread) const override |
bool | GetValueThreadProcessSample (ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType &mappedPoint, double movingImageValue) const override |
itkAlignedTypedef (ITK_CACHE_LINE_ALIGNMENT, PaddedMMIMetricPerThreadStruct, AlignedMMIMetricPerThreadStruct) | |
itkPadStruct (ITK_CACHE_LINE_ALIGNMENT, MMIMetricPerThreadStruct, PaddedMMIMetricPerThreadStruct) | |
Private Attributes | |
PDFValueType | m_FixedImageBinSize { 0.0 } |
PDFValueType | m_FixedImageNormalizedMin { 0.0 } |
PDFValueType | m_FixedImageTrueMax { 0.0 } |
PDFValueType | m_FixedImageTrueMin { 0.0 } |
bool | m_ImplicitDerivativesSecondPass { false } |
std::unique_ptr< AlignedMMIMetricPerThreadStruct[]> | m_MMIMetricPerThreadVariables |
PDFValueType | m_MovingImageBinSize { 0.0 } |
MarginalPDFType | m_MovingImageMarginalPDF {} |
PDFValueType | m_MovingImageNormalizedMin { 0.0 } |
PDFValueType | m_MovingImageTrueMax { 0.0 } |
PDFValueType | m_MovingImageTrueMin { 0.0 } |
SizeValueType | m_NumberOfHistogramBins { 50 } |
PRatioArrayType | m_PRatioArray {} |
bool | m_UseExplicitPDFDerivatives { true } |
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::ConstPointer = SmartPointer<const Self> |
Definition at line 127 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 283 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Typedefs for BSpline kernel and derivative functions.
Definition at line 282 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 276 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 278 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 279 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::JointPDFDerivativesType = Image<PDFValueType, 3> |
Definition at line 231 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 277 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 272 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 274 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 275 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::JointPDFType = Image<PDFValueType, 2> |
Typedef for the joint PDF and PDF derivatives are stored as ITK Images.
Definition at line 230 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 273 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
The moving image marginal PDF.
Definition at line 342 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::OffsetValueType = typename FixedImageType::OffsetValueType |
Definition at line 157 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::PDFValueType = double |
The marginal PDFs are stored as std::vector.
Definition at line 226 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::Pointer = SmartPointer<Self> |
Definition at line 126 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 337 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Helper array for storing the values of the JointPDF ratios.
Definition at line 336 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::Self = MattesMutualInformationImageToImageMetric |
Standard class type aliases.
Definition at line 124 of file itkMattesMutualInformationImageToImageMetric.h.
using itk::MattesMutualInformationImageToImageMetric< TFixedImage, TMovingImage >::Superclass = ImageToImageMetric<TFixedImage, TMovingImage> |
Definition at line 125 of file itkMattesMutualInformationImageToImageMetric.h.
|
protected |
|
overrideprotecteddefault |
|
private |
Extract common processing for both GetValueAndDerivative and GetValue functions
|
private |
Compute the Parzen window index locations from the pre-computed samples.
|
private |
Compute PDF derivative contribution for each parameter.
|
overridevirtual |
Get the derivatives of the match measure.
Implements itk::SingleValuedCostFunction.
|
inline |
Get the internal JointPDF image that was used in creating the metric value.
Definition at line 238 of file itkMattesMutualInformationImageToImageMetric.h.
|
inline |
Get the internal JointPDFDeriviative image that was used in creating the metric derivative value. This is only created when UseExplicitPDFDerivatives is ON, and derivatives are requested.
Definition at line 255 of file itkMattesMutualInformationImageToImageMetric.h.
|
overridevirtual |
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
virtual |
Number of bins to used in the histogram. According to Mattes et al the optimum value is 50. The minimum value is 5 due to the padding required by the Parzen windowing with a cubic-BSpline kernel. Note that even if the metric is used on binary images, the number of bins should at least be equal to five.
|
virtual |
This variable selects the method to be used for computing the Metric derivatives with respect to the Transform parameters. Two modes of computation are available. The choice between one and the other is a trade-off between computation speed and memory allocations. The two modes are described in detail below:
UseExplicitPDFDerivatives = True will compute the Metric derivative by first calculating the derivatives of each one of the Joint PDF bins with respect to each one of the Transform parameters and then accumulating these contributions in the final metric derivative array by using a bin-specific weight. The memory required for storing the intermediate derivatives is a 3D array of floating point values with size equals to the product of (number of histogram bins)^2 times number of transform parameters. This method is well suited for Transform with a small number of parameters.
UseExplicitPDFDerivatives = False will compute the Metric derivative by first computing the weights for each one of the Joint PDF bins and caching them into an array. Then it will revisit each one of the PDF bins for computing its weighted contribution to the full derivative array. In this method an extra 2D array is used for storing the weights of each one of the PDF bins. This is an array of floating point values with size equals to (number of histogram bins)^2. This method is well suited for Transforms with a large number of parameters, such as, BSplineTransforms.
|
overridevirtual |
Get the value.
Implements itk::SingleValuedCostFunction.
|
overridevirtual |
Get the value and derivatives for single valued optimizers.
Reimplemented from itk::SingleValuedCostFunction.
|
overrideprivatevirtual |
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
overrideprivatevirtual |
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
overrideprivatevirtual |
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
overrideprivatevirtual |
Get the match Measure.
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
overrideprivatevirtual |
Get the match Measure.
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
overrideprivatevirtual |
Get the match Measure.
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
overridevirtual |
Initialize the Metric by (1) making sure that all the components are present and plugged together correctly, (2) uniformly select NumberOfSpatialSamples within the FixedImageRegion, and (3) allocate memory for pdf data structures.
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
private |
|
private |
|
static |
Method for creation through the object factory.
|
overrideprotectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::ImageToImageMetric< TFixedImage, TMovingImage >.
|
virtual |
Number of bins to used in the histogram. According to Mattes et al the optimum value is 50. The minimum value is 5 due to the padding required by the Parzen windowing with a cubic-BSpline kernel. Note that even if the metric is used on binary images, the number of bins should at least be equal to five.
|
virtual |
This variable selects the method to be used for computing the Metric derivatives with respect to the Transform parameters. Two modes of computation are available. The choice between one and the other is a trade-off between computation speed and memory allocations. The two modes are described in detail below:
UseExplicitPDFDerivatives = True will compute the Metric derivative by first calculating the derivatives of each one of the Joint PDF bins with respect to each one of the Transform parameters and then accumulating these contributions in the final metric derivative array by using a bin-specific weight. The memory required for storing the intermediate derivatives is a 3D array of floating point values with size equals to the product of (number of histogram bins)^2 times number of transform parameters. This method is well suited for Transform with a small number of parameters.
UseExplicitPDFDerivatives = False will compute the Metric derivative by first computing the weights for each one of the Joint PDF bins and caching them into an array. Then it will revisit each one of the PDF bins for computing its weighted contribution to the full derivative array. In this method an extra 2D array is used for storing the weights of each one of the PDF bins. This is an array of floating point values with size equals to (number of histogram bins)^2. This method is well suited for Transforms with a large number of parameters, such as, BSplineTransforms.
|
virtual |
This variable selects the method to be used for computing the Metric derivatives with respect to the Transform parameters. Two modes of computation are available. The choice between one and the other is a trade-off between computation speed and memory allocations. The two modes are described in detail below:
UseExplicitPDFDerivatives = True will compute the Metric derivative by first calculating the derivatives of each one of the Joint PDF bins with respect to each one of the Transform parameters and then accumulating these contributions in the final metric derivative array by using a bin-specific weight. The memory required for storing the intermediate derivatives is a 3D array of floating point values with size equals to the product of (number of histogram bins)^2 times number of transform parameters. This method is well suited for Transform with a small number of parameters.
UseExplicitPDFDerivatives = False will compute the Metric derivative by first computing the weights for each one of the Joint PDF bins and caching them into an array. Then it will revisit each one of the PDF bins for computing its weighted contribution to the full derivative array. In this method an extra 2D array is used for storing the weights of each one of the PDF bins. This is an array of floating point values with size equals to (number of histogram bins)^2. This method is well suited for Transforms with a large number of parameters, such as, BSplineTransforms.
|
private |
Definition at line 332 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 327 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 329 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 328 of file itkMattesMutualInformationImageToImageMetric.h.
|
mutableprivate |
Definition at line 376 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 372 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 333 of file itkMattesMutualInformationImageToImageMetric.h.
|
mutableprivate |
Definition at line 343 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 326 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 331 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 330 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Variables to define the marginal and joint histograms.
Definition at line 325 of file itkMattesMutualInformationImageToImageMetric.h.
|
mutableprivate |
Definition at line 339 of file itkMattesMutualInformationImageToImageMetric.h.
|
private |
Definition at line 375 of file itkMattesMutualInformationImageToImageMetric.h.
|
staticconstexpr |
The moving image dimension.
Definition at line 160 of file itkMattesMutualInformationImageToImageMetric.h.