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" 37 #include "itkMultiThreader.h" 78 template<
class TFixedImage,
class TMovingImage >
80 public ImageToImageMetric< TFixedImage, TMovingImage >
86 typedef ImageToImageMetric< TFixedImage, TMovingImage >
Superclass;
95 TMovingImage::ImageDimension );
97 TFixedImage::ImageDimension );
179 this->Superclass::SetTransform( arg );
196 itkSetObjectMacro( ImageSampler, ImageSamplerType );
205 itkGetConstMacro( UseImageSampler,
bool );
210 itkSetMacro( RequiredRatioOfValidSamples,
double );
211 itkGetConstMacro( RequiredRatioOfValidSamples,
double );
215 itkSetObjectMacro( MovingImageLimiter, MovingImageLimiterType );
216 itkGetConstObjectMacro( MovingImageLimiter, MovingImageLimiterType );
217 itkSetObjectMacro( FixedImageLimiter, FixedImageLimiterType );
218 itkGetConstObjectMacro( FixedImageLimiter, FixedImageLimiterType );
226 itkSetMacro( MovingLimitRangeRatio,
double );
227 itkGetConstMacro( MovingLimitRangeRatio,
double );
228 itkSetMacro( FixedLimitRangeRatio,
double );
229 itkGetConstMacro( FixedLimitRangeRatio,
double );
233 itkGetConstMacro( UseFixedImageLimiter,
bool );
234 itkGetConstMacro( UseMovingImageLimiter,
bool );
243 itkSetMacro( UseMovingImageDerivativeScales,
bool );
244 itkGetConstMacro( UseMovingImageDerivativeScales,
bool );
246 itkSetMacro( ScaleGradientWithRespectToMovingImageOrientation,
bool );
247 itkGetConstMacro( ScaleGradientWithRespectToMovingImageOrientation,
bool );
249 itkSetMacro( MovingImageDerivativeScales, MovingImageDerivativeScalesType );
250 itkGetConstReferenceMacro( MovingImageDerivativeScales, MovingImageDerivativeScalesType );
260 virtual void Initialize(
void )
throw ( ExceptionObject ) ITK_OVERRIDE;
265 virtual void GetSelfHessian(
const TransformParametersType & parameters, HessianType & H )
const;
271 itkSetMacro( UseMetricSingleThreaded,
bool );
272 itkGetConstReferenceMacro( UseMetricSingleThreaded,
bool );
273 itkBooleanMacro( UseMetricSingleThreaded );
277 itkSetMacro( UseMultiThread,
bool );
278 itkGetConstReferenceMacro( UseMultiThread,
bool );
279 itkBooleanMacro( UseMultiThread );
287 const TransformParametersType & parameters )
const;
298 void PrintSelf( std::ostream & os, Indent indent )
const;
311 typedef BSplineInterpolateImageFunction<
314 typedef BSplineInterpolateImageFunction<
324 typedef GradientImageFilter<
388 MeasureType & value, DerivativeType & derivative )
const {}
433 PaddedGetValuePerThreadStruct );
435 AlignedGetValuePerThreadStruct );
447 PaddedGetValueAndDerivativePerThreadStruct );
448 itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct,
449 AlignedGetValueAndDerivativePerThreadStruct );
465 itkSetMacro( UseImageSampler,
bool );
470 unsigned long wanted,
unsigned long found )
const;
487 const MovingImagePointType & mappedPoint,
488 RealType & movingImageValue,
489 MovingImageDerivativeType * gradient )
const;
496 const TransformJacobianType & jacobian,
497 const MovingImageDerivativeType & movingImageDerivative,
498 DerivativeType & imageJacobian )
const;
516 const FixedImagePointType & fixedImagePoint,
517 MovingImagePointType & mappedPoint )
const;
526 const FixedImagePointType & fixedImagePoint,
527 TransformJacobianType & jacobian,
528 NonZeroJacobianIndicesType & nzji )
const;
539 const FixedImageType * image,
540 const FixedImageRegionType & region );
546 const MovingImageType * image,
547 const MovingImageRegionType & region );
555 itkSetMacro( UseFixedImageLimiter,
bool );
556 itkSetMacro( UseMovingImageLimiter,
bool );
579 #ifndef ITK_MANUAL_INSTANTIATION 580 #include "itkAdvancedImageToImageMetric.hxx" 583 #endif // end #ifndef __itkAdvancedImageToImageMetric_h
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
Superclass::MeasureType MeasureType
bool m_InterpolatorIsReducedBSpline
AdvancedTransformType::NumberOfParametersType NumberOfParametersType
bool m_InterpolatorIsBSpline
MovingImageDerivativeScalesType m_MovingImageDerivativeScales
AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension > AdvancedTransformType
AlignedGetValuePerThreadStruct * m_GetValuePerThreadVariables
DerivativeType::ValueType HessianValueType
DerivativeType st_Derivative
virtual void CheckForAdvancedTransform(void)
bool m_TransformIsBSpline
Superclass::InputPointType InputPointType
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageType MovingImageType
void operator=(const Self &)
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::OutputPointType OutputPointType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
BSplineOrder3TransformType::Pointer BSplineOrder3TransformPointer
virtual void CheckForBSplineInterpolator(void)
virtual void ComputeFixedImageExtrema(const FixedImageType *image, const FixedImageRegionType ®ion)
virtual void InitializeLimiters(void)
ImageSamplerPointer m_ImageSampler
virtual void ThreadedGetValueAndDerivative(ThreadIdType threadID)
void LaunchGetValueThreaderCallback(void) const
ReducedDimensionBSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > ReducedBSplineInterpolatorType
virtual void Initialize(void) ITK_OVERRIDE
static ITK_THREAD_RETURN_TYPE GetValueThreaderCallback(void *arg)
AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
AdvancedImageToImageMetric()
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, float > BSplineInterpolatorFloatType
virtual bool IsInsideMovingMask(const MovingImagePointType &point) const
Superclass::GradientPixelType GradientPixelType
static ITK_THREAD_RETURN_TYPE AccumulateDerivativesThreaderCallback(void *arg)
virtual void CheckNumberOfSamples(unsigned long wanted, unsigned long found) const
virtual ~AdvancedImageToImageMetric()
double m_MovingLimitRangeRatio
FixedImageLimiterOutputType m_FixedImageMinLimit
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
FixedImageType::Pointer FixedImagePointer
Superclass::TransformType TransformType
FixedImagePixelType m_FixedImageTrueMax
bool m_ScaleGradientWithRespectToMovingImageOrientation
AdvancedLinearInterpolateImageFunction< MovingImageType, CoordinateRepresentationType > LinearInterpolatorType
Superclass::FixedImageRegionType FixedImageRegionType
ReducedBSplineInterpolatorType::Pointer ReducedBSplineInterpolatorPointer
virtual void BeforeThreadedGetValueAndDerivative(const TransformParametersType ¶meters) const
AdvancedTransformType::Pointer m_AdvancedTransform
virtual ImageSamplerType * GetImageSampler(void) const
bool m_InterpolatorIsBSplineFloat
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
MovingImageType::IndexType MovingImageIndexType
double m_RequiredRatioOfValidSamples
void PrintSelf(std::ostream &os, Indent indent) const
itk::MultiThreader ThreaderType
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
TransformType::InputPointType FixedImagePointType
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
LinearInterpolatorPointer m_LinearInterpolator
SmartPointer< Self > Pointer
FixedImagePixelType m_FixedImageTrueMin
virtual void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const
Superclass::ParametersType ParametersType
AlignedGetValueAndDerivativePerThreadStruct * m_GetValueAndDerivativePerThreadVariables
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
This class is a base class for any image sampler.
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
ImageSamplerBase< FixedImageType > ImageSamplerType
FixedImageLimiterOutputType m_FixedImageMaxLimit
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
bool m_TransformIsAdvanced
const AdvancedTransformType * GetTransform(void) const ITK_OVERRIDE
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
BSplineInterpolatorType::Pointer BSplineInterpolatorPointer
bool m_UseMovingImageLimiter
MovingImageLimiterOutputType m_MovingImageMaxLimit
LinearInterpolatorType::Pointer LinearInterpolatorPointer
Superclass::InterpolatorPointer InterpolatorPointer
BSplineInterpolatorFloatPointer m_BSplineInterpolatorFloat
FixedImageType::IndexType FixedImageIndexType
MovingImagePixelType m_MovingImageTrueMin
MovingImagePixelType m_MovingImageTrueMax
SizeValueType st_NumberOfPixelsCounted
ThreadIdType m_GetValuePerThreadVariablesSize
AdvancedImageToImageMetric Self
TransformType::ScalarType ScalarType
AdvancedImageToImageMetric * st_Metric
bool m_UseFixedImageLimiter
FixedImageIndexType::IndexValueType FixedImageIndexValueType
BSplineInterpolatorPointer m_BSplineInterpolator
double m_FixedLimitRangeRatio
TransformType::OutputPointType MovingImagePointType
Superclass::FixedImageType FixedImageType
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 3 > BSplineOrder3TransformType
Superclass::MovingImageMaskType MovingImageMaskType
ReducedBSplineInterpolatorPointer m_ReducedBSplineInterpolator
virtual bool EvaluateMovingImageValueAndDerivative(const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient) const
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
Superclass::GradientImageType GradientImageType
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
Superclass::TransformPointer TransformPointer
SmartPointer< Self > Pointer
virtual void GetSelfHessian(const TransformParametersType ¶meters, HessianType &H) const
virtual void ThreadedGetValue(ThreadIdType threadID)
virtual bool TransformPoint(const FixedImagePointType &fixedImagePoint, MovingImagePointType &mappedPoint) const
bool m_UseMetricSingleThreaded
virtual void SetNumberOfThreads(ThreadIdType numberOfThreads)
Superclass::GradientImageFilterType GradientImageFilterType
ImageSamplerType::Pointer ImageSamplerPointer
MovingImageType::RegionType MovingImageRegionType
MovingImageLimiterOutputType m_MovingImageMinLimit
SizeValueType st_NumberOfPixelsCounted
Superclass::InterpolatorType InterpolatorType
Base class for all ITK limiter function objects.
Superclass::TransformJacobianType TransformJacobianType
virtual void AfterThreadedGetValue(MeasureType &value) const
BSplineOrder1TransformType::Pointer BSplineOrder1TransformPointer
MovingImageType::Pointer MovingImagePointer
MovingImageLimiterType::Pointer MovingImageLimiterPointer
virtual bool EvaluateTransformJacobian(const FixedImagePointType &fixedImagePoint, TransformJacobianType &jacobian, NonZeroJacobianIndicesType &nzji) const
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 1 > BSplineOrder1TransformType
DerivativeValueType * st_DerivativePointer
virtual void ComputeMovingImageExtrema(const MovingImageType *image, const MovingImageRegionType ®ion)
FixedImageLimiterType::Pointer FixedImageLimiterPointer
CentralDifferenceGradientFilterType::Pointer CentralDifferenceGradientFilterPointer
bool m_InterpolatorIsLinear
FixedImageLimiterPointer m_FixedImageLimiter
MovingImageLimiterPointer m_MovingImageLimiter
ThreadIdType m_GetValueAndDerivativePerThreadVariablesSize
static ITK_THREAD_RETURN_TYPE GetValueAndDerivativeThreaderCallback(void *arg)
Superclass::MovingImagePixelType MovingImagePixelType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 2 > BSplineOrder2TransformType
Superclass::RealType RealType
DerivativeType::ValueType DerivativeValueType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
virtual void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const
BSplineInterpolatorFloatType::Pointer BSplineInterpolatorFloatPointer
ThreaderType::ThreadInfoStruct ThreadInfoType
DerivativeValueType st_NormalizationFactor
virtual void InitializeThreadingParameters(void) const
FixedImageType::PixelType FixedImagePixelType
BSplineOrder2TransformType::Pointer BSplineOrder2TransformPointer
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
Superclass::FixedImageMaskType FixedImageMaskType
void LaunchGetValueAndDerivativeThreaderCallback(void) const
bool m_UseMovingImageDerivativeScales
MultiThreaderParameterType m_ThreaderMetricParameters
CentralDifferenceGradientFilterPointer m_CentralDifferenceGradientFilter
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::OutputType OutputType
Superclass::FixedImageConstPointer FixedImageConstPointer
virtual void CheckForBSplineTransform(void) const
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, GetValuePerThreadStruct, PaddedGetValuePerThreadStruct)
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedGetValuePerThreadStruct, AlignedGetValuePerThreadStruct)
Superclass::MovingImageConstPointer MovingImageConstPointer
virtual void InitializeImageSampler(void)
Superclass::DerivativeType DerivativeType
Linearly interpolate an image at specified positions.
virtual void SetTransform(AdvancedTransformType *arg)
Superclass::GradientImageFilterPointer GradientImageFilterPointer
vnl_sparse_matrix< HessianValueType > HessianType
Superclass::GradientImagePointer GradientImagePointer