template<class TFixedImage, class TMovingImage>
class itk::AdvancedNormalizedCorrelationImageToImageMetric< TFixedImage, TMovingImage >
Computes normalized correlation between two images, based on AdvancedImageToImageMetric ...
This metric computes the correlation between pixels in the fixed image and pixels in the moving image. The spatial correspondence between fixed and moving image is established through a Transform. Pixel values are taken from the fixed image, their positions are mapped to the moving image and result in general in non-grid position on it. Values at these non-grid position of the moving image are interpolated using a user-selected Interpolator. The correlation is normalized by the autocorrelations of both the fixed and moving images.
This implementation of the NormalizedCorrelation is based on the AdvancedImageToImageMetric , which means that:
It uses the ImageSampler-framework
It makes use of the compact support of B-splines, in case of B-spline transforms.
Image derivatives are computed using either the B-spline interpolator's implementation or by nearest neighbor interpolation of a precomputed central difference image.
A minimum number of samples that should map within the moving image (mask) can be specified.
The normalized correlation NC is defined as:
where x a voxel in the fixed image f, m the moving image, u(x,p) the deformation of x depending on the transform parameters p. sfm, sff and smm is notation used in the source code. The derivative of NC to p equals:
where gradient is the derivative of the moving image m to x, and where Jacobian is the derivative of the transformation to its parameters. gradient * Jacobian is called the differential. This yields for the derivative:
This class has an option to subtract the sample mean from the sample values in the cross correlation formula. This typically results in narrower valleys in the cost function NC. The default value is false. If SubtractMean is true, the NC is defined as:
where Af and Am are the average of f and m, respectively.
Definition at line 91 of file itkAdvancedNormalizedCorrelationImageToImageMetric.h .
using ConstPointer = SmartPointer< const Self >
using DerivativeValueType = typename DerivativeType::ValueType
using FixedImageLimiterOutputType = typename FixedImageLimiterType::OutputType
using FixedImageLimiterType = LimiterFunctionBase < RealType, FixedImageDimension >
using FixedImagePixelType = typename FixedImageType::PixelType
using ImageSampleContainerPointer = typename ImageSamplerType::OutputVectorContainerPointer
using ImageSampleContainerType = typename ImageSamplerType::OutputVectorContainerType
using ImageSamplerPointer = typename ImageSamplerType::Pointer
using ImageSamplerType = ImageSamplerBase < FixedImageType >
using MovingImageDerivativeScalesType = FixedArray< double , Self::MovingImageDimension >
using MovingImageLimiterOutputType = typename MovingImageLimiterType::OutputType
using MovingImageLimiterType = LimiterFunctionBase < RealType, MovingImageDimension >
using MovingImageRegionType = typename MovingImageType::RegionType
using NumberOfParametersType = typename AdvancedTransformType::NumberOfParametersType
using Pointer = SmartPointer< Self >
using Self = AdvancedNormalizedCorrelationImageToImageMetric
using Superclass = AdvancedImageToImageMetric < TFixedImage, TMovingImage >
using ThreaderType = itk::PlatformMultiThreader
using ThreadInfoType = typename ThreaderType::WorkUnitInfo
using AdvancedTransformType = AdvancedTransform < ScalarType , FixedImageDimension, MovingImageDimension >
using BSplineOrder1TransformPointer = typename BSplineOrder1TransformType::Pointer
using BSplineOrder1TransformType = AdvancedBSplineDeformableTransform < ScalarType , FixedImageDimension, 1 >
using BSplineOrder2TransformPointer = typename BSplineOrder2TransformType::Pointer
using BSplineOrder2TransformType = AdvancedBSplineDeformableTransform < ScalarType , FixedImageDimension, 2 >
using BSplineOrder3TransformPointer = typename BSplineOrder3TransformType::Pointer
using BSplineOrder3TransformType = AdvancedBSplineDeformableTransform < ScalarType , FixedImageDimension, 3 >
using CombinationTransformType = AdvancedCombinationTransform < ScalarType , FixedImageDimension >
using ConstPointer = SmartPointer< const Self >
using DerivativeValueType = typename DerivativeType::ValueType
using FixedImageLimiterOutputType = typename FixedImageLimiterType::OutputType
using FixedImageLimiterPointer = typename FixedImageLimiterType::Pointer
using FixedImageLimiterType = LimiterFunctionBase < RealType, FixedImageDimension >
using FixedImageMaskSpatialObject2Type = ImageMaskSpatialObject< Self::FixedImageDimension >
using FixedImagePixelType = typename FixedImageType::PixelType
using FixedImagePointer = typename FixedImageType::Pointer
using HessianType = vnl_sparse_matrix< HessianValueType >
using HessianValueType = typename DerivativeType::ValueType
using ImageSampleContainerPointer = typename ImageSamplerType::OutputVectorContainerPointer
using ImageSampleContainerType = typename ImageSamplerType::OutputVectorContainerType
using ImageSamplerPointer = typename ImageSamplerType::Pointer
using ImageSamplerType = ImageSamplerBase < FixedImageType >
using MovingImageDerivativeScalesType = FixedArray< double , Self::MovingImageDimension >
using MovingImageLimiterOutputType = typename MovingImageLimiterType::OutputType
using MovingImageLimiterPointer = typename MovingImageLimiterType::Pointer
using MovingImageLimiterType = LimiterFunctionBase < RealType, MovingImageDimension >
using MovingImageMaskSpatialObject2Type = ImageMaskSpatialObject< Self::MovingImageDimension >
using MovingImagePointer = typename MovingImageType::Pointer
using MovingImageRegionType = typename MovingImageType::RegionType
using NumberOfParametersType = typename AdvancedTransformType::NumberOfParametersType
using Pointer = SmartPointer< Self >
using ScalarType = typename TransformType::ScalarType
using Self = AdvancedImageToImageMetric
using Superclass = ImageToImageMetric< TFixedImage, TMovingImage >
using ThreaderType = itk::PlatformMultiThreader
using ThreadInfoType = typename ThreaderType::WorkUnitInfo
virtual const char * GetClassName () const
void GetDerivative (const TransformParametersType ¶meters, DerivativeType &derivative) const override
virtual const bool & GetSubtractMean ()
MeasureType GetValue (const TransformParametersType ¶meters) const override
void GetValueAndDerivative (const TransformParametersType ¶meters, MeasureType &value, DerivativeType &derivative) const override
void GetValueAndDerivativeSingleThreaded (const TransformParametersType ¶meters, MeasureType &value, DerivativeType &derivative) const
ITK_DISALLOW_COPY_AND_MOVE (AdvancedNormalizedCorrelationImageToImageMetric )
itkStaticConstMacro (FixedImageDimension, unsigned int , FixedImageType::ImageDimension)
itkStaticConstMacro (MovingImageDimension, unsigned int , MovingImageType::ImageDimension)
virtual void SetSubtractMean (bool _arg)
virtual void SubtractMeanOff ()
virtual void SubtractMeanOn ()
virtual void BeforeThreadedGetValueAndDerivative (const TransformParametersType ¶meters) const
virtual const char * GetClassName () const
virtual const FixedImageLimiterType * GetFixedImageLimiter ()
virtual double GetFixedLimitRangeRatio () const
virtual ImageSamplerType * GetImageSampler () const
virtual const MovingImageDerivativeScalesType & GetMovingImageDerivativeScales ()
virtual const MovingImageLimiterType * GetMovingImageLimiter ()
virtual double GetMovingLimitRangeRatio () const
virtual double GetRequiredRatioOfValidSamples () const
virtual bool GetScaleGradientWithRespectToMovingImageOrientation () const
virtual void GetSelfHessian (const TransformParametersType ¶meters, HessianType &H) const
const AdvancedTransformType * GetTransform () const override
virtual bool GetUseFixedImageLimiter () const
virtual bool GetUseImageSampler () const
virtual const bool & GetUseMetricSingleThreaded ()
virtual bool GetUseMovingImageDerivativeScales () const
virtual bool GetUseMovingImageLimiter () const
virtual const bool & GetUseMultiThread ()
void Initialize () override
ITK_DISALLOW_COPY_AND_MOVE (AdvancedImageToImageMetric )
itkStaticConstMacro (FixedImageDimension, unsigned int , TFixedImage::ImageDimension)
itkStaticConstMacro (MovingImageDimension, unsigned int , TMovingImage::ImageDimension)
virtual void SetFixedImageLimiter (FixedImageLimiterType *_arg)
virtual void SetFixedLimitRangeRatio (double _arg)
virtual void SetImageSampler (ImageSamplerType *_arg)
virtual void SetMovingImageDerivativeScales (MovingImageDerivativeScalesType _arg)
virtual void SetMovingImageLimiter (MovingImageLimiterType *_arg)
virtual void SetMovingLimitRangeRatio (double _arg)
virtual void SetNumberOfWorkUnits (ThreadIdType numberOfThreads)
virtual void SetRequiredRatioOfValidSamples (double _arg)
virtual void SetScaleGradientWithRespectToMovingImageOrientation (bool _arg)
virtual void SetTransform (AdvancedTransformType *arg)
virtual void SetUseMetricSingleThreaded (bool _arg)
virtual void SetUseMovingImageDerivativeScales (bool _arg)
virtual void SetUseMultiThread (bool _arg)
virtual void UseMetricSingleThreadedOff ()
virtual void UseMetricSingleThreadedOn ()
virtual void UseMultiThreadOff ()
virtual void UseMultiThreadOn ()
using BSplineInterpolatorType = BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double >
using CentralDifferenceGradientFilterType = GradientImageFilter< MovingImageType, RealType, RealType >
using FixedImageIndexType = typename FixedImageType::IndexType
using FixedImageIndexValueType = typename FixedImageIndexType::IndexValueType
using FixedImagePointType = typename TransformType::InputPointType
using MovingImageContinuousIndexType = typename InterpolatorType::ContinuousIndexType
using MovingImageDerivativeType = typename BSplineInterpolatorType::CovariantVectorType
using MovingImageIndexType = typename MovingImageType::IndexType
using MovingImagePointType = typename TransformType::OutputPointType
using NonZeroJacobianIndicesType = typename AdvancedTransformType::NonZeroJacobianIndicesType
using BSplineInterpolatorFloatPointer = typename BSplineInterpolatorFloatType::Pointer
using BSplineInterpolatorFloatType = BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, float >
using BSplineInterpolatorPointer = typename BSplineInterpolatorType::Pointer
using BSplineInterpolatorType = BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double >
using CentralDifferenceGradientFilterPointer = typename CentralDifferenceGradientFilterType::Pointer
using CentralDifferenceGradientFilterType = GradientImageFilter< MovingImageType, RealType, RealType >
using FixedImageIndexType = typename FixedImageType::IndexType
using FixedImageIndexValueType = typename FixedImageIndexType::IndexValueType
using FixedImagePointType = typename TransformType::InputPointType
using LinearInterpolatorPointer = typename LinearInterpolatorType::Pointer
using LinearInterpolatorType = AdvancedLinearInterpolateImageFunction < MovingImageType, CoordinateRepresentationType >
using MovingImageContinuousIndexType = typename InterpolatorType::ContinuousIndexType
using MovingImageDerivativeType = typename BSplineInterpolatorType::CovariantVectorType
using MovingImageIndexType = typename MovingImageType::IndexType
using MovingImagePointType = typename TransformType::OutputPointType
using NonZeroJacobianIndicesType = typename AdvancedTransformType::NonZeroJacobianIndicesType
using ReducedBSplineInterpolatorPointer = typename ReducedBSplineInterpolatorType::Pointer
using ReducedBSplineInterpolatorType = ReducedDimensionBSplineInterpolateImageFunction < MovingImageType, CoordinateRepresentationType, double >
AdvancedNormalizedCorrelationImageToImageMetric ()
void AfterThreadedGetValueAndDerivative (MeasureType &value, DerivativeType &derivative) const override
void InitializeThreadingParameters () const override
void PrintSelf (std::ostream &os, Indent indent) const override
void ThreadedGetValueAndDerivative (ThreadIdType threadID) override
void UpdateDerivativeTerms (const RealType &fixedImageValue, const RealType &movingImageValue, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji, DerivativeType &derivativeF, DerivativeType &derivativeM, DerivativeType &differential) const
~AdvancedNormalizedCorrelationImageToImageMetric () override=default
AdvancedImageToImageMetric ()
virtual void AfterThreadedGetValue (MeasureType &value) const
virtual void AfterThreadedGetValueAndDerivative (MeasureType &value, DerivativeType &derivative) const
virtual void CheckForAdvancedTransform ()
virtual void CheckForBSplineInterpolator ()
virtual void CheckForBSplineTransform () const
virtual void CheckNumberOfSamples (unsigned long wanted, unsigned long found) const
virtual bool EvaluateMovingImageValueAndDerivative (const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient) const
virtual bool EvaluateTransformJacobian (const FixedImagePointType &fixedImagePoint, TransformJacobianType &jacobian, NonZeroJacobianIndicesType &nzji) const
virtual void EvaluateTransformJacobianInnerProduct (const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const
bool FastEvaluateMovingImageValueAndDerivative (const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient, const ThreadIdType threadId) const
virtual void InitializeImageSampler ()
virtual void InitializeLimiters ()
virtual void InitializeThreadingParameters () const
virtual bool IsInsideMovingMask (const MovingImagePointType &point) const
itkAlignedTypedef (ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct, AlignedGetValueAndDerivativePerThreadStruct)
itkAlignedTypedef (ITK_CACHE_LINE_ALIGNMENT, PaddedGetValuePerThreadStruct, AlignedGetValuePerThreadStruct)
itkPadStruct (ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct , PaddedGetValueAndDerivativePerThreadStruct)
itkPadStruct (ITK_CACHE_LINE_ALIGNMENT, GetValuePerThreadStruct , PaddedGetValuePerThreadStruct)
void LaunchGetValueAndDerivativeThreaderCallback () const
void LaunchGetValueThreaderCallback () const
void PrintSelf (std::ostream &os, Indent indent) const override
virtual void SetUseFixedImageLimiter (bool _arg)
virtual void SetUseImageSampler (bool _arg)
virtual void SetUseMovingImageLimiter (bool _arg)
virtual void ThreadedGetValue (ThreadIdType threadID)
virtual void ThreadedGetValueAndDerivative (ThreadIdType threadID)
MovingImagePointType TransformPoint (const FixedImagePointType &fixedImagePoint) const
~AdvancedImageToImageMetric () override=default