18#ifndef itkCombinationImageToImageMetric_h
19#define itkCombinationImageToImageMetric_h
58template <
class TFixedImage,
class TMovingImage>
81 using typename Superclass::CoordinateRepresentationType;
82 using typename Superclass::MovingImageType;
83 using typename Superclass::MovingImagePixelType;
85 using typename Superclass::MovingImageConstPointer;
86 using typename Superclass::FixedImageType;
88 using typename Superclass::FixedImageConstPointer;
89 using typename Superclass::FixedImageRegionType;
92 using typename Superclass::InputPointType;
93 using typename Superclass::OutputPointType;
94 using typename Superclass::TransformParametersType;
95 using typename Superclass::TransformJacobianType;
96 using typename Superclass::InterpolatorType;
97 using typename Superclass::InterpolatorPointer;
98 using typename Superclass::RealType;
99 using typename Superclass::GradientPixelType;
100 using typename Superclass::GradientImageType;
101 using typename Superclass::GradientImagePointer;
106 using typename Superclass::MeasureType;
107 using typename Superclass::DerivativeType;
109 using typename Superclass::ParametersType;
136 TFixedImage::ImageDimension,
137 DefaultStaticMeshTraits<CoordinateRepresentationType,
138 TFixedImage::ImageDimension,
139 TFixedImage::ImageDimension,
140 CoordinateRepresentationType,
141 CoordinateRepresentationType,
142 CoordinateRepresentationType>>;
144 TMovingImage::ImageDimension,
145 DefaultStaticMeshTraits<CoordinateRepresentationType,
146 TMovingImage::ImageDimension,
147 TMovingImage::ImageDimension,
148 CoordinateRepresentationType,
149 CoordinateRepresentationType,
150 CoordinateRepresentationType>>;
165 itkGetConstMacro(NumberOfMetrics,
unsigned int);
195 itkSetMacro(UseRelativeWeights,
bool);
196 itkGetConstMacro(UseRelativeWeights,
bool);
219 const DerivativeType &
261 const auto metric =
dynamic_cast<ImageMetricType *
>(this->GetMetric(0));
266 const TransformType *
269 return this->GetTransform(0);
284 virtual const InterpolatorType *
291 const auto metric =
dynamic_cast<ImageMetricType *
>(this->GetMetric(0));
292 return metric ? metric->GetInterpolator() :
nullptr;
296 const InterpolatorType *
299 return this->GetInterpolator(0);
314 virtual const FixedImageType *
318 const FixedImageType *
321 return this->GetFixedImage(0);
343 return this->GetFixedImageMask(0);
358 virtual const FixedImageRegionType &
362 const FixedImageRegionType &
365 return this->GetFixedImageRegion(0);
380 virtual const MovingImageType *
384 const MovingImageType *
387 return this->GetMovingImage(0);
409 return this->GetMovingImageMask(0);
416 const SizeValueType &
429 GetValue(
const ParametersType & parameters)
const override;
433 GetDerivative(
const ParametersType & parameters, DerivativeType & derivative)
const override;
439 DerivativeType & derivative)
const override;
451 PrintSelf(std::ostream & os, Indent indent)
const override;
454 unsigned int m_NumberOfMetrics{ 0 };
455 std::vector<SingleValuedCostFunctionPointer> m_Metrics{};
456 std::vector<double> m_MetricWeights{};
457 std::vector<double> m_MetricRelativeWeights{};
458 bool m_UseRelativeWeights{
false };
459 std::vector<bool> m_UseMetric{};
460 mutable std::vector<MeasureType> m_MetricValues{};
461 mutable std::vector<DerivativeType> m_MetricDerivatives{};
462 mutable std::vector<double> m_MetricDerivativesMagnitude{};
463 mutable std::vector<double> m_MetricComputationTime{};
466 FixedImageRegionType m_NullFixedImageRegion{};
467 DerivativeType m_NullDerivative{};
471 using Superclass::SetFixedImageMask;
472 using Superclass::SetMovingImageMask;
473 using Superclass::SetTransform;
491#ifndef ITK_MANUAL_INSTANTIATION
492# include "itkCombinationImageToImageMetric.hxx"
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
typename DerivativeType::ValueType DerivativeValueType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
SmartPointer< MovingImageMaskType > MovingImageMaskPointer
MultiThreaderBase::WorkUnitInfo ThreadInfoType
SmartPointer< FixedImageMaskType > FixedImageMaskPointer
AdvancedTransformType * GetTransform() override
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
Combines multiple metrics.
virtual const FixedImageRegionType & GetFixedImageRegion(unsigned int pos) const
double GetFinalMetricWeight(unsigned int pos) const
const FixedImageType * GetFixedImage() const override
PointSet< CoordinateRepresentationType, TFixedImage::ImageDimension, DefaultStaticMeshTraits< CoordinateRepresentationType, TFixedImage::ImageDimension, TFixedImage::ImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > FixedPointSetType
typename SingleValuedCostFunctionType::Pointer SingleValuedCostFunctionPointer
virtual void SetMovingImageMask(const MovingImageMaskType *_arg, unsigned int pos)
const FixedImageMaskType * GetFixedImageMask() const override
const SizeValueType & GetNumberOfPixelsCounted() const override
void SetFixedImage(const FixedImageType *_arg) override
void SetFixedImageMask(const FixedImageMaskType *_arg) override
void GetDerivative(const ParametersType ¶meters, DerivativeType &derivative) const override
double GetMetricRelativeWeight(unsigned int pos) const
void SetInterpolator(InterpolatorType *_arg) override
virtual const FixedImageType * GetFixedImage(unsigned int pos) const
const MovingImageMaskType * GetMovingImageMask() const override
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
void SetTransform(TransformType *_arg) override
MeasureType GetMetricValue(unsigned int pos) const
double GetMetricWeight(unsigned int pos) const
virtual const MovingImageType * GetMovingImage(unsigned int pos) const
~CombinationImageToImageMetric() override=default
ITK_DISALLOW_COPY_AND_MOVE(CombinationImageToImageMetric)
typename TransformType::Pointer TransformPointer
const TransformType * GetTransform() const override
typename FixedImageType::PixelType FixedImagePixelType
void PrintSelf(std::ostream &os, Indent indent) const override
TransformType * GetTransform() override
MeasureType GetValue(const ParametersType ¶meters) const override
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
typename MovingImageType::RegionType MovingImageRegionType
void SetMetric(SingleValuedCostFunctionType *metric, unsigned int pos)
const FixedImageRegionType & GetFixedImageRegion() const override
void SetFixedImageRegion(const FixedImageRegionType _arg) override
ModifiedTimeType GetMTime() const override
virtual const MovingImageMaskType * GetMovingImageMask(unsigned int pos) const
double GetMetricDerivativeMagnitude(unsigned int pos) const
SingleValuedCostFunction SingleValuedCostFunctionType
void SetUseMetric(const bool use, const unsigned int pos)
virtual void SetTransform(TransformType *_arg, unsigned int pos)
const DerivativeType & GetMetricDerivative(unsigned int pos) const
virtual const InterpolatorType * GetInterpolator(unsigned int pos) const
void SetMetricWeight(double weight, unsigned int pos)
virtual void SetFixedImageMask(const FixedImageMaskType *_arg, unsigned int pos)
PointSet< CoordinateRepresentationType, TMovingImage::ImageDimension, DefaultStaticMeshTraits< CoordinateRepresentationType, TMovingImage::ImageDimension, TMovingImage::ImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
virtual void SetFixedImage(const FixedImageType *_arg, unsigned int pos)
void GetValueAndDerivative(const ParametersType ¶meters, MeasureType &value, DerivativeType &derivative) const override
SingleValuedCostFunctionType * GetMetric(unsigned int count) const
void SetMovingImageMask(const MovingImageMaskType *_arg) override
bool GetUseMetric(const unsigned int pos) const
typename Superclass::AdvancedTransformType TransformType
typename ImageMetricType::Pointer ImageMetricPointer
SmartPointer< const Self > ConstPointer
const InterpolatorType * GetInterpolator() const override
void SetMovingImage(const MovingImageType *_arg) override
void SetNumberOfMetrics(unsigned int count)
InterpolatorType * GetInterpolator() override
virtual const FixedImageMaskType * GetFixedImageMask(unsigned int pos) const
CombinationImageToImageMetric()
virtual const TransformType * GetTransform(unsigned int pos) const
virtual void SetFixedImageRegion(const FixedImageRegionType _arg, unsigned int pos)
void InitializeThreadingParameters() const override
virtual void SetInterpolator(InterpolatorType *_arg, unsigned int pos)
void Initialize() override
const MovingImageType * GetMovingImage() const override
double GetMetricComputationTime(unsigned int pos) const
virtual void SetMovingImage(const MovingImageType *_arg, unsigned int pos)
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
void SetMetricRelativeWeight(double weight, unsigned int pos)
Computes similarity between two point sets.