<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=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {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";}
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.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:36.0pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
.MsoPapDefault
        {mso-style-type:export-only;
        mso-margin-top-alt:auto;
        mso-margin-bottom-alt:auto;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:52390121;
        mso-list-type:hybrid;
        mso-list-template-ids:-934798112 338206046 201785369 201785371 201785359 201785369 201785371 201785359 201785369 201785371;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:35.85pt;
        text-indent:-18.0pt;}
@list l1
        {mso-list-id:993097374;
        mso-list-type:hybrid;
        mso-list-template-ids:-1198616148 201785359 201785369 201785371 201785359 201785369 201785371 201785359 201785369 201785371;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2
        {mso-list-id:1383944075;
        mso-list-type:hybrid;
        mso-list-template-ids:-604332704 526688358 201785369 201785371 201785359 201785369 201785371 201785359 201785369 201785371;}
@list l2:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:35.85pt;
        text-indent:-18.0pt;}
-->
</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=DE-AT link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormalCxSpFirst><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>Hi ITK Team and Luis,<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>To Luis: I am sorry to send a
reply directly to your email instead of <a href="mailto:insight-user@itk.org">insight-user@itk.org</a>.
<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>Your explanation for
derivative calculation was clear. <o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [8,31,11] = 16951<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [9,31,11] =
20850<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [10,31,11] =
22923<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [11,31,11] =
22923<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [12,31,11] =
20850<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpLast><span lang=EN-GB style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:#1F497D'>My next step was to check whether there Is
any difference in calculating second order derivative using below 2 methods:<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span
lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>
</span></span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>Using itkDerivativeImagefilter
: set order=2; direction=0; code below<o:p></o:p></span></p>
<p class=MsoNormalCxSpFirst style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DerivativeFilterType::Pointer
DXXfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter->SetInput(inputimage);<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter->SetDirection(0);<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter->SetOrder(2);<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpLast style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXX value at [10,31, 11] =
-1036.5<o:p></o:p></span></p>
<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span
lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>
</span></span></span><![endif]><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>Using
itkDerivativeImagefilter and apply filter 2 time in same direction. Code below<o:p></o:p></span></p>
<p class=MsoListParagraphCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>DerivativeFilterType::Pointer DXfilter =
DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoListParagraphCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>DXfilter->SetInput(inputimage);<o:p></o:p></span></p>
<p class=MsoListParagraphCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>DXfilter->SetDirection(0);<o:p></o:p></span></p>
<p class=MsoListParagraphCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>DXfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoListParagraphCxSpLast><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>DXfilter->Update();</span><span lang=EN-GB><o:p></o:p></span></p>
<p class=MsoNormalCxSpFirst style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DerivativeFilterType::Pointer
DXXfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter ->SetInput(DXfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter ->SetDirection(0);<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter ->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:35.4pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXXfilter ->Update();</span><span
lang=EN-GB><o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>DXX value at [10,31, 11] = -502.813
(value is correct as per formula given by Luis in email below)<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>After seeing the result i am
bit confused. Why is there a difference in values between two methods?<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpMiddle style='text-indent:17.85pt'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>Thank you,<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>Regards,<o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>Kana <o:p></o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormalCxSpMiddle><b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Luis Ibanez
[mailto:luis.ibanez@kitware.com] <br>
<b>Sent:</b> 16 October 2010 21:39<br>
<b>To:</b> Arunachalam Kana<br>
<b>Cc:</b> insight-users@itk.org<br>
<b>Subject:</b> Re: [Insight-users] Doubt in derivative calculation using
itkDerivativeImageFilter<o:p></o:p></span></p>
</div>
<p class=MsoNormalCxSpMiddle><o:p> </o:p></p>
<p class=MsoNormalCxSpMiddle>Hi Kana,<br>
<br>
It looks like you are not taking the spacing <br>
of the image into account when you compute<br>
the derivatives manually.<br>
<br>
The manual derivative computation should be:<br>
<br>
<span lang=EN-GB> ( 22923 – 20850 ) / (2.0 x spacingAlongX </span>)<br>
<br>
that is:<br>
<br>
f( i+1) - f( i- 1 ) / ( 2 Dx )<br>
<br>
So, I would guess that you image as an<br>
spacing along X that is equal to: 2.0.<br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
------------------------------------------------------------<o:p></o:p></p>
<div>
<p class=MsoNormalCxSpMiddle>On Fri, Oct 15, 2010 at 9:51 AM, Arunachalam Kana
<<a href="mailto:Kana.Arunachalam@fh-wels.at">Kana.Arunachalam@fh-wels.at</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p class=MsoNormalCxSpMiddle>Dear ITK Users,<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle> <o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>I have a small doubt while I
compare the itkDerivativeImageFilter result with manually calculated
derivative. The code below for itkDerivativeImageFilter:</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New";color:blue'>typedef</span><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>
itk::DerivativeImageFilter<CastImageType,CastImageType>
DerivativeFilterType;</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'> </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New";color:green'>//create First derivative in X direction</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span style='font-size:10.0pt;font-family:"Courier New"'>DerivativeFilterType::Pointer
DXfilter = DerivativeFilterType::New();</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span style='font-size:10.0pt;font-family:"Courier New"'>DXfilter->SetInput(inputimage);</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span style='font-size:10.0pt;font-family:"Courier New"'>DXfilter->SetDirection(0);</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span style='font-size:10.0pt;font-family:"Courier New"'>DXfilter->SetOrder(1);</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span style='font-size:10.0pt;font-family:"Courier New"'>DXfilter->Update();</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB> </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>The following are the grayvalue
of indics:</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [9,31,11] =
20850</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [10,31,11] =
22923</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Gray value at index [11,31,11] =
22923</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB> </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Manual calculation of DX at index
[10,31,11] = 22923 – 20850 = 2073</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>The filter calculation of DX at
index [10,31,11] = 518.25 </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB> </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>I have a doubt in how the filter
calculates the derivative. When I read the manual it said “A derivative
at pixel index i = ( j,k), for example, is taken as a weighted</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>difference of the values at (
j+1,k) and ( j</span><span lang=EN-US>−</span><span lang=EN-GB>1,k).” . I would
like to know how is the weighted difference of the values is calculated and is
it ok to calculated the weighted difference ?</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB> </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Thank you,</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB> </span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Regards,</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><span lang=EN-GB>Kana Arunachalam Kannappan</span><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>Research Associate<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>FH OÖ Forschungs & Entwicklungs GmbH<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>Stelzhamer Strasse 23,<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>4600 Wels,<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>Austria.<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle>Phone: +43 (0)7242 72811 -4420<o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><a href="mailto:kana.arunachalam@fh-wels.at"
target="_blank">kana.arunachalam@fh-wels.at</a><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle><a href="http://www.fh-ooe.at" target="_blank">www.fh-ooe.at</a>;
<a href="http://www.3dct.at" target="_blank">www.3dct.at</a><o:p></o:p></p>
<p class=MsoNormalCxSpMiddle> <o:p></o:p></p>
</div>
</div>
<p class=MsoNormalCxSpMiddle><br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><o:p></o:p></p>
</div>
<p class=MsoNormalCxSpLast><o:p> </o:p></p>
</div>
</body>
</html>