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;
114 using typename Superclass::MeasureType;
115 using typename Superclass::DerivativeType;
117 using typename Superclass::ParametersType;
151 GetDerivative(
const ParametersType & parameters, DerivativeType & Derivative)
const override;
161 DerivativeType & derivative)
const override;
169 itkSetClampMacro(NumberOfFixedHistogramBins,
unsigned long, 4, NumericTraits<unsigned long>::max());
170 itkGetConstMacro(NumberOfFixedHistogramBins,
unsigned long);
178 itkSetClampMacro(NumberOfMovingHistogramBins,
unsigned long, 4, NumericTraits<unsigned long>::max());
179 itkGetConstMacro(NumberOfMovingHistogramBins,
unsigned long);
182 itkSetClampMacro(FixedKernelBSplineOrder,
unsigned int, 0, 3);
183 itkGetConstMacro(FixedKernelBSplineOrder,
unsigned int);
186 itkSetClampMacro(MovingKernelBSplineOrder,
unsigned int, 0, 3);
187 itkGetConstMacro(MovingKernelBSplineOrder,
unsigned int);
192 itkSetMacro(UseExplicitPDFDerivatives,
bool);
193 itkGetConstReferenceMacro(UseExplicitPDFDerivatives,
bool);
194 itkBooleanMacro(UseExplicitPDFDerivatives);
199 itkSetMacro(UseDerivative,
bool);
200 itkGetConstMacro(UseDerivative,
bool);
205 itkSetMacro(UseFiniteDifferenceDerivative,
bool);
206 itkGetConstMacro(UseFiniteDifferenceDerivative,
bool);
212 itkSetMacro(FiniteDifferencePerturbation,
double);
213 itkGetConstMacro(FiniteDifferencePerturbation,
double);
224 PrintSelf(std::ostream & os, Indent indent)
const override;
309 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
332 const RealType movingImageValue,
333 const DerivativeType * imageJacobian,
349 RealType movingImageValue,
350 RealType movingMaskValue,
351 const DerivativeType & movingImageValuesRight,
352 const DerivativeType & movingImageValuesLeft,
353 const DerivativeType & movingMaskValuesRight,
354 const DerivativeType & movingMaskValuesLeft,
365 const DerivativeType & imageJacobian,
456 MeasureType & itkNotUsed(value),
457 DerivativeType & itkNotUsed(derivative))
const
466 MeasureType & itkNotUsed(value),
467 DerivativeType & itkNotUsed(derivative))
const
490 PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct);
492 PaddedParzenWindowHistogramGetValueAndDerivativePerThreadStruct,
493 AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct);
494 mutable std::vector<AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct>
510#ifndef ITK_MANUAL_INSTANTIATION
511# include "itkParzenWindowHistogramImageToImageMetric.hxx"
typename TransformType::OutputPointType MovingImagePointType
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
typename MovingImageType::RegionType MovingImageRegionType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
typename FixedImageType::PixelType FixedImagePixelType
typename DerivativeType::ValueType DerivativeValueType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
typename MovingImageType::IndexType MovingImageIndexType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
typename FixedImageType::IndexType FixedImageIndexType
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
AdvancedImageToImageMetric()
ImageSamplerBase< FixedImageType > ImageSamplerType
MultiThreaderBase::WorkUnitInfo ThreadInfoType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
typename MovingImageLimiterType::OutputType MovingImageLimiterOutputType
typename TransformType::InputPointType FixedImagePointType
typename FixedImageLimiterType::OutputType FixedImageLimiterOutputType
SmartPointer< FixedImageMaskType > FixedImageMaskPointer
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename ImageSamplerType::Pointer ImageSamplerPointer
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
Kernel used for density estimation and nonparameteric regression.
SmartPointer< Self > Pointer
void InitializeThreadingParameters() const override
MarginalPDFType m_MovingImageMarginalPDF
JointPDFRegionType m_JointPDFWindow
Array< PDFValueType > ParzenValueContainerType
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
ParzenWindowHistogramImageToImageMetric Self
typename KernelFunctionType::Pointer KernelFunctionPointer
IncrementalMarginalPDFType::SizeType IncrementalMarginalPDFSizeType
IncrementalMarginalPDFType::RegionType IncrementalMarginalPDFRegionType
void NormalizeJointPDFDerivatives(JointPDFDerivativesType *pdf, const double factor) const
bool m_UseExplicitPDFDerivatives
Image< PDFValueType, 2 > IncrementalMarginalPDFType
IncrementalMarginalPDFPointer m_MovingIncrementalMarginalPDFLeft
void AfterThreadedComputePDFs() const
std::vector< AlignedParzenWindowHistogramGetValueAndDerivativePerThreadStruct > m_ParzenWindowHistogramGetValueAndDerivativePerThreadVariables
float PDFDerivativeValueType
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)
Image< PDFDerivativeValueType, 3 > JointPDFDerivativesType
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
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
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
SmartPointer< Self > Pointer
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
Image< PDFValueType, 2 > JointPDFType
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
static void EvaluateParzenValues(double parzenWindowTerm, OffsetValueType parzenWindowIndex, const KernelFunctionType &kernel, PDFValueType *parzenValues)
void NormalizeJointPDF(JointPDFType *pdf, const double factor) const
double m_FixedImageBinSize
virtual void UpdateJointPDFAndDerivatives(const RealType fixedImageValue, const RealType movingImageValue, const DerivativeType *imageJacobian, const NonZeroJacobianIndicesType *nzji, JointPDFType *jointPDF) const
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
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
Array< PDFValueType > MarginalPDFType
typename JointPDFType::Pointer JointPDFPointer
SmartPointer< const Self > ConstPointer
double m_FixedImageNormalizedMin
IncrementalMarginalPDFPointer m_FixedIncrementalMarginalPDFRight
KernelFunctionBase2< PDFValueType > KernelFunctionType
virtual void GetValueAndFiniteDifferenceDerivative(const ParametersType &, MeasureType &, DerivativeType &) const
MarginalPDFType m_FixedImageMarginalPDF
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
SizeValueType st_NumberOfPixelsCounted
JointPDFPointer st_JointPDF