diff --git a/Modules/Core/Common/include/itkImageAlgorithm.hxx b/Modules/Core/Common/include/itkImageAlgorithm.hxx index 9afddda4db0..3aead3a2b20 100644 --- a/Modules/Core/Common/include/itkImageAlgorithm.hxx +++ b/Modules/Core/Common/include/itkImageAlgorithm.hxx @@ -260,8 +260,7 @@ ImageAlgorithm::EnlargeRegionOverBox(const typename InputImageType::RegionType & outputPoint[d] = inputPoint[d]; } } - outputCorners[count] = - outputImage->template TransformPhysicalPointToContinuousIndex(outputPoint); + outputCorners[count] = outputImage->TransformPhysicalPointToContinuousIndex(outputPoint); } // Compute a rectangular region from the vector of corner indexes diff --git a/Modules/Core/Common/include/itkImageBase.h b/Modules/Core/Common/include/itkImageBase.h index 231296a722c..35b35019558 100644 --- a/Modules/Core/Common/include/itkImageBase.h +++ b/Modules/Core/Common/include/itkImageBase.h @@ -509,6 +509,19 @@ class ITK_TEMPLATE_EXPORT ImageBase : public DataObject return index; } + + /** \brief Returns the continuous index from a physical point + * \note This specific overload is easier to use, because it does not have template arguments. It just uses + * `itk::SpacePrecisionType`, both for the coordinates of the point and the index values. + * + * \sa Transform */ + [[nodiscard]] ContinuousIndex + TransformPhysicalPointToContinuousIndex(const PointType & point) const + { + return TransformPhysicalPointToContinuousIndex(point); + } + + /** \brief Get the continuous index from a physical point * * Returns true if the resulting index is within the image, false otherwise. diff --git a/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h b/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h index b2845ac55a1..d0fc67382e0 100644 --- a/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h +++ b/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h @@ -208,6 +208,18 @@ class ITK_TEMPLATE_EXPORT PhasedArray3DSpecialCoordinatesImage : public SpecialC return index; } + /** \brief Returns the continuous index from a physical point + * \note This specific overload is easier to use, because it does not have template arguments. It just uses + * `itk::SpacePrecisionType`, both for the coordinates of the point and the index values. + * + * \sa Transform */ + [[nodiscard]] ContinuousIndex + TransformPhysicalPointToContinuousIndex(const PointType & point) const + { + return TransformPhysicalPointToContinuousIndex(point); + } + + /** \brief Get the continuous index from a physical point * * Returns true if the resulting index is within the image, false otherwise. diff --git a/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h b/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h index 789d332cce6..ee48fc86406 100644 --- a/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h +++ b/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h @@ -389,6 +389,18 @@ class ITK_TEMPLATE_EXPORT ImageAdaptor : public ImageBasetemplate TransformPhysicalPointToContinuousIndex(point); } + /** \brief Returns the continuous index from a physical point + * \note This specific overload is easier to use, because it does not have template arguments. It just uses + * `itk::SpacePrecisionType`, both for the coordinates of the point and the index values. + * + * \sa Transform */ + [[nodiscard]] ContinuousIndex + TransformPhysicalPointToContinuousIndex(const PointType & point) const + { + return m_Image->TransformPhysicalPointToContinuousIndex(point); + } + + /** \brief Get the continuous index from a physical point * * Returns true if the resulting index is within the image, false otherwise. diff --git a/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx b/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx index 1a997bec26c..848709e265c 100644 --- a/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx +++ b/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx @@ -347,8 +347,7 @@ TriangleMeshToBinaryImageFilter::RasterizeTriangles() { PointType p = points.Value(); // the index value type must match the point value type - const ContinuousIndex ind = - OutputImage->template TransformPhysicalPointToContinuousIndex(p); + const ContinuousIndex ind = OutputImage->TransformPhysicalPointToContinuousIndex(p); NewPoints->InsertElement(pointId++, ind); ++points; diff --git a/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx b/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx index c553079c6dc..e5b2a93328c 100644 --- a/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx +++ b/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx @@ -233,8 +233,7 @@ BSplineBaseTransform:: WeightsType & weights, ParameterIndexArrayType & indexes) const { - ContinuousIndexType index = - this->m_CoefficientImages[0]->template TransformPhysicalPointToContinuousIndex(point); + ContinuousIndexType index = this->m_CoefficientImages[0]->TransformPhysicalPointToContinuousIndex(point); // NOTE: if the support region does not lie totally within the grid // we assume zero displacement and return the input point diff --git a/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx index f28a6043c38..35720e0da2a 100644 --- a/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx @@ -183,9 +183,8 @@ WarpImageFilter::EvaluateDisplace const DisplacementFieldType * fieldPtr, DisplacementType & output) { - const ContinuousIndex index = - fieldPtr->template TransformPhysicalPointToContinuousIndex(point); - unsigned int dim; // index over dimension + const ContinuousIndex index = fieldPtr->TransformPhysicalPointToContinuousIndex(point); + unsigned int dim; // index over dimension /** * Compute base index = closest index below point * Compute distance from point to base index diff --git a/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx index 0361e893ef5..727cf3ba493 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteGradientMagnitudeGaussianImageFunctionTest.cxx @@ -161,7 +161,7 @@ itkDiscreteGradientMagnitudeGaussianImageFunctionTestND(int argc, char * argv[]) inputImage->TransformIndexToPhysicalPoint(it.GetIndex(), point); const ContinuousIndexType cindex = - inputImage->TransformPhysicalPointToContinuousIndex(point); + inputImage->template TransformPhysicalPointToContinuousIndex(point); out.Set(function->EvaluateAtContinuousIndex(cindex)); } ++it; diff --git a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx index 994d833381a..0cb2d19cf9d 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx @@ -153,7 +153,7 @@ itkDiscreteHessianGaussianImageFunctionTestND(int argc, char * argv[]) reader->GetOutput()->TransformIndexToPhysicalPoint(it.GetIndex(), point); const ContinuousIndexType cindex = - reader->GetOutput()->TransformPhysicalPointToContinuousIndex(point); + reader->GetOutput()->template TransformPhysicalPointToContinuousIndex(point); hessian = function->EvaluateAtContinuousIndex(cindex); } diff --git a/Modules/Registration/Common/include/itkImageToImageMetric.hxx b/Modules/Registration/Common/include/itkImageToImageMetric.hxx index e98a210f145..36a6fa7acc5 100644 --- a/Modules/Registration/Common/include/itkImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkImageToImageMetric.hxx @@ -990,7 +990,7 @@ ImageToImageMetric::ComputeImageDerivatives(const Mov if (m_ComputeGradient) { const ContinuousIndex tempIndex = - m_MovingImage->template TransformPhysicalPointToContinuousIndex(mappedPoint); + m_MovingImage->TransformPhysicalPointToContinuousIndex(mappedPoint); MovingImageIndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); gradient = m_GradientImage->GetPixel(mappedIndex); diff --git a/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx b/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx index eb1621c67ba..6b7a37afad7 100644 --- a/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx @@ -249,7 +249,7 @@ KappaStatisticImageToImageMetric::GetDerivative(const using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); diff --git a/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx b/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx index e71e4eb8f47..e2956cccb67 100644 --- a/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx @@ -148,7 +148,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetric; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); @@ -247,7 +247,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetric; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); diff --git a/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx b/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx index fb1de31b02a..c5333495329 100644 --- a/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx @@ -142,7 +142,7 @@ MeanSquaresPointSetToImageMetric::GetDerivative( using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); @@ -242,7 +242,7 @@ MeanSquaresPointSetToImageMetric::GetValueAndDeriv using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); diff --git a/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx b/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx index 67ccb06adf0..f8a8219a99e 100644 --- a/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx @@ -249,7 +249,7 @@ NormalizedCorrelationImageToImageMetric::GetDerivativ using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); @@ -434,7 +434,7 @@ NormalizedCorrelationImageToImageMetric::GetValueAndD using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); diff --git a/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx b/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx index 68ba2d1f411..9af4b13decc 100644 --- a/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx @@ -192,7 +192,7 @@ NormalizedCorrelationPointSetToImageMetric::GetDer using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->GetMovingImage()->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->GetMovingImage()->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); @@ -335,7 +335,7 @@ NormalizedCorrelationPointSetToImageMetric::GetVal using MovingImageContinuousIndexType = ContinuousIndex; const MovingImageContinuousIndexType tempIndex = - this->GetMovingImage()->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->GetMovingImage()->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); diff --git a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx index 6a4230f2efa..46072ac8fab 100644 --- a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx +++ b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx @@ -160,8 +160,7 @@ SLICImageFilter::BeforeThreadedGenera const IndexType & idx = it.GetIndex(); typename InputImageType::PointType pt; shrunkImage->TransformIndexToPhysicalPoint(idx, pt); - const ContinuousIndexType cidx = - inputImage->template TransformPhysicalPointToContinuousIndex(pt); + const ContinuousIndexType cidx = inputImage->TransformPhysicalPointToContinuousIndex(pt); for (unsigned int i = 0; i < ImageDimension; ++i) { cluster[numberOfComponents + i] = cidx[i];