18 #ifndef itkPointSetToPointSetMetricWithIndexv4_h
19 #define itkPointSetToPointSetMetricWithIndexv4_h
69 template <
typename TFixedPointSet,
70 typename TMovingPointSet = TFixedPointSet,
71 class TInternalComputationValueType =
double>
74 TMovingPointSet::PointDimension,
75 Image<TInternalComputationValueType, TFixedPointSet::PointDimension>,
76 TInternalComputationValueType>
84 TMovingPointSet::PointDimension,
86 TInternalComputationValueType>;
94 using typename Superclass::MeasureType;
97 using typename Superclass::ParametersType;
98 using typename Superclass::ParametersValueType;
99 using typename Superclass::NumberOfParametersType;
102 using typename Superclass::DerivativeType;
105 using typename Superclass::FixedTransformType;
106 using typename Superclass::FixedTransformPointer;
107 using typename Superclass::FixedInputPointType;
108 using typename Superclass::FixedOutputPointType;
109 using typename Superclass::FixedTransformParametersType;
111 using typename Superclass::MovingTransformType;
112 using typename Superclass::MovingTransformPointer;
113 using typename Superclass::MovingInputPointType;
114 using typename Superclass::MovingOutputPointType;
115 using typename Superclass::MovingTransformParametersType;
117 using typename Superclass::JacobianType;
118 using typename Superclass::FixedTransformJacobianType;
119 using typename Superclass::MovingTransformJacobianType;
126 using typename Superclass::DimensionType;
134 static constexpr
DimensionType FixedPointDimension = Superclass::FixedDimension;
142 static constexpr
DimensionType MovingPointDimension = Superclass::MovingDimension;
155 #ifndef ITK_FUTURE_LEGACY_REMOVE
156 using CoordRepType ITK_FUTURE_DEPRECATED(
157 "ITK 6 discourages using `CoordRepType`. Please use `CoordinateType` instead!") =
CoordinateType;
175 using typename Superclass::VirtualImagePointer;
176 using typename Superclass::VirtualPixelType;
177 using typename Superclass::VirtualRegionType;
178 using typename Superclass::VirtualSizeType;
179 using typename Superclass::VirtualSpacingType;
181 using typename Superclass::VirtualPointType;
182 using typename Superclass::VirtualDirectionType;
184 using typename Superclass::VirtualIndexType;
185 using typename Superclass::VirtualPointSetType;
186 using typename Superclass::VirtualPointSetPointer;
192 auto * pointSet = dynamic_cast<FixedPointSetType *>(const_cast<ObjectType *>(
object));
193 if (pointSet !=
nullptr)
195 this->SetFixedPointSet(pointSet);
199 itkExceptionMacro(
"Incorrect object type. Should be a point set.");
208 auto * pointSet = dynamic_cast<MovingPointSetType *>(const_cast<ObjectType *>(
object));
209 if (pointSet !=
nullptr)
211 this->SetMovingPointSet(pointSet);
215 itkExceptionMacro(
"Incorrect object type. Should be a point set.");
221 itkSetConstObjectMacro(FixedPointSet, FixedPointSetType);
222 itkGetConstObjectMacro(FixedPointSet, FixedPointSetType);
226 itkGetModifiableObjectMacro(FixedTransformedPointSet, FixedTransformedPointSetType);
229 itkSetConstObjectMacro(MovingPointSet, MovingPointSetType);
230 itkGetConstObjectMacro(MovingPointSet, MovingPointSetType);
234 itkGetModifiableObjectMacro(MovingTransformedPointSet, MovingTransformedPointSetType);
240 GetNumberOfComponents()
const;
253 GetValue()
const override;
266 GetDerivative(DerivativeType &)
const override;
279 GetValueAndDerivative(MeasureType &, DerivativeType &)
const override;
285 const VirtualPointSetType *
286 GetVirtualTransformedPointSet()
const;
293 Initialize()
override;
314 itkSetMacro(StoreDerivativeAsSparseFieldForLocalSupportTransforms,
bool);
315 itkGetConstMacro(StoreDerivativeAsSparseFieldForLocalSupportTransforms,
bool);
316 itkBooleanMacro(StoreDerivativeAsSparseFieldForLocalSupportTransforms);
322 itkSetMacro(CalculateValueAndDerivativeInTangentSpace,
bool);
323 itkGetConstMacro(CalculateValueAndDerivativeInTangentSpace,
bool);
324 itkBooleanMacro(CalculateValueAndDerivativeInTangentSpace);
331 PrintSelf(std::ostream & os,
Indent indent)
const override;
350 bool m_UsePointSetData{};
359 bool m_CalculateValueAndDerivativeInTangentSpace{};
364 InitializePointSets()
const;
371 InitializeForIteration()
const;
379 CalculateNumberOfValidFixedPoints()
const;
384 CalculateValueAndDerivative(MeasureType & calculatedValue, DerivativeType & derivative,
bool calculateValue)
const;
393 TransformFixedAndCreateVirtualPointSet()
const;
402 TransformMovingPointSet()
const;
409 InitializePointsLocators()
const;
416 StorePointDerivative(
const VirtualPointType &,
const DerivativeType &, DerivativeType &)
const;
418 using typename Superclass::MetricCategoryType;
424 return MetricCategoryType::POINT_SET_METRIC;
445 GetLocalNeighborhoodValueWithIndex(
const PointIdentifier &,
const PointType &,
const PixelType & pixel)
const = 0;
453 virtual LocalDerivativeType
454 GetLocalNeighborhoodDerivativeWithIndex(
const PointIdentifier &,
const PointType &,
const PixelType & pixel)
const;
462 GetLocalNeighborhoodValueAndDerivativeWithIndex(
const PointIdentifier &,
465 LocalDerivativeType &,
466 const PixelType & pixel)
const = 0;
469 mutable bool m_MovingTransformPointLocatorsNeedInitialization{};
470 mutable bool m_FixedTransformPointLocatorsNeedInitialization{};
474 mutable bool m_HaveWarnedAboutNumberOfValidPoints{};
478 bool m_StoreDerivativeAsSparseFieldForLocalSupportTransforms{};
487 CreateRanges()
const;
491 #ifndef ITK_MANUAL_INSTANTIATION
492 # include "itkPointSetToPointSetMetricWithIndexv4.hxx"