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 );
176 this->Superclass::SetTransform( arg );
193 itkSetObjectMacro( ImageSampler, ImageSamplerType );
202 itkGetConstMacro( UseImageSampler,
bool );
207 itkSetMacro( RequiredRatioOfValidSamples,
double );
208 itkGetConstMacro( RequiredRatioOfValidSamples,
double );
212 itkSetObjectMacro( MovingImageLimiter, MovingImageLimiterType );
213 itkGetConstObjectMacro( MovingImageLimiter, MovingImageLimiterType );
214 itkSetObjectMacro( FixedImageLimiter, FixedImageLimiterType );
215 itkGetConstObjectMacro( FixedImageLimiter, FixedImageLimiterType );
223 itkSetMacro( MovingLimitRangeRatio,
double );
224 itkGetConstMacro( MovingLimitRangeRatio,
double );
225 itkSetMacro( FixedLimitRangeRatio,
double );
226 itkGetConstMacro( FixedLimitRangeRatio,
double );
230 itkGetConstMacro( UseFixedImageLimiter,
bool );
231 itkGetConstMacro( UseMovingImageLimiter,
bool );
240 itkSetMacro( UseMovingImageDerivativeScales,
bool );
241 itkGetConstMacro( UseMovingImageDerivativeScales,
bool );
243 itkSetMacro( ScaleGradientWithRespectToMovingImageOrientation,
bool );
244 itkGetConstMacro( ScaleGradientWithRespectToMovingImageOrientation,
bool );
246 itkSetMacro( MovingImageDerivativeScales, MovingImageDerivativeScalesType );
247 itkGetConstReferenceMacro( MovingImageDerivativeScales, MovingImageDerivativeScalesType );
257 virtual void Initialize(
void )
throw ( ExceptionObject );
262 virtual void GetSelfHessian(
const TransformParametersType & parameters, HessianType & H )
const;
268 itkSetMacro( UseMetricSingleThreaded,
bool );
269 itkGetConstReferenceMacro( UseMetricSingleThreaded,
bool );
270 itkBooleanMacro( UseMetricSingleThreaded );
274 itkSetMacro( UseMultiThread,
bool );
275 itkGetConstReferenceMacro( UseMultiThread,
bool );
276 itkBooleanMacro( UseMultiThread );
284 const TransformParametersType & parameters )
const;
295 void PrintSelf( std::ostream & os, Indent indent )
const;
308 typedef BSplineInterpolateImageFunction<
311 typedef BSplineInterpolateImageFunction<
321 typedef GradientImageFilter<
372 MeasureType & value, DerivativeType & derivative )
const {}
418 PaddedGetValueAndDerivativePerThreadStruct );
419 itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct,
420 AlignedGetValueAndDerivativePerThreadStruct );
436 itkSetMacro( UseImageSampler,
bool );
441 unsigned long wanted,
unsigned long found ) const;
458 const MovingImagePointType & mappedPoint,
459 RealType & movingImageValue,
460 MovingImageDerivativeType * gradient ) const;
467 const TransformJacobianType & jacobian,
468 const MovingImageDerivativeType & movingImageDerivative,
469 DerivativeType & imageJacobian ) const;
487 const FixedImagePointType & fixedImagePoint,
488 MovingImagePointType & mappedPoint ) const;
497 const FixedImagePointType & fixedImagePoint,
498 TransformJacobianType & jacobian,
499 NonZeroJacobianIndicesType & nzji ) const;
510 const FixedImageType * image,
511 const FixedImageRegionType & region );
517 const MovingImageType * image,
518 const MovingImageRegionType & region );
526 itkSetMacro( UseFixedImageLimiter,
bool );
527 itkSetMacro( UseMovingImageLimiter,
bool );
532 void operator=( const Self & );
550 #ifndef ITK_MANUAL_INSTANTIATION 551 #include "itkAdvancedImageToImageMetric.hxx" 554 #endif // end #ifndef __itkAdvancedImageToImageMetric_h void PrintSelf(std::ostream &os, Indent indent) const
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
virtual bool TransformPoint(const FixedImagePointType &fixedImagePoint, MovingImagePointType &mappedPoint) const
Superclass::MeasureType MeasureType
bool m_InterpolatorIsReducedBSpline
AdvancedTransformType::NumberOfParametersType NumberOfParametersType
bool m_InterpolatorIsBSpline
const AdvancedTransformType * GetTransform(void) const
MovingImageDerivativeScalesType m_MovingImageDerivativeScales
AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension > AdvancedTransformType
DerivativeType::ValueType HessianValueType
DerivativeType st_Derivative
virtual void CheckForAdvancedTransform(void)
bool m_TransformIsBSpline
virtual bool IsInsideMovingMask(const MovingImagePointType &point) const
Superclass::InputPointType InputPointType
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageType MovingImageType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::OutputPointType OutputPointType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
virtual void CheckForBSplineInterpolator(void)
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedGetValueAndDerivativePerThreadStruct, AlignedGetValueAndDerivativePerThreadStruct)
virtual void ComputeFixedImageExtrema(const FixedImageType *image, const FixedImageRegionType ®ion)
virtual void InitializeLimiters(void)
ImageSamplerPointer m_ImageSampler
virtual void ThreadedGetValueAndDerivative(ThreadIdType threadID)
ReducedDimensionBSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > ReducedBSplineInterpolatorType
AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
AdvancedImageToImageMetric()
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, float > BSplineInterpolatorFloatType
Superclass::GradientPixelType GradientPixelType
static ITK_THREAD_RETURN_TYPE AccumulateDerivativesThreaderCallback(void *arg)
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
AdvancedTransformType::Pointer m_AdvancedTransform
virtual void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const
bool m_InterpolatorIsBSplineFloat
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
MovingImageType::IndexType MovingImageIndexType
double m_RequiredRatioOfValidSamples
itk::MultiThreader ThreaderType
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
virtual void BeforeThreadedGetValueAndDerivative(const TransformParametersType ¶meters) const
TransformType::InputPointType FixedImagePointType
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
LinearInterpolatorPointer m_LinearInterpolator
SmartPointer< Self > Pointer
FixedImagePixelType m_FixedImageTrueMin
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
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
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
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
bool m_UseMetricSingleThreaded
virtual void SetNumberOfThreads(ThreadIdType numberOfThreads)
virtual void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const
Superclass::GradientImageFilterType GradientImageFilterType
ImageSamplerType::Pointer ImageSamplerPointer
MovingImageType::RegionType MovingImageRegionType
MovingImageLimiterOutputType m_MovingImageMinLimit
Superclass::InterpolatorType InterpolatorType
Base class for all ITK limiter function objects.
Superclass::TransformJacobianType TransformJacobianType
virtual void CheckForBSplineTransform(void)
virtual void CheckNumberOfSamples(unsigned long wanted, unsigned long found) const
MovingImageType::Pointer MovingImagePointer
MovingImageLimiterType::Pointer MovingImageLimiterPointer
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
virtual bool EvaluateMovingImageValueAndDerivative(const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient) const
DerivativeType::ValueType DerivativeValueType
virtual void GetSelfHessian(const TransformParametersType ¶meters, HessianType &H) const
Superclass::MovingImageMaskPointer MovingImageMaskPointer
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
BSplineInterpolatorFloatType::Pointer BSplineInterpolatorFloatPointer
ThreaderType::ThreadInfoStruct ThreadInfoType
DerivativeValueType st_NormalizationFactor
virtual void Initialize(void)
void LaunchGetValueAndDerivativeThreaderCallback(void) const
FixedImageType::PixelType FixedImagePixelType
virtual void InitializeThreadingParameters(void) const
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
Superclass::FixedImageMaskType FixedImageMaskType
bool m_UseMovingImageDerivativeScales
virtual ImageSamplerType * GetImageSampler(void) const
MultiThreaderParameterType m_ThreaderMetricParameters
CentralDifferenceGradientFilterPointer m_CentralDifferenceGradientFilter
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::OutputType OutputType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
virtual void InitializeImageSampler(void)
Superclass::DerivativeType DerivativeType
Linearly interpolate an image at specified positions.
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct, PaddedGetValueAndDerivativePerThreadStruct)
virtual void SetTransform(AdvancedTransformType *arg)
virtual bool EvaluateTransformJacobian(const FixedImagePointType &fixedImagePoint, TransformJacobianType &jacobian, NonZeroJacobianIndicesType &nzji) const
Superclass::GradientImageFilterPointer GradientImageFilterPointer
vnl_sparse_matrix< HessianValueType > HessianType
Superclass::GradientImagePointer GradientImagePointer