Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Modules/Core/Common/include/itkImageAlgorithm.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ ImageAlgorithm::EnlargeRegionOverBox(const typename InputImageType::RegionType &
outputPoint[d] = inputPoint[d];
}
}
outputCorners[count] =
outputImage->template TransformPhysicalPointToContinuousIndex<ContinuousIndexValueType>(outputPoint);
outputCorners[count] = outputImage->TransformPhysicalPointToContinuousIndex(outputPoint);
}

// Compute a rectangular region from the vector of corner indexes
Expand Down
11 changes: 11 additions & 0 deletions Modules/Core/Common/include/itkImageBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpacePrecisionType, VImageDimension>
TransformPhysicalPointToContinuousIndex(const PointType & point) const
{
return TransformPhysicalPointToContinuousIndex<SpacePrecisionType>(point);
}

/** \brief Get the continuous index from a physical point
*
* Returns true if the resulting index is within the image, false otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpacePrecisionType, 3>
TransformPhysicalPointToContinuousIndex(const PointType & point) const
{
return TransformPhysicalPointToContinuousIndex<SpacePrecisionType>(point);
}

/** \brief Get the continuous index from a physical point
*
* Returns true if the resulting index is within the image, false otherwise.
Expand Down
11 changes: 11 additions & 0 deletions Modules/Core/ImageAdaptors/include/itkImageAdaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,17 @@ class ITK_TEMPLATE_EXPORT ImageAdaptor : public ImageBase<TImage::ImageDimension
return m_Image->template TransformPhysicalPointToContinuousIndex<TIndexRep>(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<SpacePrecisionType, TImage::ImageDimension>
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ TriangleMeshToBinaryImageFilter<TInputMesh, TOutputImage>::RasterizeTriangles()
while (points != myPoints->End())
{
const PointType p = points.Value();
// the index value type must match the point value type
// Explicit <PointType::ValueType> keeps the index in the mesh's point precision.
const ContinuousIndex<PointType::ValueType, 3> ind =
OutputImage->template TransformPhysicalPointToContinuousIndex<PointType::ValueType>(p);
NewPoints->InsertElement(pointId++, ind);
Expand Down
1 change: 1 addition & 0 deletions Modules/Core/Transform/include/itkBSplineBaseTransform.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ BSplineBaseTransform<TParametersValueType, VDimension, VSplineOrder>::
WeightsType & weights,
ParameterIndexArrayType & indexes) const
{
// Explicit <TParametersValueType> keeps the index in parametric precision under ITK_USE_FLOAT_SPACE_PRECISION=ON.
ContinuousIndexType index =
this->m_CoefficientImages[0]->template TransformPhysicalPointToContinuousIndex<TParametersValueType>(point);

Expand Down
1 change: 1 addition & 0 deletions Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ WarpImageFilter<TInputImage, TOutputImage, TDisplacementField>::EvaluateDisplace
const DisplacementFieldType * fieldPtr,
DisplacementType & output)
{
// Explicit <double> keeps the index in double precision under ITK_USE_FLOAT_SPACE_PRECISION=ON.
const ContinuousIndex<double, ImageDimension> index =
fieldPtr->template TransformPhysicalPointToContinuousIndex<double>(point);
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ ImageToImageMetric<TFixedImage, TMovingImage>::ComputeImageDerivatives(const Mov
if (m_ComputeGradient)
{
const ContinuousIndex<double, MovingImageDimension> tempIndex =
m_MovingImage->template TransformPhysicalPointToContinuousIndex<double>(mappedPoint);
m_MovingImage->TransformPhysicalPointToContinuousIndex(mappedPoint);
MovingImageIndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
gradient = m_GradientImage->GetPixel(mappedIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ KappaStatisticImageToImageMetric<TFixedImage, TMovingImage>::GetDerivative(const
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetric<TFixedPointSet, TMovingImage
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down Expand Up @@ -246,7 +246,7 @@ MeanReciprocalSquareDifferencePointSetToImageMetric<TFixedPointSet, TMovingImage
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ MeanSquaresPointSetToImageMetric<TFixedPointSet, TMovingImage>::GetDerivative(
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down Expand Up @@ -240,7 +240,7 @@ MeanSquaresPointSetToImageMetric<TFixedPointSet, TMovingImage>::GetValueAndDeriv
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ NormalizedCorrelationImageToImageMetric<TFixedImage, TMovingImage>::GetDerivativ
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down Expand Up @@ -425,7 +425,7 @@ NormalizedCorrelationImageToImageMetric<TFixedImage, TMovingImage>::GetValueAndD
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->m_MovingImage->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->m_MovingImage->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ NormalizedCorrelationPointSetToImageMetric<TFixedPointSet, TMovingImage>::GetDer
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->GetMovingImage()->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->GetMovingImage()->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down Expand Up @@ -327,7 +327,7 @@ NormalizedCorrelationPointSetToImageMetric<TFixedPointSet, TMovingImage>::GetVal
using MovingImageContinuousIndexType = ContinuousIndex<CoordinateType, MovingImageType::ImageDimension>;

const MovingImageContinuousIndexType tempIndex =
this->GetMovingImage()->template TransformPhysicalPointToContinuousIndex<CoordinateType>(transformedPoint);
this->GetMovingImage()->TransformPhysicalPointToContinuousIndex(transformedPoint);

typename MovingImageType::IndexType mappedIndex;
mappedIndex.CopyWithRound(tempIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ SLICImageFilter<TInputImage, TOutputImage, TDistancePixel>::BeforeThreadedGenera
const IndexType & idx = it.ComputeIndex();
typename InputImageType::PointType pt;
shrunkImage->TransformIndexToPhysicalPoint(idx, pt);
const ContinuousIndexType cidx =
inputImage->template TransformPhysicalPointToContinuousIndex<typename PointType::ValueType>(pt);
const ContinuousIndexType cidx = inputImage->TransformPhysicalPointToContinuousIndex(pt);
for (unsigned int i = 0; i < ImageDimension; ++i)
{
cluster[numberOfComponents + i] = cidx[i];
Expand Down
24 changes: 24 additions & 0 deletions Testing/ContinuousIntegration/AzurePipelinesLinuxPython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading