18#ifndef itkParzenWindowHistogramImageToImageMetric_h
19#define itkParzenWindowHistogramImageToImageMetric_h
74template <
class TFixedImage,
class TMovingImage>
91 using typename Superclass::CoordinateRepresentationType;
92 using typename Superclass::MovingImageType;
93 using typename Superclass::MovingImagePixelType;
94 using typename Superclass::MovingImageConstPointer;
95 using typename Superclass::FixedImageType;
96 using typename Superclass::FixedImageConstPointer;
97 using typename Superclass::FixedImageRegionType;
98 using typename Superclass::TransformType;
99 using typename Superclass::TransformPointer;
100 using typename Superclass::InputPointType;
101 using typename Superclass::OutputPointType;
102 using typename Superclass::TransformParametersType;
103 using typename Superclass::TransformJacobianType;
104 using typename Superclass::InterpolatorType;
105 using typename Superclass::InterpolatorPointer;
106 using typename Superclass::RealType;
107 using typename Superclass::GradientPixelType;
108 using typename Superclass::GradientImageType;
109 using typename Superclass::GradientImagePointer;
110 using typename Superclass::GradientImageFilterType;
111 using typename Superclass::GradientImageFilterPointer;
112 using typename Superclass::FixedImageMaskType;
113 using typename Superclass::FixedImageMaskPointer;
114 using typename Superclass::MovingImageMaskType;
115 using typename Superclass::MovingImageMaskPointer;
116 using typename Superclass::MeasureType;
117 using typename Superclass::DerivativeType;
119 using typename Superclass::ParametersType;
154 GetDerivative(
const ParametersType & parameters, DerivativeType & Derivative)
const override;
164 DerivativeType & derivative)
const override;
172 itkSetClampMacro(NumberOfFixedHistogramBins,
unsigned long, 4, NumericTraits<unsigned long>::max());
173 itkGetConstMacro(NumberOfFixedHistogramBins,
unsigned long);
181 itkSetClampMacro(NumberOfMovingHistogramBins,
unsigned long, 4, NumericTraits<unsigned long>::max());
182 itkGetConstMacro(NumberOfMovingHistogramBins,
unsigned long);
185 itkSetClampMacro(FixedKernelBSplineOrder,
unsigned int, 0, 3);
186 itkGetConstMacro(FixedKernelBSplineOrder,
unsigned int);
189 itkSetClampMacro(MovingKernelBSplineOrder,
unsigned int, 0, 3);
190 itkGetConstMacro(MovingKernelBSplineOrder,
unsigned int);
195 itkSetMacro(UseExplicitPDFDerivatives,
bool);
196 itkGetConstReferenceMacro(UseExplicitPDFDerivatives,
bool);
197 itkBooleanMacro(UseExplicitPDFDerivatives);
202 itkSetMacro(UseDerivative,
bool);
203 itkGetConstMacro(UseDerivative,
bool);
208 itkSetMacro(UseFiniteDifferenceDerivative,
bool);
209 itkGetConstMacro(UseFiniteDifferenceDerivative,
bool);
215 itkSetMacro(FiniteDifferencePerturbation,
double);
216 itkGetConstMacro(FiniteDifferencePerturbation,
double);
227 PrintSelf(std::ostream & os, Indent indent)
const override;
313 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
337 const RealType & movingImageValue,
338 const DerivativeType * imageJacobian,
354 RealType movingImageValue,
355 RealType movingMaskValue,
356 const DerivativeType & movingImageValuesRight,
357 const DerivativeType & movingImageValuesLeft,
358 const DerivativeType & movingMaskValuesRight,
359 const DerivativeType & movingMaskValuesLeft,
370 const DerivativeType & imageJacobian,
461 MeasureType & itkNotUsed(value),
462 DerivativeType & itkNotUsed(derivative))
const
471 MeasureType & itkNotUsed(value),
472 DerivativeType & itkNotUsed(derivative))
const
495 PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct);
497 PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct,
498 AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct);
499 mutable std::vector<AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct>
515#ifndef ITK_MANUAL_INSTANTIATION
516# include "itkParzenWindowHistogramImageToImageMetric.hxx"
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
typename TransformType::OutputPointType MovingImagePointType
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename FixedImageType::PixelType FixedImagePixelType
typename DerivativeType::ValueType DerivativeValueType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename ThreaderType::WorkUnitInfo ThreadInfoType
itk::PlatformMultiThreader ThreaderType
typename FixedImageType::IndexType FixedImageIndexType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
typename ImageSamplerType::Pointer ImageSamplerPointer
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
This class is a base class for any image sampler.
Kernel used for density estimation and nonparameteric regression.
SmartPointer< Self > Pointer
Base class for all ITK limiter function objects.
A base class for image metrics based on a joint histogram computed using Parzen Windowing.
void InitializeThreadingParameters() const override
MarginalPDFType m_MovingImageMarginalPDF
JointPDFRegionType m_JointPDFWindow
JointPDFType::SizeType JointPDFSizeType
JointPDFDerivativesPointer m_JointPDFDerivatives
ITK_DISALLOW_COPY_AND_MOVE(ParzenWindowHistogramImageToImageMetric)
~ParzenWindowHistogramImageToImageMetric() override=default
unsigned long m_NumberOfMovingHistogramBins
DerivativeType m_PerturbedAlphaRight
JointPDFDerivativesType::IndexType JointPDFDerivativesIndexType
KernelFunctionPointer m_MovingKernel
unsigned int m_FixedKernelBSplineOrder
JointPDFPointer m_JointPDF
virtual void ComputePDFsAndIncrementalPDFs(const ParametersType ¶meters) const
ParzenWindowHistogramImageToImageMetric()
virtual void InitializeKernels()
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
JointPDFDerivativesPointer m_IncrementalJointPDFRight
typename JointPDFDerivativesType::Pointer JointPDFDerivativesPointer
void Initialize() override
typename KernelFunctionType::Pointer KernelFunctionPointer
IncrementalMarginalPDFType::SizeType IncrementalMarginalPDFSizeType
IncrementalMarginalPDFType::RegionType IncrementalMarginalPDFRegionType
void NormalizeJointPDFDerivatives(JointPDFDerivativesType *pdf, const double factor) const
bool m_UseExplicitPDFDerivatives
IncrementalMarginalPDFPointer m_MovingIncrementalMarginalPDFLeft
void AfterThreadedComputePDFs() const
std::vector< AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct > m_ParzenWindowHistogramGetValueAndDerivativePerThreadVariables
void ThreadedComputePDFs(ThreadIdType threadId)
double m_FixedParzenTermToIndexOffset
JointPDFDerivativesType::SizeType JointPDFDerivativesSizeType
virtual void ComputePDFsSingleThreaded(const ParametersType ¶meters) const
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, ParzenWindowHistogramGetValueAndDerivativePerThreadStruct, PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputePDFsThreaderCallback(void *arg)
virtual void ComputePDFsAndPDFDerivatives(const ParametersType ¶meters) const
IncrementalMarginalPDFPointer m_FixedIncrementalMarginalPDFLeft
virtual void InitializeHistograms()
void ComputeMarginalPDF(const JointPDFType *jointPDF, MarginalPDFType &marginalPDF, const unsigned int direction) const
bool m_UseFiniteDifferenceDerivative
void GetDerivative(const ParametersType ¶meters, DerivativeType &Derivative) const override
IncrementalMarginalPDFType::IndexType IncrementalMarginalPDFIndexType
typename FixedImageType::OffsetValueType OffsetValueType
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct, AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct)
void LaunchComputePDFsThreaderCallback() const
void UpdateJointPDFDerivatives(const JointPDFIndexType &pdfIndex, double factor, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji) const
double m_FiniteDifferencePerturbation
virtual void GetValueAndAnalyticDerivative(const ParametersType &, MeasureType &, DerivativeType &) const
virtual void ComputePDFs(const ParametersType ¶meters) const
std::vector< JointPDFPointer > m_ThreaderJointPDFs
JointPDFType::RegionType JointPDFRegionType
typename IncrementalMarginalPDFType::Pointer IncrementalMarginalPDFPointer
DerivativeType m_PerturbedAlphaLeft
double m_MovingParzenTermToIndexOffset
JointPDFType::IndexType JointPDFIndexType
virtual void UpdateJointPDFAndIncrementalPDFs(RealType fixedImageValue, RealType movingImageValue, RealType movingMaskValue, const DerivativeType &movingImageValuesRight, const DerivativeType &movingImageValuesLeft, const DerivativeType &movingMaskValuesRight, const DerivativeType &movingMaskValuesLeft, const NonZeroJacobianIndicesType &nzji) const
double m_MovingImageNormalizedMin
void NormalizeJointPDF(JointPDFType *pdf, const double factor) const
double m_FixedImageBinSize
JointPDFDerivativesPointer m_IncrementalJointPDFLeft
unsigned long m_NumberOfFixedHistogramBins
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
void GetValueAndDerivative(const ParametersType ¶meters, MeasureType &value, DerivativeType &derivative) const override
unsigned int m_MovingKernelBSplineOrder
void PrintSelf(std::ostream &os, Indent indent) const override
double m_MovingImageBinSize
virtual void UpdateJointPDFAndDerivatives(const RealType &fixedImageValue, const RealType &movingImageValue, const DerivativeType *imageJacobian, const NonZeroJacobianIndicesType *nzji, JointPDFType *jointPDF) const
KernelFunctionPointer m_DerivativeMovingKernel
ParzenWindowHistogramMultiThreaderParameterType m_ParzenWindowHistogramThreaderParameters
KernelFunctionPointer m_FixedKernel
JointPDFDerivativesType::RegionType JointPDFDerivativesRegionType
virtual void ComputeIncrementalMarginalPDFs(const JointPDFDerivativesType *incrementalPDF, IncrementalMarginalPDFType *fixedIncrementalMarginalPDF, IncrementalMarginalPDFType *movingIncrementalMarginalPDF) const
IncrementalMarginalPDFPointer m_MovingIncrementalMarginalPDFRight
typename JointPDFType::Pointer JointPDFPointer
void EvaluateParzenValues(double parzenWindowTerm, OffsetValueType parzenWindowIndex, const KernelFunctionType *kernel, ParzenValueContainerType &parzenValues) const
SmartPointer< const Self > ConstPointer
double m_FixedImageNormalizedMin
IncrementalMarginalPDFPointer m_FixedIncrementalMarginalPDFRight
virtual void GetValueAndFiniteDifferenceDerivative(const ParametersType &, MeasureType &, DerivativeType &) const
MarginalPDFType m_FixedImageMarginalPDF
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
SizeValueType st_NumberOfPixelsCounted
JointPDFPointer st_JointPDF