Skip to content

Commit

Permalink
BUG: Quick-fix ContourSpatialObject::Update(), LINEAR_INTERPOLATION case
Browse files Browse the repository at this point in the history
`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 #3222,
"`ContourSpatialObject<TDimension>::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.
  • Loading branch information
N-Dekker authored and hjmjohnson committed Feb 24, 2022
1 parent 490ef8c commit 5b71d63
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,18 @@ ContourSpatialObject<TDimension>::Update()
{
step[d] = (pnt2[d] - pnt[d]) / m_InterpolationFactor;
}

// TODO There is an issue regarding this code, from 24 February 2022:
// "`ContourSpatialObject<TDimension>::Update()` LINEAR_INTERPOLATION case may need some adjustment"
// https://github.com/InsightSoftwareConsortium/ITK/issues/3222

PointType newPoint;
newPoint.Fill(NumericTraits<double>::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;
Expand Down

0 comments on commit 5b71d63

Please sign in to comment.