18#ifndef itkImageToImageMetricv4_h
19#define itkImageToImageMetricv4_h
168template <
typename TFixedImage,
169 typename TMovingImage,
170 typename TVirtualImage = TFixedImage,
171 typename TInternalComputationValueType = double,
172 typename TMetricTraits =
173 DefaultImageToImageMetricTraitsv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType>>
176 TMovingImage::ImageDimension,
178 TInternalComputationValueType>
186 TMovingImage::ImageDimension,
188 TInternalComputationValueType>;
201 using typename Superclass::CoordinateRepresentationType;
204 using typename Superclass::ParametersType;
205 using typename Superclass::ParametersValueType;
208 using typename Superclass::GradientSourceEnum;
211 using typename Superclass::DimensionType;
215 using typename Superclass::FixedTransformType;
216 using typename Superclass::FixedTransformPointer;
217 using typename Superclass::FixedInputPointType;
218 using typename Superclass::FixedOutputPointType;
219 using typename Superclass::FixedTransformParametersType;
221 using typename Superclass::MovingTransformType;
222 using typename Superclass::MovingTransformPointer;
223 using typename Superclass::MovingInputPointType;
224 using typename Superclass::MovingOutputPointType;
225 using typename Superclass::MovingTransformParametersType;
227 using typename Superclass::JacobianType;
228 using typename Superclass::FixedTransformJacobianType;
229 using typename Superclass::MovingTransformJacobianType;
252 using typename Superclass::VirtualImagePointer;
253 using typename Superclass::VirtualPixelType;
254 using typename Superclass::VirtualRegionType;
255 using typename Superclass::VirtualSizeType;
256 using typename Superclass::VirtualSpacingType;
258 using typename Superclass::VirtualPointType;
259 using typename Superclass::VirtualDirectionType;
261 using typename Superclass::VirtualIndexType;
262 using typename Superclass::VirtualPointSetType;
263 using typename Superclass::VirtualPointSetPointer;
269 static constexpr DimensionType FixedImageDimension = Superclass::FixedDimension;
270 static constexpr DimensionType MovingImageDimension = Superclass::MovingDimension;
271 static constexpr DimensionType VirtualImageDimension = Superclass::VirtualDimension;
352 using typename Superclass::MeasureType;
355 using typename Superclass::DerivativeType;
360 using typename Superclass::NumberOfParametersType;
367 if (image !=
nullptr)
369 this->SetFixedImage(image);
373 itkExceptionMacro(
"Incorrect object type. Should be an image.");
383 if (image !=
nullptr)
385 this->SetMovingImage(image);
389 itkExceptionMacro(
"Incorrect object type. Should be an image.");
416#ifndef ITK_FUTURE_LEGACY_REMOVE
420 const auto *
const constArg = arg;
422 this->SetMovingImageMask(constArg);
430#ifndef ITK_FUTURE_LEGACY_REMOVE
434 const auto *
const constArg = arg;
436 this->SetFixedImageMask(constArg);
446#ifndef ITK_FUTURE_LEGACY_REMOVE
450 const auto *
const constArg = arg;
452 this->SetFixedSampledPointSet(constArg);
465 itkSetMacro(UseSampledPointSet,
bool);
466 itkGetConstReferenceMacro(UseSampledPointSet,
bool);
467 itkBooleanMacro(UseSampledPointSet);
472 itkSetMacro(UseVirtualSampledPointSet,
bool);
473 itkGetConstReferenceMacro(UseVirtualSampledPointSet,
bool);
474 itkBooleanMacro(UseVirtualSampledPointSet);
477#if !defined(ITK_LEGACY_REMOVE)
480 itkLegacyMacro(
virtual void SetUseFixedSampledPointSet(
bool v))
482 this->SetUseSampledPointSet(v);
484 itkLegacyMacro(
virtual bool GetUseFixedSampledPointSet()
const)
486 return this->GetUseSampledPointSet();
488 itkLegacyMacro(
virtual void UseFixedSampledPointSetOn())
490 return this->UseSampledPointSetOn();
492 itkLegacyMacro(
virtual void UseFixedSampledPointSetOff())
494 return this->UseSampledPointSetOff();
516 itkSetMacro(UseFixedImageGradientFilter,
bool);
517 itkGetConstReferenceMacro(UseFixedImageGradientFilter,
bool);
518 itkBooleanMacro(UseFixedImageGradientFilter);
522 itkSetMacro(UseMovingImageGradientFilter,
bool);
523 itkGetConstReferenceMacro(UseMovingImageGradientFilter,
bool);
524 itkBooleanMacro(UseMovingImageGradientFilter);
542#if !defined(ITK_LEGACY_REMOVE)
548 itkLegacyMacro(
virtual ThreadIdType GetNumberOfThreadsUsed()
const)
550 return this->GetNumberOfWorkUnitsUsed();
559 itkLegacyMacro(
virtual void SetMaximumNumberOfThreads(
const ThreadIdType count))
561 this->SetMaximumNumberOfWorkUnits(count);
563 itkLegacyMacro(
virtual ThreadIdType GetMaximumNumberOfThreads()
const)
565 return this->GetMaximumNumberOfWorkUnits();
609 itkSetMacro(UseFloatingPointCorrection,
bool);
610 itkGetConstReferenceMacro(UseFloatingPointCorrection,
bool);
611 itkBooleanMacro(UseFloatingPointCorrection);
650 itkGetConstReferenceMacro(NumberOfSkippedFixedSampledPoints,
SizeValueType);
658 using typename Superclass::MetricCategoryType;
664 return MetricCategoryType::IMAGE_METRIC;
756 itkGetConstMacro(ComputeDerivative,
bool);
769 bool m_UseFixedImageGradientFilter{};
770 bool m_UseMovingImageGradientFilter{};
811 bool m_UseSampledPointSet{};
815 bool m_UseVirtualSampledPointSet{};
833 mappedFixedPoint = this->m_FixedTransform->TransformPoint(virtualPoint);
836 template <
typename TVirtualPo
int>
844 localVirtualPoint.
CastFrom(virtualPoint);
846 mappedFixedPoint = this->m_FixedTransform->TransformPoint(localVirtualPoint);
849 template <
typename TFixedImagePo
int>
852 TFixedImagePoint & mappedFixedPoint)
const
855 localMappedFixedPoint.
CastFrom(mappedFixedPoint);
856 localMappedFixedPoint = this->m_FixedTransform->TransformPoint(virtualPoint);
857 mappedFixedPoint.
CastFrom(localMappedFixedPoint);
860 template <
typename TVirtualPo
int,
typename TFixedImagePo
int>
867 localVirtualPoint.
CastFrom(virtualPoint);
868 localMappedFixedPoint.
CastFrom(mappedFixedPoint);
870 localMappedFixedPoint = this->m_FixedTransform->TransformPoint(localVirtualPoint);
871 mappedFixedPoint.
CastFrom(localMappedFixedPoint);
876 mutable bool m_HaveMadeGetValueWarning{};
883 bool m_UseFloatingPointCorrection{};
889 mutable bool m_ComputeDerivative{};
893#ifdef ITK_USE_CONCEPT_CHECKING
903#ifndef ITK_MANUAL_INSTANTIATION
904# include "itkImageToImageMetricv4.hxx"
A templated class holding a n-Dimensional covariant vector.
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
Provides threading for ImageToImageMetricv4::GetValueAndDerivative.
void LocalTransformPoint(const TVirtualPoint &virtualPoint, TFixedImagePoint &mappedFixedPoint) const
typename DerivativeType::ValueType DerivativeValueType
typename MetricTraits::DefaultFixedImageGradientCalculator DefaultFixedImageGradientCalculator
virtual void ComputeFixedImageGradientAtPoint(const FixedImagePointType &mappedPoint, FixedImageGradientType &gradient) const
~ImageToImageMetricv4() override=default
virtual void InitializeDefaultFixedImageGradientFilter()
virtual void ComputeMovingImageGradientFilterImage() const
typename MovingImageType::ConstPointer MovingImageConstPointer
typename PixelTraits< FixedImagePixelType >::ValueType FixedImagePixelValueType
typename MetricTraits::MovingImageGradientFilterType MovingImageGradientFilterType
TMovingImage MovingImageType
typename MetricTraits::MovingImageGradientImageType MovingImageGradientImageType
typename MovingImageType::PointType MovingImagePointType
ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< VirtualImageDimension >, Self >::Pointer m_DenseGetValueAndDerivativeThreader
typename Superclass::VirtualImageType VirtualImageType
typename MetricTraits::DefaultFixedImageGradientFilter DefaultFixedImageGradientFilter
virtual void InitializeForIteration() const
typename MovingImageType::Pointer MovingImagePointer
TInternalComputationValueType InternalComputationValueType
typename FixedImageGradientImageType::Pointer FixedImageGradientImagePointer
typename PixelTraits< MovingImagePixelType >::ValueType MovingImagePixelValueType
typename FixedImageMaskType::Pointer FixedImageMaskPointer
typename FixedImageType::PixelType FixedImagePixelType
void Initialize() override
MovingImagePixelType MovingPixelType
FixedImagePixelType FixedPixelType
void MapFixedSampledPointSetToVirtual()
typename Superclass::VirtualSizeType VirtualRadiusType
typename MetricTraits::DefaultMovingImageGradientCalculator DefaultMovingImageGradientCalculator
typename MovingImageGradientCalculatorType::Pointer MovingImageGradientCalculatorPointer
bool TransformAndEvaluateFixedPoint(const VirtualPointType &virtualPoint, FixedImagePointType &mappedFixedPoint, FixedImagePixelType &mappedFixedPixelValue) const
void SetFixedObject(const ObjectType *object) override
MetricCategoryType GetMetricCategory() const override
TMetricTraits MetricTraits
MeasureType GetValue() const override
typename NumericTraits< MovingRealType >::ScalarRealType MovingScalarRealType
void GetDerivative(DerivativeType &) const override
typename MetricTraits::FixedImageGradientImageType FixedImageGradientImageType
typename MovingImageGradientImageType::Pointer MovingImageGradientImagePointer
virtual void SetMaximumNumberOfWorkUnits(const ThreadIdType number)
typename FixedImageGradientCalculatorType::Pointer FixedImageGradientCalculatorPointer
void GetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const override
typename FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
SizeValueType GetNumberOfDomainPoints() const
TFixedImage FixedImageType
virtual void ComputeFixedImageGradientFilterImage()
virtual void GetValueAndDerivativeExecute() const
typename MetricTraits::DefaultMovingImageGradientFilter DefaultMovingImageGradientFilter
typename FixedImageType::PointType FixedImagePointType
typename MovingImageType::RegionType MovingImageRegionType
typename MetricTraits::VirtualImageGradientType VirtualImageGradientType
typename MetricTraits::FixedGradientPixelType FixedGradientPixelType
typename MovingInterpolatorType::Pointer MovingInterpolatorPointer
bool TransformAndEvaluateMovingPoint(const VirtualPointType &virtualPoint, MovingImagePointType &mappedMovingPoint, MovingImagePixelType &mappedMovingPixelValue) const
typename MetricTraits::MovingImageGradientCalculatorType MovingImageGradientCalculatorType
typename MetricTraits::MovingRealType MovingRealType
typename FixedImageType::Pointer FixedImagePointer
typename FixedSampledPointSetType::ConstPointer FixedSampledPointSetConstPointer
void LocalTransformPoint(const typename FixedTransformType::OutputPointType &virtualPoint, typename FixedTransformType::OutputPointType &mappedFixedPoint) const
void LocalTransformPoint(const TVirtualPoint &virtualPoint, typename FixedTransformType::OutputPointType &mappedFixedPoint) const
ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_SparseGetValueAndDerivativeThreader
virtual ThreadIdType GetMaximumNumberOfWorkUnits() const
typename MetricTraits::FixedImageGradientCalculatorType FixedImageGradientCalculatorType
typename MetricTraits::MovingImageGradientType MovingImageGradientType
typename MetricTraits::FixedImageGradientFilterType FixedImageGradientFilterType
void LocalTransformPoint(const typename FixedTransformType::OutputPointType &virtualPoint, TFixedImagePoint &mappedFixedPoint) const
typename MovingImageType::IndexType MovingImageIndexType
typename MovingImageType::PixelType MovingImagePixelType
void PrintSelf(std::ostream &os, Indent indent) const override
void SetMovingObject(const ObjectType *object) override
bool SupportsArbitraryVirtualDomainSamples() const override
typename FixedImageGradientFilterType::Pointer FixedImageGradientFilterPointer
virtual void FinalizeThread(const ThreadIdType)
typename Superclass::VirtualPointType VirtualOriginType
typename MetricTraits::MovingGradientPixelType MovingGradientPixelType
typename Superclass::DimensionType ImageDimensionType
typename FixedInterpolatorType::Pointer FixedInterpolatorPointer
typename MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
typename Superclass::ObjectType ObjectType
typename MetricTraits::FixedRealType FixedRealType
typename FixedSampledPointSetType::Pointer FixedSampledPointSetPointer
virtual ThreadIdType GetNumberOfWorkUnitsUsed() const
typename NumericTraits< FixedRealType >::ScalarRealType FixedScalarRealType
typename FixedImageType::ConstPointer FixedImageConstPointer
typename FixedImageType::IndexType FixedImageIndexType
typename MovingImageMaskType::Pointer MovingImageMaskPointer
virtual void ComputeMovingImageGradientAtPoint(const MovingImagePointType &mappedPoint, MovingImageGradientType &gradient) const
typename MovingImageGradientFilterType::Pointer MovingImageGradientFilterPointer
virtual void InitializeDefaultMovingImageGradientFilter()
typename MetricTraits::FixedImageGradientType FixedImageGradientType
Control indentation during Print() invocation.
Base class for all image interpolators.
Light weight base class for most itk classes.
Linearly interpolate an image at specified positions.
Computes similarity between regions of two objects.
SizeValueType DimensionType
typename VirtualPointSetType::Pointer VirtualPointSetPointer
typename VirtualImageType::PointType VirtualPointType
typename TPixelType::ValueType ValueType
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
A templated class holding a geometric point in n-Dimensional space.
void CastFrom(const Point< TCoordRepB, VPointDimension > &pa)
Implementation of the composite pattern.
Class for partitioning of an ImageRegion.
Partitions an indexed container.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
ImageBaseType::RegionType RegionType
ImageBaseType::IndexType IndexType
ImageBaseType::PointType PointType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
unsigned long SizeValueType