#include <elxMetricBase.h>
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:
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.
UseMultiThreadingForMetrics: Flag that can set to "true" or "false". If "true" the metric may use multi-threading (at least if multi-threading is implemented for the selected metric). If "false", it will run single-threaded. This flag will not affect the output of the metric.
example: (UseMultiThreadingForMetrics "false")
Default is "true".
Definition at line 77 of file elxMetricBase.h.

Public Types | |
| using | AdvancedMetricType = itk::AdvancedImageToImageMetric<FixedImageType, MovingImageType> |
| using | CoordinateRepresentationType = typename ITKBaseType::ParametersValueType |
| using | ElastixType |
| using | FixedImageType = typename ElastixType::FixedImageType |
| using | FixedPointSetType |
| using | FixedPointType = typename FixedImageType::PointType |
| using | FixedPointValueType = typename FixedPointType::ValueType |
| using | ImageSamplerBaseType = typename AdvancedMetricType::ImageSamplerType |
| using | ITKBaseType = itk::SingleValuedCostFunction |
| using | MeasureType = typename ITKBaseType::MeasureType |
| using | MovingImageDerivativeScalesType = typename AdvancedMetricType::MovingImageDerivativeScalesType |
| using | MovingImageType = typename ElastixType::MovingImageType |
| using | MovingPointSetType |
| using | MovingPointType = typename MovingImageType::PointType |
| using | MovingPointValueType = typename MovingPointType::ValueType |
| using | RegistrationType |
| using | Self = MetricBase |
| using | Superclass = BaseComponentSE<TElastix> |
| Public Types inherited from elastix::BaseComponentSE< TElastix > | |
| using | ElastixType = TElastix |
| using | RegistrationType = typename ElastixType::RegistrationBaseType |
| using | Self = BaseComponentSE |
| using | Superclass = BaseComponent |
Protected Types | |
| using | ExactMetricImageSamplerPointer = typename ExactMetricImageSamplerType::Pointer |
| using | ExactMetricImageSamplerType = itk::ImageGridSampler<FixedImageType> |
| using | ExactMetricSampleGridSpacingType = typename ExactMetricImageSamplerType::SampleGridSpacingType |
| using | ParametersType = typename ITKBaseType::ParametersType |
Protected Member Functions | |
| virtual MeasureType | GetExactValue (const ParametersType ¶meters) |
| MetricBase ()=default | |
| ~MetricBase () override=default | |
| 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 { 0.0 } |
| unsigned int | m_ExactMetricEachXNumberOfIterations { 1 } |
| ExactMetricSampleGridSpacingType | m_ExactMetricSampleGridSpacing |
| ExactMetricImageSamplerPointer | m_ExactMetricSampler { nullptr } |
| bool | m_ShowExactMetricValue { false } |
| Protected Attributes inherited from elastix::BaseComponentSE< TElastix > | |
| Configuration::ConstPointer | m_Configuration {} |
| itk::WeakPointer< TElastix > | m_Elastix {} |
| RegistrationType * | m_Registration {} |
Private Member Functions | |
| elxDeclarePureVirtualGetSelfMacro (ITKBaseType) | |
Additional Inherited Members | |
| Static Public Member Functions inherited from elastix::BaseComponent | |
| template<typename TBaseComponent> | |
| static auto | AsITKBaseType (TBaseComponent *const baseComponent) -> decltype(baseComponent->GetAsITKBaseType()) |
| static void | InitializeElastixExecutable () |
| static bool | IsElastixLibrary () |
| using elastix::MetricBase< TElastix >::AdvancedMetricType = itk::AdvancedImageToImageMetric<FixedImageType, MovingImageType> |
Definition at line 103 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::CoordinateRepresentationType = typename ITKBaseType::ParametersValueType |
Typedefs for point sets.
Definition at line 112 of file elxMetricBase.h.
| using elastix::BaseComponentSE< TElastix >::ElastixType |
Elastix typedef.
Definition at line 58 of file elxBaseComponentSE.h.
|
protected |
Definition at line 214 of file elxMetricBase.h.
|
protected |
The full sampler used by the GetExactValue method.
Definition at line 213 of file elxMetricBase.h.
|
protected |
Definition at line 215 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::FixedImageType = typename ElastixType::FixedImageType |
Other typedef's.
Definition at line 94 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::FixedPointSetType |
Definition at line 113 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::FixedPointType = typename FixedImageType::PointType |
Definition at line 95 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::FixedPointValueType = typename FixedPointType::ValueType |
Definition at line 96 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::ImageSamplerBaseType = typename AdvancedMetricType::ImageSamplerType |
Typedefs for sampler support.
Definition at line 131 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::ITKBaseType = itk::SingleValuedCostFunction |
Definition at line 102 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::MeasureType = typename ITKBaseType::MeasureType |
Return type of GetValue
Definition at line 134 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::MovingImageDerivativeScalesType = typename AdvancedMetricType::MovingImageDerivativeScalesType |
Definition at line 104 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::MovingImageType = typename ElastixType::MovingImageType |
Definition at line 97 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::MovingPointSetType |
Definition at line 121 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::MovingPointType = typename MovingImageType::PointType |
Definition at line 98 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::MovingPointValueType = typename MovingPointType::ValueType |
Definition at line 99 of file elxMetricBase.h.
|
protected |
The parameters type.
Definition at line 210 of file elxMetricBase.h.
| using elastix::BaseComponentSE< TElastix >::RegistrationType |
RegistrationType; NB: this is the elx::RegistrationBase not an itk::Object or something like that.
Definition at line 63 of file elxBaseComponentSE.h.
| using elastix::MetricBase< TElastix >::Self = MetricBase |
Standard ITK stuff.
Definition at line 83 of file elxMetricBase.h.
| using elastix::MetricBase< TElastix >::Superclass = BaseComponentSE<TElastix> |
Definition at line 84 of file elxMetricBase.h.
|
protecteddefault |
The constructor.
|
overrideprotecteddefault |
The destructor.
|
overridevirtual |
Execute stuff after each iteration:
Reimplemented from elastix::BaseComponent.
|
overridevirtual |
Execute stuff before each resolution:
Reimplemented from elastix::BaseComponent.
|
overridevirtual |
Reimplemented from elastix::BaseComponent.
|
private |
|
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.
|
virtual |
Returns whether the metric uses a sampler. When the metric is not of AdvancedMetricType, the function returns false immediately.
|
inline |
Retrieves this object as ITKBaseType.
Definition at line 138 of file elxMetricBase.h.
|
inline |
Retrieves this object as ITKBaseType, to use in const functions.
Definition at line 146 of file elxMetricBase.h.
|
inlinevirtual |
Get the last computed exact metric value
Definition at line 203 of file elxMetricBase.h.
|
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.
|
inlinevirtual |
Get if the exact metric value is computed
Definition at line 196 of file elxMetricBase.h.
| elastix::MetricBase< TElastix >::ITK_DISALLOW_COPY_AND_MOVE | ( | MetricBase< TElastix > | ) |
| elastix::MetricBase< TElastix >::itkOverrideGetNameOfClassMacro | ( | MetricBase< TElastix > | ) |
Run-time type information (and related methods).
| elastix::MetricBase< TElastix >::itkStaticConstMacro | ( | FixedImageDimension | , |
| unsigned int | , | ||
| FixedImageType::ImageDimension | ) |
Get the dimension of the fixed image.
| elastix::MetricBase< TElastix >::itkStaticConstMacro | ( | MovingImageDimension | , |
| unsigned int | , | ||
| MovingImageType::ImageDimension | ) |
Get the dimension of the moving image.
|
virtual |
Force the metric to base its computation on a new subset of image samples. Not every metric may have implemented this.
Reimplemented in elastix::CorrespondingPointsEuclideanDistanceMetric< TElastix >, elastix::MissingStructurePenalty< TElastix >, elastix::PolydataDummyPenalty< TElastix >, elastix::StatisticalShapePenalty< TElastix >, and elastix::TransformRigidityPenalty< TElastix >.
|
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.
|
protected |
Definition at line 238 of file elxMetricBase.h.
|
protected |
Definition at line 241 of file elxMetricBase.h.
|
protected |
Definition at line 239 of file elxMetricBase.h.
|
protected |
Definition at line 237 of file elxMetricBase.h.
|
protected |
Definition at line 236 of file elxMetricBase.h.
Generated on 26-02-2026
for elastix by 1.16.1 (669aeeefca743c148e2d935b3d3c69535c7491e6) |