18#ifndef itkImageToImageMetric_h
19#define itkImageToImageMetric_h
53template <
typename TFixedImage,
typename TMovingImage>
177#ifndef ITK_FUTURE_LEGACY_REMOVE
181 const auto *
const constArg = arg;
191#ifndef ITK_FUTURE_LEGACY_REMOVE
195 const auto *
const constArg = arg;
212 itkGetConstReferenceMacro(UseFixedImageIndexes,
bool);
285 itkGetConstReferenceMacro(UseFixedImageSamplesIntensityThreshold,
bool);
305 itkGetConstReferenceMacro(UseAllPixels,
bool);
314 itkGetConstReferenceMacro(UseSequentialSampling,
bool);
347 itkSetMacro(UseCachingOfBSplineWeights,
bool);
348 itkGetConstReferenceMacro(UseCachingOfBSplineWeights,
bool);
349 itkBooleanMacro(UseCachingOfBSplineWeights);
386 friend inline std::ostream &
390 os <<
"value: " << val.
value << std::endl;
391 os <<
"valueIndex: " << val.
valueIndex << std::endl;
473#ifndef ITK_FUTURE_LEGACY_REMOVE
477 bool m_TransformIsBSpline{
false };
541 double & movingImageValue,
552 double & movingImageValue,
556#ifndef ITK_FUTURE_LEGACY_REMOVE
560 bool m_InterpolatorIsBSpline{
false };
667 double itkNotUsed(movingImageValue))
const
698 double itkNotUsed(movingImageValue),
720#ifndef ITK_MANUAL_INSTANTIATION
721# include "itkImageToImageMetric.hxx"
Array2D class representing a 2D array.
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
SmartPointer< Self > Pointer
Calculate the derivative by central differencing.
SmartPointer< Self > Pointer
A templated class holding a n-Dimensional covariant vector.
Simulate a standard C array with copy semantics.
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
SmartPointer< Self > Pointer
const ImageToImageMetric * GetConstMetricPointer() const
const ImageToImageMetric * m_ConstMetricPointer
ConstantPointerWrapper(ImageToImageMetric *i2i_metricPointer)
~FixedImageSamplePoint()=default
FixedImagePointType point
const ImageToImageMetric * GetConstImageToImageMetricPointer() const
const MultiThreaderType::WorkUnitInfo * m_WorkUnitInfo
MultiThreaderWorkUnitInfoImageToImageMetricWrapper(const void *workunitInfoAsVoid)
ThreadIdType GetThreadId() const
Computes similarity between regions of two images.
typename FixedImageType::ConstPointer FixedImageConstPointer
TransformPointer m_Transform
typename NumericTraits< MovingImagePixelType >::RealType RealType
MovingImageConstPointer m_MovingImage
virtual const SizeValueType & GetNumberOfPixelsCounted() const
typename TransformType::Pointer TransformPointer
virtual void SetFixedImageMask(const FixedImageMaskType *_arg)
Array2D< IndexValueType > BSplineTransformIndicesArrayType
typename FixedImageType::PixelType FixedImagePixelType
void ReinitializeSeed(int seed)
virtual void GetValueThreadPostProcess(ThreadIdType threadId, bool withinSampleThread) const
virtual void SetNumberOfFixedImageSamples(SizeValueType numSamples)
virtual bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType &mappedPoint, double movingImageValue, const ImageDerivativesType &movingImageGradientValue) const
BSplineTransformWeightsArrayType m_BSplineTransformWeightsArray
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetValueAndDerivativeMultiThreaded(void *workunitInfoAsVoid)
typename FixedImageType::RegionType FixedImageRegionType
void SetTransformParameters(const ParametersType ¶meters) const
FixedImageMaskConstPointer m_FixedImageMask
std::vector< FixedImageIndexType > FixedImageIndexContainer
void SetNumberOfWorkUnits(ThreadIdType numberOfWorkUnits)
typename BSplineTransformWeightsType::ValueType WeightsValueType
typename FixedImageIndexType::IndexValueType FixedImageIndexValueType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType > BSplineInterpolatorType
typename MovingImageType::ConstPointer MovingImageConstPointer
void GetValueMultiThreadedPostProcessInitiate() const
std::unique_ptr< ConstantPointerWrapper > m_ConstSelfWrapper
typename MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
SpatialObject< Self::FixedImageDimension > FixedImageMaskType
SmartPointer< Self > Pointer
MovingImageMaskConstPointer m_MovingImageMask
typename FixedImageType::IndexType FixedImageIndexType
BSplineBaseTransform< CoordinateRepresentationType, FixedImageType::ImageDimension, Self::DeformationSplineOrder > BSplineTransformType
virtual void TransformPointWithDerivatives(unsigned int sampleNumber, MovingImagePointType &mappedPoint, bool &sampleOk, double &movingImageValue, ImageDerivativesType &movingImageGradient, ThreadIdType threadId) const
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetValueMultiThreadedPostProcess(void *workunitInfoAsVoid)
SizeValueType m_NumBSplineWeights
static constexpr unsigned int MovingImageDimension
virtual void SetMovingImageMask(const MovingImageMaskType *_arg)
typename GradientImageFilterType::Pointer GradientImageFilterPointer
typename BSplineTransformType::ParameterIndexArrayType BSplineTransformIndexArrayType
BooleanArrayType m_WithinBSplineSupportRegionArray
FixedImageSampleContainer m_FixedImageSamples
typename MovingImageMaskType::Pointer MovingImageMaskPointer
const TransformPointer * GetThreaderTransform()
CovariantVector< double, Self::MovingImageDimension > ImageDerivativesType
ThreadIdType m_NumberOfWorkUnits
virtual bool GetValueThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType &mappedPoint, double movingImageValue) const
FixedImageType FixedImageType
InterpolatorPointer m_Interpolator
virtual void GetValueAndDerivativeThreadPostProcess(ThreadIdType threadId, bool withinSampleThread) const
std::vector< MovingImagePointType > MovingImagePointArrayType
void SetNumberOfSpatialSamples(SizeValueType num)
virtual void ComputeImageDerivatives(const MovingImagePointType &mappedPoint, ImageDerivativesType &gradient, ThreadIdType threadId) const
void GetValueMultiThreadedInitiate() const
virtual void SampleFixedImageRegion(FixedImageSampleContainer &samples) const
void PrintSelf(std::ostream &os, Indent indent) const override
SingleValuedCostFunction Superclass
BSplineTransformType::Pointer m_BSplineTransform
std::vector< bool > BooleanArrayType
SmartPointer< const Self > ConstPointer
SizeValueType GetNumberOfMovingImageSamples()
virtual void GetValueAndDerivativeThreadPreProcess(ThreadIdType threadId, bool withinSampleThread) const
typename BSplineTransformIndexArrayType::ValueType IndexValueType
virtual void GetValueThread(ThreadIdType threadId) const
typename BSplineTransformType::WeightsType BSplineTransformWeightsType
typename TransformType::ParametersType TransformParametersType
bool m_UseCachingOfBSplineWeights
FixedImagePixelType m_FixedImageSamplesIntensityThreshold
typename TransformType::OutputPointType MovingImagePointType
void GetValueAndDerivativeMultiThreadedPostProcessInitiate() const
static constexpr unsigned int DeformationSplineOrder
typename TransformType::InputPointType FixedImagePointType
DerivativeFunctionType::Pointer m_DerivativeCalculator
bool m_UseFixedImageIndexes
FixedImageIndexContainer m_FixedImageIndexes
FixedImageRegionType m_FixedImageRegion
Image< GradientPixelType, Self::MovingImageDimension > GradientImageType
std::unique_ptr< BSplineTransformWeightsType[]> m_ThreaderBSplineTransformWeights
bool m_WithinThreadPreProcess
std::unique_ptr< BSplineTransformIndexArrayType[]> m_ThreaderBSplineTransformIndices
InterpolateImageFunction< MovingImageType, CoordinateRepresentationType > InterpolatorType
virtual void SynchronizeTransforms() const
void SetUseSequentialSampling(bool useSequential)
static constexpr unsigned int FixedImageDimension
BSplineParametersOffsetType m_BSplineParametersOffset
typename Superclass::ParametersValueType CoordinateRepresentationType
std::unique_ptr< unsigned int[]> m_ThreaderNumberOfMovingImageSamples
MultiThreaderType::Pointer m_Threader
void GetValueAndDerivativeMultiThreadedInitiate() const
typename FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
unsigned int GetNumberOfParameters() const override
CovariantVector< RealType, Self::MovingImageDimension > GradientPixelType
SizeValueType m_NumberOfParameters
SizeValueType GetNumberOfSpatialSamples()
FixedArray< SizeValueType, FixedImageType::ImageDimension > BSplineParametersOffsetType
void SetUseAllPixels(bool useAllPixels)
MovingImagePointArrayType m_BSplinePreTransformPointsArray
BSplineTransformIndexArrayType m_BSplineTransformIndices
typename FixedImageMaskType::Pointer FixedImageMaskPointer
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetValueAndDerivativeMultiThreadedPostProcess(void *workunitInfoAsVoid)
virtual void MultiThreadingInitialize()
MultiThreaderBase MultiThreaderType
virtual void Initialize()
bool m_UseFixedImageSamplesIntensityThreshold
GradientImagePointer m_GradientImage
typename MovingImageType::PixelType MovingImagePixelType
virtual void SampleFixedImageIndexes(FixedImageSampleContainer &samples) const
SmartPointer< GradientImageType > GradientImagePointer
~ImageToImageMetric() override=default
std::vector< FixedImageSamplePoint > FixedImageSampleContainer
Transform< CoordinateRepresentationType, Self::MovingImageDimension, Self::FixedImageDimension > TransformType
MovingImageType MovingImageType
SizeValueType m_NumberOfPixelsCounted
void SetUseFixedImageIndexes(bool useIndexes)
std::unique_ptr< TransformPointer[]> m_ThreaderTransform
virtual void TransformPoint(unsigned int sampleNumber, MovingImagePointType &mappedPoint, bool &sampleOk, double &movingImageValue, ThreadIdType threadId) const
virtual void GetValueThreadPreProcess(ThreadIdType threadId, bool withinSampleThread) const
virtual const SizeValueType & GetNumberOfFixedImageSamples() const
BSplineTransformWeightsType m_BSplineTransformWeights
bool m_UseSequentialSampling
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetValueMultiThreaded(void *workunitInfoAsVoid)
Superclass::ParametersType ParametersType
BSplineTransformIndicesArrayType m_BSplineTransformIndicesArray
virtual void SampleFullFixedImageRegion(FixedImageSampleContainer &samples) const
void SetFixedImageSamplesIntensityThreshold(const FixedImagePixelType &thresh)
void SetUseFixedImageSamplesIntensityThreshold(bool useThresh)
bool m_WithinThreadPostProcess
BSplineInterpolatorType::Pointer m_BSplineInterpolator
void SetFixedImageIndexes(const FixedImageIndexContainer &indexes)
CentralDifferenceImageFunction< MovingImageType, CoordinateRepresentationType > DerivativeFunctionType
SizeValueType m_NumberOfFixedImageSamples
typename MovingImageType::IndexType MovingImageIndexType
Array2D< WeightsValueType > BSplineTransformWeightsArrayType
typename TransformType::OutputPointType OutputPointType
virtual void GetValueAndDerivativeThread(ThreadIdType threadId) const
virtual void SetFixedImageRegion(const FixedImageRegionType reg)
SpatialObject< Self::MovingImageDimension > MovingImageMaskType
typename InterpolatorType::Pointer InterpolatorPointer
typename TransformType::JacobianType TransformJacobianType
FixedImageConstPointer m_FixedImage
GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType > GradientImageFilterType
virtual void ComputeGradient()
virtual void PreComputeTransformValues()
typename TransformType::InputPointType InputPointType
Templated n-dimensional image class.
Control indentation during Print() invocation.
Base class for all image interpolators.
SmartPointer< Self > Pointer
A class for performing multithreaded execution.
SmartPointer< Self > Pointer
Array< ParametersValueType > DerivativeType
Superclass::ParametersValueType ParametersValueType
SingleValuedCostFunction()=default
Superclass::ParametersType ParametersType
Implements transparent reference counting.
Implementation of the composite pattern.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
unsigned long SizeValueType
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION