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;
171 using typename Superclass::VirtualImagePointer;
172 using typename Superclass::VirtualPixelType;
173 using typename Superclass::VirtualRegionType;
174 using typename Superclass::VirtualSizeType;
175 using typename Superclass::VirtualSpacingType;
177 using typename Superclass::VirtualPointType;
178 using typename Superclass::VirtualDirectionType;
180 using typename Superclass::VirtualIndexType;
181 using typename Superclass::VirtualPointSetType;
182 using typename Superclass::VirtualPointSetPointer;
188 auto * pointSet = dynamic_cast<FixedPointSetType *>(const_cast<ObjectType *>(
object));
189 if (pointSet !=
nullptr)
191 this->SetFixedPointSet(pointSet);
195 itkExceptionMacro(
"Incorrect object type. Should be a point set.");
204 auto * pointSet = dynamic_cast<MovingPointSetType *>(const_cast<ObjectType *>(
object));
205 if (pointSet !=
nullptr)
207 this->SetMovingPointSet(pointSet);
211 itkExceptionMacro(
"Incorrect object type. Should be a point set.");
217 itkSetConstObjectMacro(FixedPointSet, FixedPointSetType);
218 itkGetConstObjectMacro(FixedPointSet, FixedPointSetType);
222 itkGetModifiableObjectMacro(FixedTransformedPointSet, FixedTransformedPointSetType);
225 itkSetConstObjectMacro(MovingPointSet, MovingPointSetType);
226 itkGetConstObjectMacro(MovingPointSet, MovingPointSetType);
230 itkGetModifiableObjectMacro(MovingTransformedPointSet, MovingTransformedPointSetType);
236 GetNumberOfComponents()
const;
249 GetValue()
const override;
262 GetDerivative(DerivativeType &)
const override;
275 GetValueAndDerivative(MeasureType &, DerivativeType &)
const override;
281 const VirtualPointSetType *
282 GetVirtualTransformedPointSet()
const;
289 Initialize()
override;
310 itkSetMacro(StoreDerivativeAsSparseFieldForLocalSupportTransforms,
bool);
311 itkGetConstMacro(StoreDerivativeAsSparseFieldForLocalSupportTransforms,
bool);
312 itkBooleanMacro(StoreDerivativeAsSparseFieldForLocalSupportTransforms);
318 itkSetMacro(CalculateValueAndDerivativeInTangentSpace,
bool);
319 itkGetConstMacro(CalculateValueAndDerivativeInTangentSpace,
bool);
320 itkBooleanMacro(CalculateValueAndDerivativeInTangentSpace);
327 PrintSelf(std::ostream & os,
Indent indent)
const override;
346 bool m_UsePointSetData{};
355 bool m_CalculateValueAndDerivativeInTangentSpace{};
360 InitializePointSets()
const;
367 InitializeForIteration()
const;
375 CalculateNumberOfValidFixedPoints()
const;
380 CalculateValueAndDerivative(MeasureType & calculatedValue, DerivativeType & derivative,
bool calculateValue)
const;
389 TransformFixedAndCreateVirtualPointSet()
const;
398 TransformMovingPointSet()
const;
405 InitializePointsLocators()
const;
412 StorePointDerivative(
const VirtualPointType &,
const DerivativeType &, DerivativeType &)
const;
414 using typename Superclass::MetricCategoryType;
420 return MetricCategoryType::POINT_SET_METRIC;
441 GetLocalNeighborhoodValueWithIndex(
const PointIdentifier &,
const PointType &,
const PixelType & pixel)
const = 0;
449 virtual LocalDerivativeType
450 GetLocalNeighborhoodDerivativeWithIndex(
const PointIdentifier &,
const PointType &,
const PixelType & pixel)
const;
458 GetLocalNeighborhoodValueAndDerivativeWithIndex(
const PointIdentifier &,
461 LocalDerivativeType &,
462 const PixelType & pixel)
const = 0;
465 mutable bool m_MovingTransformPointLocatorsNeedInitialization{};
466 mutable bool m_FixedTransformPointLocatorsNeedInitialization{};
470 mutable bool m_HaveWarnedAboutNumberOfValidPoints{};
474 bool m_StoreDerivativeAsSparseFieldForLocalSupportTransforms{};
483 CreateRanges()
const;
487 #ifndef ITK_MANUAL_INSTANTIATION
488 # include "itkPointSetToPointSetMetricWithIndexv4.hxx"