go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
elastix::MetricBase< TElastix > Class Template Reference

#include <elxMetricBase.h>

Detailed Description

template<class TElastix>
class elastix::MetricBase< TElastix >

This class is the elastix base class for all Metrics.

This class contains the common functionality for all Metrics.

The parameters used in this class are:

Parameters:

ShowExactMetricValue: Flag that can set to "true" or "false". If "true" the metric computes the exact metric value (computed on all voxels rather than on the set of spatial samples) and shows it each iteration. Must be given for each resolution.
example: (ShowExactMetricValue "true" "true" "false")
Default is "false" for all resolutions.

ExactMetricSampleGridSpacing: Set an integer downsampling rate for computing the "exact" metric. Only meaningful if set in combination with the ShowExactMetricValue set to "true". In some cases, it might be an overkill to really compute the exact metric with the ShowExactMetricValue. The metric computed on a downsampled image might already be accurate enough to draw conclusions about the rate of convergence for example. The downsampling rate must be given for each resolution, for each dimension.
example: (ExactMetricSampleGridSpacing 1 1 2 2 )
This example for a 2D registration of 2 resolutions sets the downsampling rate to 1 in the first resolution (so: use really all pixels), and to 2 in the second resolution. Default: 1 in each resolution and each dimension.

CheckNumberOfSamples: Whether the metric checks if at least a certain fraction (default 1/4) of the samples map inside the moving image. Can be given for each resolution or for all resolutions at once.
example: (CheckNumberOfSamples "false" "true" "false")
The default is true. In general it is wise to set this to true, since it detects if the registration is going really bad.

RequiredRatioOfValidSamples: Defines the fraction needed in CheckNumberOfSamples.
example: (RequiredRatioOfValidSamples 0.1)
The default is 0.25.

Definition at line 72 of file elxMetricBase.h.

+ Inheritance diagram for elastix::MetricBase< TElastix >:

Public Types

typedef itk::AdvancedImageToImageMetric< FixedImageType, MovingImageTypeAdvancedMetricType
 
typedef Superclass::ConfigurationPointer ConfigurationPointer
 
typedef Superclass::ConfigurationType ConfigurationType
 
typedef ITKBaseType::ParametersValueType CoordinateRepresentationType
 
typedef Superclass::ElastixPointer ElastixPointer
 
typedef Superclass::ElastixType ElastixType
 
typedef ElastixType::FixedImageType FixedImageType
 
typedef itk::PointSet< CoordinateRepresentationType, FixedImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, FixedImageDimension, FixedImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > FixedPointSetType
 
typedef FixedImageType::PointType FixedPointType
 
typedef FixedPointType::ValueType FixedPointValueType
 
typedef AdvancedMetricType::ImageSamplerType ImageSamplerBaseType
 
typedef itk::SingleValuedCostFunction ITKBaseType
 
typedef ITKBaseType::MeasureType MeasureType
 
typedef AdvancedMetricType::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
 
typedef ElastixType::MovingImageType MovingImageType
 
typedef itk::PointSet< CoordinateRepresentationType, MovingImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, MovingImageDimension, MovingImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
 
typedef MovingImageType::PointType MovingPointType
 
typedef MovingPointType::ValueType MovingPointValueType
 
typedef Superclass::RegistrationPointer RegistrationPointer
 
typedef Superclass::RegistrationType RegistrationType
 
typedef MetricBase Self
 
typedef BaseComponentSE< TElastix > Superclass
 
- Public Types inherited from elastix::BaseComponentSE< TElastix >
typedef Configuration::Pointer ConfigurationPointer
 
typedef Configuration ConfigurationType
 
typedef itk::WeakPointer< ElastixTypeElastixPointer
 
typedef TElastix ElastixType
 
typedef RegistrationTypeRegistrationPointer
 
typedef ElastixType::RegistrationBaseType RegistrationType
 
typedef BaseComponentSE Self
 
typedef BaseComponent Superclass
 

Public Member Functions

void AfterEachIterationBase (void) override
 
void BeforeEachResolutionBase (void) override
 
virtual ImageSamplerBaseTypeGetAdvancedMetricImageSampler (void) const
 
virtual bool GetAdvancedMetricUseImageSampler (void) const
 
virtual ITKBaseTypeGetAsITKBaseType (void)
 
virtual const ITKBaseTypeGetAsITKBaseType (void) const
 
virtual const char * GetClassName () const
 
virtual MeasureType GetCurrentExactMetricValue (void) const
 
virtual bool GetShowExactMetricValue (void) const
 
 itkStaticConstMacro (FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
 
 itkStaticConstMacro (MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
 
virtual void SelectNewSamples (void)
 
virtual void SetAdvancedMetricImageSampler (ImageSamplerBaseType *sampler)
 
- Public Member Functions inherited from elastix::BaseComponentSE< TElastix >
ConfigurationTypeGetConfiguration (void) const
 
ElastixTypeGetElastix (void) const
 
RegistrationPointer GetRegistration (void) const
 
 ITK_DISALLOW_COPY_AND_ASSIGN (BaseComponentSE)
 
void SetConfiguration (ConfigurationType *_arg)
 
void SetElastix (ElastixType *_arg)
 
- Public Member Functions inherited from elastix::BaseComponent
virtual void AfterEachIteration (void)
 
virtual void AfterEachIterationBase (void)
 
virtual void AfterEachResolution (void)
 
virtual void AfterEachResolutionBase (void)
 
virtual void AfterRegistration (void)
 
virtual void AfterRegistrationBase (void)
 
virtual int BeforeAll (void)
 
virtual int BeforeAllBase (void)
 
virtual void BeforeEachResolution (void)
 
virtual void BeforeEachResolutionBase (void)
 
virtual void BeforeRegistration (void)
 
virtual void BeforeRegistrationBase (void)
 
virtual const char * elxGetClassName (void) const
 
const char * GetComponentLabel (void) const
 
 ITK_DISALLOW_COPY_AND_ASSIGN (BaseComponent)
 
 itkTypeMacroNoParent (BaseComponent)
 
void SetComponentLabel (const char *label, unsigned int idx)
 

Protected Types

typedef ExactMetricImageSamplerType::Pointer ExactMetricImageSamplerPointer
 
typedef itk::ImageGridSampler< FixedImageTypeExactMetricImageSamplerType
 
typedef ExactMetricImageSamplerType::SampleGridSpacingType ExactMetricSampleGridSpacingType
 
typedef ITKBaseType::ParametersType ParametersType
 

Protected Member Functions

virtual MeasureType GetExactValue (const ParametersType &parameters)
 
 MetricBase ()
 
 ~MetricBase () override
 
- Protected Member Functions inherited from elastix::BaseComponentSE< TElastix >
 BaseComponentSE ()=default
 
 ~BaseComponentSE () override=default
 
- Protected Member Functions inherited from elastix::BaseComponent
 BaseComponent ()=default
 
virtual ~BaseComponent ()=default
 

Protected Attributes

MeasureType m_CurrentExactMetricValue
 
unsigned int m_ExactMetricEachXNumberOfIterations
 
ExactMetricSampleGridSpacingType m_ExactMetricSampleGridSpacing
 
ExactMetricImageSamplerPointer m_ExactMetricSampler
 
bool m_ShowExactMetricValue
 
- Protected Attributes inherited from elastix::BaseComponentSE< TElastix >
ConfigurationPointer m_Configuration {}
 
ElastixPointer m_Elastix {}
 
RegistrationPointer m_Registration {}
 

Private Member Functions

 MetricBase (const Self &)
 
void operator= (const Self &)
 

Additional Inherited Members

- Static Public Member Functions inherited from elastix::BaseComponent
static std::string ConvertSecondsToDHMS (const double totalSeconds, const unsigned int precision)
 
static void InitializeElastixExecutable ()
 
static bool IsElastixLibrary ()
 

Member Typedef Documentation

◆ AdvancedMetricType

template<class TElastix >
typedef itk::AdvancedImageToImageMetric< FixedImageType, MovingImageType > elastix::MetricBase< TElastix >::AdvancedMetricType

Definition at line 102 of file elxMetricBase.h.

◆ ConfigurationPointer

template<class TElastix >
typedef Superclass::ConfigurationPointer elastix::MetricBase< TElastix >::ConfigurationPointer

Definition at line 87 of file elxMetricBase.h.

◆ ConfigurationType

template<class TElastix >
typedef Superclass::ConfigurationType elastix::MetricBase< TElastix >::ConfigurationType

Definition at line 86 of file elxMetricBase.h.

◆ CoordinateRepresentationType

template<class TElastix >
typedef ITKBaseType::ParametersValueType elastix::MetricBase< TElastix >::CoordinateRepresentationType

Typedefs for point sets.

Definition at line 111 of file elxMetricBase.h.

◆ ElastixPointer

template<class TElastix >
typedef Superclass::ElastixPointer elastix::MetricBase< TElastix >::ElastixPointer

Definition at line 85 of file elxMetricBase.h.

◆ ElastixType

template<class TElastix >
typedef Superclass::ElastixType elastix::MetricBase< TElastix >::ElastixType

Typedef's inherited from Elastix.

Definition at line 84 of file elxMetricBase.h.

◆ ExactMetricImageSamplerPointer

template<class TElastix >
typedef ExactMetricImageSamplerType::Pointer elastix::MetricBase< TElastix >::ExactMetricImageSamplerPointer
protected

Definition at line 195 of file elxMetricBase.h.

◆ ExactMetricImageSamplerType

template<class TElastix >
typedef itk::ImageGridSampler< FixedImageType > elastix::MetricBase< TElastix >::ExactMetricImageSamplerType
protected

The full sampler used by the GetExactValue method.

Definition at line 194 of file elxMetricBase.h.

◆ ExactMetricSampleGridSpacingType

template<class TElastix >
typedef ExactMetricImageSamplerType::SampleGridSpacingType elastix::MetricBase< TElastix >::ExactMetricSampleGridSpacingType
protected

Definition at line 196 of file elxMetricBase.h.

◆ FixedImageType

template<class TElastix >
typedef ElastixType::FixedImageType elastix::MetricBase< TElastix >::FixedImageType

Other typedef's.

Definition at line 92 of file elxMetricBase.h.

◆ FixedPointSetType

template<class TElastix >
typedef itk::PointSet< CoordinateRepresentationType, FixedImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, FixedImageDimension, FixedImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > elastix::MetricBase< TElastix >::FixedPointSetType

Definition at line 118 of file elxMetricBase.h.

◆ FixedPointType

template<class TElastix >
typedef FixedImageType::PointType elastix::MetricBase< TElastix >::FixedPointType

Definition at line 93 of file elxMetricBase.h.

◆ FixedPointValueType

template<class TElastix >
typedef FixedPointType::ValueType elastix::MetricBase< TElastix >::FixedPointValueType

Definition at line 94 of file elxMetricBase.h.

◆ ImageSamplerBaseType

template<class TElastix >
typedef AdvancedMetricType::ImageSamplerType elastix::MetricBase< TElastix >::ImageSamplerBaseType

Typedefs for sampler support.

Definition at line 128 of file elxMetricBase.h.

◆ ITKBaseType

template<class TElastix >
typedef itk::SingleValuedCostFunction elastix::MetricBase< TElastix >::ITKBaseType

ITKBaseType.

Definition at line 100 of file elxMetricBase.h.

◆ MeasureType

template<class TElastix >
typedef ITKBaseType::MeasureType elastix::MetricBase< TElastix >::MeasureType

Return type of GetValue

Definition at line 131 of file elxMetricBase.h.

◆ MovingImageDerivativeScalesType

template<class TElastix >
typedef AdvancedMetricType::MovingImageDerivativeScalesType elastix::MetricBase< TElastix >::MovingImageDerivativeScalesType

Definition at line 103 of file elxMetricBase.h.

◆ MovingImageType

template<class TElastix >
typedef ElastixType::MovingImageType elastix::MetricBase< TElastix >::MovingImageType

Definition at line 95 of file elxMetricBase.h.

◆ MovingPointSetType

template<class TElastix >
typedef itk::PointSet< CoordinateRepresentationType, MovingImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, MovingImageDimension, MovingImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > elastix::MetricBase< TElastix >::MovingPointSetType

Definition at line 125 of file elxMetricBase.h.

◆ MovingPointType

template<class TElastix >
typedef MovingImageType::PointType elastix::MetricBase< TElastix >::MovingPointType

Definition at line 96 of file elxMetricBase.h.

◆ MovingPointValueType

template<class TElastix >
typedef MovingPointType::ValueType elastix::MetricBase< TElastix >::MovingPointValueType

Definition at line 97 of file elxMetricBase.h.

◆ ParametersType

template<class TElastix >
typedef ITKBaseType::ParametersType elastix::MetricBase< TElastix >::ParametersType
protected

The parameters type.

Definition at line 191 of file elxMetricBase.h.

◆ RegistrationPointer

template<class TElastix >
typedef Superclass::RegistrationPointer elastix::MetricBase< TElastix >::RegistrationPointer

Definition at line 89 of file elxMetricBase.h.

◆ RegistrationType

template<class TElastix >
typedef Superclass::RegistrationType elastix::MetricBase< TElastix >::RegistrationType

Definition at line 88 of file elxMetricBase.h.

◆ Self

template<class TElastix >
typedef MetricBase elastix::MetricBase< TElastix >::Self

Standard ITK stuff.

Definition at line 77 of file elxMetricBase.h.

◆ Superclass

template<class TElastix >
typedef BaseComponentSE< TElastix > elastix::MetricBase< TElastix >::Superclass

Definition at line 78 of file elxMetricBase.h.

Constructor & Destructor Documentation

◆ MetricBase() [1/2]

template<class TElastix >
elastix::MetricBase< TElastix >::MetricBase ( )
protected

The constructor.

◆ ~MetricBase()

template<class TElastix >
elastix::MetricBase< TElastix >::~MetricBase ( )
inlineoverrideprotected

The destructor.

Definition at line 201 of file elxMetricBase.h.

◆ MetricBase() [2/2]

template<class TElastix >
elastix::MetricBase< TElastix >::MetricBase ( const Self )
private

The private constructor.

Member Function Documentation

◆ AfterEachIterationBase()

template<class TElastix >
void elastix::MetricBase< TElastix >::AfterEachIterationBase ( void  )
overridevirtual

Execute stuff after each iteration:

  • Optionally compute the exact metric value and plot it to screen.

Reimplemented from elastix::BaseComponent.

◆ BeforeEachResolutionBase()

template<class TElastix >
void elastix::MetricBase< TElastix >::BeforeEachResolutionBase ( void  )
overridevirtual

Execute stuff before each resolution:

  • Check if the exact metric value should be computed (to monitor the progress of the registration).

Reimplemented from elastix::BaseComponent.

◆ GetAdvancedMetricImageSampler()

template<class TElastix >
virtual ImageSamplerBaseType * elastix::MetricBase< TElastix >::GetAdvancedMetricImageSampler ( void  ) const
virtual

Methods to get the image sampler. The image sampler is only used when the metric is of type AdvancedMetricType, and has UseImageSampler set to true. In other cases, the function returns 0.

◆ GetAdvancedMetricUseImageSampler()

template<class TElastix >
virtual bool elastix::MetricBase< TElastix >::GetAdvancedMetricUseImageSampler ( void  ) const
virtual

Returns whether the metric uses a sampler. When the metric is not of AdvancedMetricType, the function returns false immediately.

◆ GetAsITKBaseType() [1/2]

template<class TElastix >
virtual ITKBaseType * elastix::MetricBase< TElastix >::GetAsITKBaseType ( void  )
inlinevirtual

Cast to ITKBaseType.

Definition at line 134 of file elxMetricBase.h.

◆ GetAsITKBaseType() [2/2]

template<class TElastix >
virtual const ITKBaseType * elastix::MetricBase< TElastix >::GetAsITKBaseType ( void  ) const
inlinevirtual

Cast to ITKBaseType, to use in const functions.

Definition at line 141 of file elxMetricBase.h.

◆ GetClassName()

template<class TElastix >
virtual const char * elastix::MetricBase< TElastix >::GetClassName ( ) const
virtual

◆ GetCurrentExactMetricValue()

template<class TElastix >
virtual MeasureType elastix::MetricBase< TElastix >::GetCurrentExactMetricValue ( void  ) const
inlinevirtual

Get the last computed exact metric value

Definition at line 185 of file elxMetricBase.h.

◆ GetExactValue()

template<class TElastix >
virtual MeasureType elastix::MetricBase< TElastix >::GetExactValue ( const ParametersType parameters)
protectedvirtual

Get the exact value. Mutual information computed over all points. It is meant in situations when you optimize using just a subset of pixels, but are interested in the exact value of the metric.

This method only works when the itkYourMetric inherits from the AdvancedMetricType. In other cases it returns 0. You may re-implement this method in the elxYourMetric, if you like.

◆ GetShowExactMetricValue()

template<class TElastix >
virtual bool elastix::MetricBase< TElastix >::GetShowExactMetricValue ( void  ) const
inlinevirtual

Get if the exact metric value is computed

Definition at line 181 of file elxMetricBase.h.

◆ itkStaticConstMacro() [1/2]

template<class TElastix >
elastix::MetricBase< TElastix >::itkStaticConstMacro ( FixedImageDimension  ,
unsigned int  ,
FixedImageType::ImageDimension   
)

Get the dimension of the fixed image.

◆ itkStaticConstMacro() [2/2]

template<class TElastix >
elastix::MetricBase< TElastix >::itkStaticConstMacro ( MovingImageDimension  ,
unsigned int  ,
MovingImageType::ImageDimension   
)

Get the dimension of the moving image.

◆ operator=()

template<class TElastix >
void elastix::MetricBase< TElastix >::operator= ( const Self )
private

The private copy constructor.

◆ SelectNewSamples()

template<class TElastix >
virtual void elastix::MetricBase< TElastix >::SelectNewSamples ( void  )
virtual

◆ SetAdvancedMetricImageSampler()

template<class TElastix >
virtual void elastix::MetricBase< TElastix >::SetAdvancedMetricImageSampler ( ImageSamplerBaseType sampler)
virtual

Method to set the image sampler. The image sampler is only used when the metric is of type AdvancedMetricType, and has UseImageSampler set to true. In other cases, the function does nothing.

Field Documentation

◆ m_CurrentExactMetricValue

template<class TElastix >
MeasureType elastix::MetricBase< TElastix >::m_CurrentExactMetricValue
protected

Definition at line 218 of file elxMetricBase.h.

◆ m_ExactMetricEachXNumberOfIterations

template<class TElastix >
unsigned int elastix::MetricBase< TElastix >::m_ExactMetricEachXNumberOfIterations
protected

Definition at line 220 of file elxMetricBase.h.

◆ m_ExactMetricSampleGridSpacing

template<class TElastix >
ExactMetricSampleGridSpacingType elastix::MetricBase< TElastix >::m_ExactMetricSampleGridSpacing
protected

Definition at line 219 of file elxMetricBase.h.

◆ m_ExactMetricSampler

template<class TElastix >
ExactMetricImageSamplerPointer elastix::MetricBase< TElastix >::m_ExactMetricSampler
protected

Definition at line 217 of file elxMetricBase.h.

◆ m_ShowExactMetricValue

template<class TElastix >
bool elastix::MetricBase< TElastix >::m_ShowExactMetricValue
protected
Todo:
the method GetExactDerivative could as well be added here.

Definition at line 216 of file elxMetricBase.h.



Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo