18#ifndef __itkAdvancedImageToImageMetric_h
19#define __itkAdvancedImageToImageMetric_h
21#include "itkImageToImageMetric.h"
24#include "itkGradientImageFilter.h"
25#include "itkBSplineInterpolateImageFunction.h"
29#include "itkFixedArray.h"
31#include "vnl/vnl_sparse_matrix.h"
33#include "itkImageMaskSpatialObject.h"
39#include "itkPlatformMultiThreader.h"
80template<
class TFixedImage,
class TMovingImage >
82 public ImageToImageMetric< TFixedImage, TMovingImage >
88 typedef ImageToImageMetric< TFixedImage, TMovingImage >
Superclass;
97 TMovingImage::ImageDimension );
99 TFixedImage::ImageDimension );
184 this->Superclass::SetTransform( arg );
210 itkGetConstMacro( UseImageSampler,
bool );
215 itkSetMacro( RequiredRatioOfValidSamples,
double );
216 itkGetConstMacro( RequiredRatioOfValidSamples,
double );
231 itkSetMacro( MovingLimitRangeRatio,
double );
232 itkGetConstMacro( MovingLimitRangeRatio,
double );
233 itkSetMacro( FixedLimitRangeRatio,
double );
234 itkGetConstMacro( FixedLimitRangeRatio,
double );
238 itkGetConstMacro( UseFixedImageLimiter,
bool );
239 itkGetConstMacro( UseMovingImageLimiter,
bool );
248 itkSetMacro( UseMovingImageDerivativeScales,
bool );
249 itkGetConstMacro( UseMovingImageDerivativeScales,
bool );
251 itkSetMacro( ScaleGradientWithRespectToMovingImageOrientation,
bool );
252 itkGetConstMacro( ScaleGradientWithRespectToMovingImageOrientation,
bool );
276 itkSetMacro( UseMetricSingleThreaded,
bool );
277 itkGetConstReferenceMacro( UseMetricSingleThreaded,
bool );
278 itkBooleanMacro( UseMetricSingleThreaded );
282 itkSetMacro( UseMultiThread,
bool );
283 itkGetConstReferenceMacro( UseMultiThread,
bool );
284 itkBooleanMacro( UseMultiThread );
303 void PrintSelf( std::ostream & os, Indent indent )
const override;
316 typedef BSplineInterpolateImageFunction<
319 typedef BSplineInterpolateImageFunction<
329 typedef GradientImageFilter<
389 ThreadIdType threadID ){}
438 PaddedGetValuePerThreadStruct );
440 AlignedGetValuePerThreadStruct );
452 PaddedGetValueAndDerivativePerThreadStruct );
454 AlignedGetValueAndDerivativePerThreadStruct );
470 itkSetMacro( UseImageSampler,
bool );
475 unsigned long wanted,
unsigned long found )
const;
544 itkSetMacro( UseFixedImageLimiter,
bool );
545 itkSetMacro( UseMovingImageLimiter,
bool );
569#ifndef ITK_MANUAL_INSTANTIATION
570#include "itkAdvancedImageToImageMetric.hxx"
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
ReducedDimensionBSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > ReducedBSplineInterpolatorType
MovingImagePixelType m_MovingImageTrueMin
MovingImageDerivativeScalesType m_MovingImageDerivativeScales
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
MovingImageLimiterOutputType m_MovingImageMaxLimit
Superclass::FixedImageConstPointer FixedImageConstPointer
ThreaderType::WorkUnitInfo ThreadInfoType
AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
virtual void CheckForBSplineTransform(void) const
MovingImageLimiterType::Pointer MovingImageLimiterPointer
Superclass::TransformParametersType TransformParametersType
Superclass::InputPointType InputPointType
Superclass::MovingImageConstPointer MovingImageConstPointer
virtual void CheckForBSplineInterpolator(void)
virtual bool IsInsideMovingMask(const MovingImagePointType &point) const
FixedImageLimiterType::Pointer FixedImageLimiterPointer
Superclass::FixedImageMaskPointer FixedImageMaskPointer
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
Superclass::GradientImageFilterPointer GradientImageFilterPointer
void PrintSelf(std::ostream &os, Indent indent) const override
bool m_TransformIsBSpline
ThreadIdType m_GetValueAndDerivativePerThreadVariablesSize
virtual bool EvaluateTransformJacobian(const FixedImagePointType &fixedImagePoint, TransformJacobianType &jacobian, NonZeroJacobianIndicesType &nzji) const
virtual void InitializeImageSampler(void)
bool m_InterpolatorIsLinear
virtual void InitializeThreadingParameters(void) const
~AdvancedImageToImageMetric() override
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedGetValuePerThreadStruct, AlignedGetValuePerThreadStruct)
bool m_UseFixedImageLimiter
virtual bool EvaluateMovingImageValueAndDerivative(const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient) const
DerivativeType::ValueType HessianValueType
Superclass::GradientImageFilterType GradientImageFilterType
ImageMaskSpatialObject< itkGetStaticConstMacro(MovingImageDimension) > MovingImageMaskSpatialObject2Type
MovingImageLimiterPointer m_MovingImageLimiter
BSplineOrder2TransformType::Pointer BSplineOrder2TransformPointer
AdvancedTransformType::Pointer m_AdvancedTransform
Superclass::TransformJacobianType TransformJacobianType
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 2 > BSplineOrder2TransformType
AlignedGetValueAndDerivativePerThreadStruct * m_GetValueAndDerivativePerThreadVariables
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
Superclass::GradientImagePointer GradientImagePointer
bool m_UseMetricSingleThreaded
AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension > AdvancedTransformType
bool m_UseMovingImageDerivativeScales
Superclass::DerivativeType DerivativeType
Superclass::TransformPointer TransformPointer
virtual void AfterThreadedGetValue(MeasureType &value) const
FixedImagePixelType m_FixedImageTrueMin
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 1 > BSplineOrder1TransformType
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Superclass::OutputPointType OutputPointType
ImageSamplerBase< FixedImageType > ImageSamplerType
double m_MovingLimitRangeRatio
Superclass::CoordinateRepresentationType CoordinateRepresentationType
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::MovingImageMaskPointer MovingImageMaskPointer
void LaunchGetValueThreaderCallback(void) const
virtual void SetTransform(AdvancedTransformType *arg)
Superclass::FixedImageType FixedImageType
SmartPointer< const Self > ConstPointer
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetValueAndDerivativeThreaderCallback(void *arg)
virtual void ThreadedGetValue(ThreadIdType threadID)
TransformType::InputPointType FixedImagePointType
CentralDifferenceGradientFilterPointer m_CentralDifferenceGradientFilter
BSplineInterpolatorFloatType::Pointer BSplineInterpolatorFloatPointer
ImageSamplerType::Pointer ImageSamplerPointer
BSplineInterpolatorFloatPointer m_BSplineInterpolatorFloat
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::GradientPixelType GradientPixelType
Superclass::MeasureType MeasureType
void operator=(const Self &)
virtual void ThreadedGetValueAndDerivative(ThreadIdType threadID)
AlignedGetValuePerThreadStruct * m_GetValuePerThreadVariables
ReducedBSplineInterpolatorType::Pointer ReducedBSplineInterpolatorPointer
virtual void CheckNumberOfSamples(unsigned long wanted, unsigned long found) const
ImageSamplerPointer m_ImageSampler
BSplineOrder3TransformType::Pointer BSplineOrder3TransformPointer
MovingImageType::IndexType MovingImageIndexType
MovingImageType::RegionType MovingImageRegionType
void LaunchGetValueAndDerivativeThreaderCallback(void) const
AdvancedImageToImageMetric Self
ThreadIdType m_GetValuePerThreadVariablesSize
virtual void BeforeThreadedGetValueAndDerivative(const TransformParametersType ¶meters) const
bool m_UseMovingImageLimiter
MovingImageType::Pointer MovingImagePointer
bool m_ScaleGradientWithRespectToMovingImageOrientation
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
BSplineInterpolatorPointer m_BSplineInterpolator
FixedImageIndexType::IndexValueType FixedImageIndexValueType
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
Superclass::MovingImagePixelType MovingImagePixelType
MovingImageLimiterOutputType m_MovingImageMinLimit
bool m_InterpolatorIsBSpline
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
double m_FixedLimitRangeRatio
BSplineOrder1TransformType::Pointer BSplineOrder1TransformPointer
LinearInterpolatorType::Pointer LinearInterpolatorPointer
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct, AlignedGetValueAndDerivativePerThreadStruct)
virtual ImageSamplerType * GetImageSampler(void) const
AdvancedImageToImageMetric()
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
ImageMaskSpatialObject< itkGetStaticConstMacro(FixedImageDimension) > FixedImageMaskSpatialObject2Type
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
virtual void CheckForAdvancedTransform(void)
FixedImageLimiterPointer m_FixedImageLimiter
FixedImageLimiterOutputType m_FixedImageMinLimit
Superclass::FixedImageMaskType FixedImageMaskType
AdvancedLinearInterpolateImageFunction< MovingImageType, CoordinateRepresentationType > LinearInterpolatorType
FixedImageType::Pointer FixedImagePointer
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, GetValuePerThreadStruct, PaddedGetValuePerThreadStruct)
virtual void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const
bool m_TransformIsAdvanced
Superclass::GradientImageType GradientImageType
FixedImageType::PixelType FixedImagePixelType
const AdvancedTransformType * GetTransform(void) const override
CentralDifferenceGradientFilterType::Pointer CentralDifferenceGradientFilterPointer
ReducedBSplineInterpolatorPointer m_ReducedBSplineInterpolator
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION AccumulateDerivativesThreaderCallback(void *arg)
Superclass::InterpolatorType InterpolatorType
FixedImagePixelType m_FixedImageTrueMax
virtual void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const
FixedImageLimiterOutputType m_FixedImageMaxLimit
AdvancedImageToImageMetric(const Self &)
TransformType::OutputPointType MovingImagePointType
bool m_InterpolatorIsReducedBSpline
vnl_sparse_matrix< HessianValueType > HessianType
double m_RequiredRatioOfValidSamples
FixedImageType::IndexType FixedImageIndexType
Superclass::TransformType TransformType
DerivativeType::ValueType DerivativeValueType
void Initialize(void) override
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
Superclass::MovingImageType MovingImageType
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
TransformType::ScalarType ScalarType
BSplineInterpolatorType::Pointer BSplineInterpolatorPointer
virtual void SetNumberOfWorkUnits(ThreadIdType numberOfThreads)
itk::PlatformMultiThreader ThreaderType
Superclass::RealType RealType
bool m_InterpolatorIsBSplineFloat
Superclass::FixedImageRegionType FixedImageRegionType
AdvancedTransformType::NumberOfParametersType NumberOfParametersType
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetValueThreaderCallback(void *arg)
virtual void InitializeLimiters(void)
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 3 > BSplineOrder3TransformType
virtual bool TransformPoint(const FixedImagePointType &fixedImagePoint, MovingImagePointType &mappedPoint) const
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, float > BSplineInterpolatorFloatType
virtual void GetSelfHessian(const TransformParametersType ¶meters, HessianType &H) const
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct, PaddedGetValueAndDerivativePerThreadStruct)
MovingImagePixelType m_MovingImageTrueMax
SmartPointer< Self > Pointer
MultiThreaderParameterType m_ThreaderMetricParameters
Superclass::ParametersType ParametersType
LinearInterpolatorPointer m_LinearInterpolator
Linearly interpolate an image at specified positions.
SmartPointer< Self > Pointer
This class is a base class for any image sampler.
SmartPointer< Self > Pointer
Base class for all ITK limiter function objects.
SmartPointer< Self > Pointer
Superclass::OutputType OutputType
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
SmartPointer< Self > Pointer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
DerivativeType st_Derivative
SizeValueType st_NumberOfPixelsCounted
SizeValueType st_NumberOfPixelsCounted
DerivativeValueType st_NormalizationFactor
DerivativeValueType * st_DerivativePointer
AdvancedImageToImageMetric * st_Metric