[Insight-developers] Bug in BSplineInterpolateImageFunction
Johnson, Hans J
hans-johnson at uiowa.edu
Wed Apr 24 10:40:40 EDT 2013
Marius,
GREAT CATCH. I'm working on incorporating your test into ITK right now in order to demonstrate both the bug and the solution.
Hans
=================================================================
Hans J. Johnson, Ph.D.
Assistant Professor, Department of Psychiatry
Mailing Address:
W274 GH Email: hans-johnson at uiowa.edu<mailto:hans-johnson at uiowa.edu>
200 Hawkins Drive Phone: (319) 353 8587
The University of Iowa
Iowa City, IA 52242
From: "M.Staring at lumc.nl<mailto:M.Staring at lumc.nl>" <M.Staring at lumc.nl<mailto:M.Staring at lumc.nl>>
Date: Wednesday, April 24, 2013 8:33 AM
To: ITK <insight-developers at itk.org<mailto:insight-developers at itk.org>>
Subject: [Insight-developers] Bug in BSplineInterpolateImageFunction
Dear all,
The BSplineInterpolateImageFunction class has two functions to compute
the derivative:
- EvaluateDerivativeAtContinuousIndex
- EvaluateValueAndDerivativeAtContinuousIndex
The first one does take direction cosines into account, the other does
not. When called while using an image with non-trivial direction
cosines, the two derivatives are not equal.
I believe this bug was introduced a long time ago by commit 6abbc7969a90786c4c73f5d191f634db536c2d1d :
http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=6abbc7969a90786c4c73f5d191f634db536c2d1d#patch13
I attached a test program that simply calls the two functions. The input of the test program (set with interpolator->SetInputImage() ) is an image with direction cosines:
(-0, 7.48376e-009, -1, 7.48376e-009, 1, 7.48376e-009, 1, -7.48376e-009, 0)
Current output:
EvaluateDerivative: [42.7697, -9.97885, 22.2913]
EvaluateValueAndDerivative: [-22.2913, -9.97885, 42.7697]
But that should really be the same. Note that the first and third entry are switched, and negated.
I filed a gerrit entry which proposes a fix:
http://review.source.kitware.com/#/c/11016/
After that fix the output is as follows:
EvaluateDerivative: [42.7697, -9.97885, 22.2913]
EvaluateValueAndDerivative: [42.7697, -9.97885, 22.2913]
So, equal as it should be.
Looking forward to your feedback,
Regards, Marius
Marius Staring, PhD
Division of Image Processing (LKEB)
Department of Radiology
Leiden University Medical Center
PO Box 9600, 2300 RC Leiden, The Netherlands
phone: +31 (0)71 526 2137, fax: +31 (0)71 524 8256
m.staring at lumc.nl<mailto:m.staring at lumc.nl>
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130424/f2c34616/attachment.htm>
More information about the Insight-developers
mailing list