<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Dear all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The BSplineInterpolateImageFunction class has two functions to compute<br>
the derivative:<br>
- EvaluateDerivativeAtContinuousIndex<br>
- EvaluateValueAndDerivativeAtContinuousIndex<o:p></o:p></p>
<p class="MsoNormal">The first one does take direction cosines into account, the other does<br>
not. When called while using an image with non-trivial direction<br>
cosines, the two derivatives are not equal.<o:p></o:p></p>
<p class="MsoNormal">I believe this bug was introduced a long time ago by commit 6abbc7969a90786c4c73f5d191f634db536c2d1d :<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><a href="http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=6abbc7969a90786c4c73f5d191f634db536c2d1d#patch13">http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=6abbc7969a90786c4c73f5d191f634db536c2d1d#patch13</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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:<o:p></o:p></p>
<p class="MsoNormal">(-0, 7.48376e-009, -1, 7.48376e-009, 1, 7.48376e-009, 1, -7.48376e-009, 0)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Current output:<o:p></o:p></p>
<p class="MsoNormal">EvaluateDerivative: [42.7697, -9.97885, 22.2913]<o:p></o:p></p>
<p class="MsoNormal">EvaluateValueAndDerivative: [-22.2913, -9.97885, 42.7697]<o:p></o:p></p>
<p class="MsoNormal">But that should really be the same. Note that the first and third entry are switched, and negated.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I filed a gerrit entry which proposes a fix:<o:p></o:p></p>
<p class="MsoNormal"><a href="http://review.source.kitware.com/#/c/11016/">http://review.source.kitware.com/#/c/11016/</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">After that fix the output is as follows:<o:p></o:p></p>
<p class="MsoNormal">EvaluateDerivative: [42.7697, -9.97885, 22.2913]<o:p></o:p></p>
<p class="MsoNormal">EvaluateValueAndDerivative: [42.7697, -9.97885, 22.2913]<o:p></o:p></p>
<p class="MsoNormal">So, equal as it should be.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Looking forward to your feedback,<o:p></o:p></p>
<p class="MsoNormal">Regards, Marius<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">Marius Staring, PhD<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Division of Image Processing (LKEB)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Department of Radiology<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Leiden University Medical Center<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">PO Box 9600, 2300 RC Leiden, The Netherlands<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">phone: +31 (0)71 526 2137, fax: +31 (0)71 524 8256<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">m.staring@lumc.nl<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>