From 5b71d63a88cc80547e8584eae59e945fbbf51e5d Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 24 Feb 2022 00:16:26 +0100 Subject: [PATCH] BUG: Quick-fix ContourSpatialObject::Update(), LINEAR_INTERPOLATION case `ContourSpatialObject::Update()` appears to have an assignment to `newPoint`, in the `case InterpolationMethodEnum::LINEAR_INTERPOLATION` section, which was meant to assign just a single element `newPoint[d]`. As was confirmed by Stephen Aylward at issue https://github.com/InsightSoftwareConsortium/ITK/issues/3222, "`ContourSpatialObject::Update()` LINEAR_INTERPOLATION case may need some adjustment". Some more adjustment may still be needed, as `newPoint` now still gets modified multiply times (rather than just once), before it eventually gets used. --- .../SpatialObjects/include/itkContourSpatialObject.hxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx index 1188bb2b95e..bb667b31abc 100644 --- a/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx @@ -214,13 +214,18 @@ ContourSpatialObject::Update() { step[d] = (pnt2[d] - pnt[d]) / m_InterpolationFactor; } + + // TODO There is an issue regarding this code, from 24 February 2022: + // "`ContourSpatialObject::Update()` LINEAR_INTERPOLATION case may need some adjustment" + // https://github.com/InsightSoftwareConsortium/ITK/issues/3222 + PointType newPoint; newPoint.Fill(NumericTraits::max()); for (unsigned int i = 0; i < m_InterpolationFactor; ++i) { for (unsigned int d = 0; d < TDimension; ++d) { - newPoint = pnt[d] + i * step[d]; + newPoint[d] = pnt[d] + i * step[d]; } } typename Superclass::SpatialObjectPointType newSOPoint;