-
-
Notifications
You must be signed in to change notification settings - Fork 663
-
-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContourSpatialObject<TDimension>::Update()
LINEAR_INTERPOLATION case may need some adjustment
#3222
Comments
@aylward might have some comment. |
You're right! Great catch! Want to submit a pull request to fix it? |
Thanks @aylward but I don't know how to fix it properly. Is it really a serious bug? Or is this part of the code not so important anyway? If it is a serious bug, can you please tell me the intended behavior? |
The apparent bug is part of the ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx Lines 183 to 193 in a2b3915
|
No. Some kind of interpolation is needed to create a contour from control
points.
I'd rather add a test and fix it. It is a one line change to fix, exactly
as you noted.
I will get to it after March 8th. I have another project due that day.
…On Wed, Feb 23, 2022, 5:03 PM Niels Dekker ***@***.***> wrote:
The apparent bug is part of the case
InterpolationMethodEnum::LINEAR_INTERPOLATION section of a switch
(m_InterpolationMethod). It appears that this specific "case" is not
tested, at least not by itkContourSpatialObjectTest.cxx
<https://github.com/InsightSoftwareConsortium/ITK/blob/a2b39155dae42fb88d52c0d7d7d7e1f1a8c3e954/Modules/Core/SpatialObjects/test/itkContourSpatialObjectTest.cxx>.
If it is indeed untested, and if it is also unused, I would prefer to just
put some itkExceptionMacro(<< "not yet defined") call there, just like in case
InterpolationMethodEnum::BEZIER_INTERPOLATION. Then postpone actual
implementation until it is really needed. Would that be OK to you?
https://github.com/InsightSoftwareConsortium/ITK/blob/a2b39155dae42fb88d52c0d7d7d7e1f1a8c3e954/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx#L183-L193
—
Reply to this email directly, view it on GitHub
<#3222 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACEJL6WIPJEREAM73E42X3U4VKRJANCNFSM5PFGPPPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
ContourSpatialObject<TDimension>::Update()
looks suspiciousContourSpatialObject<TDimension>::Update()
LINEAR_INTERPOLATION case may need some adjustment
`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 InsightSoftwareConsortium#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.
@aylward Thanks for your reply, Stephen. Please check pull request #3225 "BUG: Quick-fix ContourSpatialObject::Update(), LINEAR_INTERPOLATION case", and if possible, please approve the pull request 😃 I think it would still be useful if you could get back to it after March 8th, because I consider my pull request #3225 just a quick-fix. I guess you may be able to fix it more thoroughly 😃 |
`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.
I'm glad to see the quick-fix for this issue is merged quickly, thanks @hjmjohnson! So now the code says:
ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx Lines 222 to 230 in 5b71d63
My remaining questions are:
Anyway, no hurry, I can wait until after after March 8th 😃 |
There is a line of code in
ContourSpatialObject<TDimension>::Update()
that looks suspicious to me:ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.hxx
Lines 217 to 225 in a2b3915
You see,
newPoint
is aPointType
, and it gets filled by a scalar value,pnt[d] + i * step[d]
, over and over again, inside the inner for loop.I think the intention was to do:
But I'm not sure, because I did not study the code well enough yet! Any feedback or possible explanation is welcome!
Note: This bug report is still in progress! More details soon, hopefully!
The text was updated successfully, but these errors were encountered: