diff --git a/Modules/Core/Common/include/itkImageAlgorithm.hxx b/Modules/Core/Common/include/itkImageAlgorithm.hxx index 94fcb4925a9..147382cd0fa 100644 --- a/Modules/Core/Common/include/itkImageAlgorithm.hxx +++ b/Modules/Core/Common/include/itkImageAlgorithm.hxx @@ -277,8 +277,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 957d7fa4371..775aa266686 100644 --- a/Modules/Core/Common/include/itkImageBase.h +++ b/Modules/Core/Common/include/itkImageBase.h @@ -531,6 +531,17 @@ class ITK_TEMPLATE_EXPORT ImageBase : public DataObject return index; } + /** \brief Returns the continuous index from a physical point + * \note This non-template overload is easier to use, because it does not have template arguments. It uses + * `itk::SpacePrecisionType` both for the coordinates of the point and the values of the index. + * + * \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 b06a460d151..072821109ab 100644 --- a/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h +++ b/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h @@ -208,6 +208,17 @@ class ITK_TEMPLATE_EXPORT PhasedArray3DSpecialCoordinatesImage : public SpecialC return index; } + /** \brief Returns the continuous index from a physical point + * \note This non-template overload is easier to use, because it does not have template arguments. It uses + * `itk::SpacePrecisionType` both for the coordinates of the point and the values of the index. + * + * \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 c36efee3a8e..cc3bc64ecd0 100644 --- a/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h +++ b/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h @@ -402,6 +402,17 @@ class ITK_TEMPLATE_EXPORT ImageAdaptor : public ImageBasetemplate TransformPhysicalPointToContinuousIndex(point); } + /** \brief Returns the continuous index from a physical point + * \note This non-template overload is easier to use, because it does not have template arguments. It uses + * `itk::SpacePrecisionType` both for the coordinates of the point and the values of the index. + * + * \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 a2937236307..597dbb5d42e 100644 --- a/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx +++ b/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx @@ -341,7 +341,7 @@ TriangleMeshToBinaryImageFilter::RasterizeTriangles() while (points != myPoints->End()) { const PointType p = points.Value(); - // the index value type must match the point value type + // Explicit keeps the index in the mesh's point precision. const ContinuousIndex ind = OutputImage->template TransformPhysicalPointToContinuousIndex(p); NewPoints->InsertElement(pointId++, ind); diff --git a/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx b/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx index 679cc9e92cc..448c63adbb7 100644 --- a/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx +++ b/Modules/Core/Transform/include/itkBSplineBaseTransform.hxx @@ -230,6 +230,7 @@ BSplineBaseTransform:: WeightsType & weights, ParameterIndexArrayType & indexes) const { + // Explicit keeps the index in parametric precision under ITK_USE_FLOAT_SPACE_PRECISION=ON. ContinuousIndexType index = this->m_CoefficientImages[0]->template TransformPhysicalPointToContinuousIndex(point); diff --git a/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx index 0226ee64abc..4d2350bf440 100644 --- a/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx @@ -183,6 +183,7 @@ WarpImageFilter::EvaluateDisplace const DisplacementFieldType * fieldPtr, DisplacementType & output) { + // Explicit keeps the index in double precision under ITK_USE_FLOAT_SPACE_PRECISION=ON. const ContinuousIndex index = fieldPtr->template TransformPhysicalPointToContinuousIndex(point); /** diff --git a/Modules/Registration/Common/include/itkImageToImageMetric.hxx b/Modules/Registration/Common/include/itkImageToImageMetric.hxx index 2e13aeeebb7..35a108a3796 100644 --- a/Modules/Registration/Common/include/itkImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkImageToImageMetric.hxx @@ -988,7 +988,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 d8477ffa173..0e1b3f0d380 100644 --- a/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx @@ -247,7 +247,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 f3aaa7d8a30..1f2fd0f26cc 100644 --- a/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx @@ -147,7 +147,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetric; const MovingImageContinuousIndexType tempIndex = - this->m_MovingImage->template TransformPhysicalPointToContinuousIndex(transformedPoint); + this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint); typename MovingImageType::IndexType mappedIndex; mappedIndex.CopyWithRound(tempIndex); @@ -246,7 +246,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 6b14f699875..6eed01e61fc 100644 --- a/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx @@ -140,7 +140,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); @@ -240,7 +240,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 45b40d15f81..a1a5eda3049 100644 --- a/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx @@ -241,7 +241,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); @@ -425,7 +425,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 e20b09fa951..873a89a9605 100644 --- a/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx @@ -184,7 +184,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); @@ -327,7 +327,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 443c02af2bd..50df444ee63 100644 --- a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx +++ b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx @@ -148,8 +148,7 @@ SLICImageFilter::BeforeThreadedGenera const IndexType & idx = it.ComputeIndex(); 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]; diff --git a/Testing/ContinuousIntegration/AzurePipelinesLinuxPython.yml b/Testing/ContinuousIntegration/AzurePipelinesLinuxPython.yml index dbab7f41908..b39aa9cd2db 100644 --- a/Testing/ContinuousIntegration/AzurePipelinesLinuxPython.yml +++ b/Testing/ContinuousIntegration/AzurePipelinesLinuxPython.yml @@ -130,6 +130,30 @@ jobs: CTEST_OUTPUT_ON_FAILURE: 1 CCACHE_MAXSIZE: 8G + - bash: | + set -x + # Shrink the local ccache and prune the build tree before the + # implicit post-job 'Cache@2' uploader tars CCACHE_DIR. Issue: + # the post-job tar fails ENOSPC when the runner's writable disk + # is too full to hold the temporary archive (Azure DevOps + # ITK.Linux.Python builds 14748 / 14751 both hit + # tar: Wrote only 4096 of 10240 bytes + # tar: Error is not recoverable + # at 95-96% disk usage). Drop ccache items > 5 days old, force + # the local store under 6.5G with -c, then 'ninja clean' the + # build tree to free the .o files that are no longer needed + # after the build/test phase has reported. + df -h / + ccache --show-stats + ccache --evict-older-than 5d + ccache --max-size 6.5G + ccache -c + ccache --show-stats + ninja -C $(Build.SourcesDirectory)-build clean || true + df -h / + condition: always() + displayName: 'Free disk before post-job ccache upload' + - bash: ccache --show-stats condition: always() displayName: 'ccache stats'