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>------------------------------------------------------------<br>
<div class="gmail_quote">On Fri, Oct 15, 2010 at 9:51 AM, Arunachalam Kana <span dir="ltr">&lt;<a href="mailto:Kana.Arunachalam@fh-wels.at">Kana.Arunachalam@fh-wels.at</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">









<div link="blue" vlink="purple" lang="DE-AT">

<div>

<p class="MsoNormal">Dear ITK Users,</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"><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></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">typedef</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">
itk::DerivativeImageFilter&lt;CastImageType,CastImageType&gt;
DerivativeFilterType;</span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"> </span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;" lang="EN-GB">//create First
derivative in X direction</span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DerivativeFilterType::Pointer DXfilter =
DerivativeFilterType::New();</span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DXfilter-&gt;SetInput(inputimage);</span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DXfilter-&gt;SetDirection(0);</span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DXfilter-&gt;SetOrder(1);</span></p>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">DXfilter-&gt;Update();</span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">The following are the grayvalue of indics:</span></p>

<p class="MsoNormal"><span lang="EN-GB">Gray value at index [9,31,11] = 20850</span></p>

<p class="MsoNormal"><span lang="EN-GB">Gray value at index [10,31,11] = 22923</span></p>

<p class="MsoNormal"><span lang="EN-GB">Gray value at index [11,31,11] = 22923</span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">Manual calculation of DX at index [10,31,11]
 = 22923 – 20850 = 2073</span></p>

<p class="MsoNormal"><span lang="EN-GB">The filter calculation of DX at index [10,31,11]
 = 518.25 </span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal" style=""><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></p>

<p class="MsoNormal"><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></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">Thank you,</span></p>

<p class="MsoNormal"><span lang="EN-GB"> </span></p>

<p class="MsoNormal"><span lang="EN-GB">Regards,</span></p>

<p class="MsoNormal"><span lang="EN-GB">Kana Arunachalam Kannappan</span></p>

<p class="MsoNormal">Research Associate</p>

<p class="MsoNormal">FH OÖ Forschungs &amp; Entwicklungs GmbH</p>

<p class="MsoNormal">Stelzhamer Strasse 23,</p>

<p class="MsoNormal">4600 Wels,</p>

<p class="MsoNormal">Austria.</p>

<p class="MsoNormal">Phone: +43 (0)7242 72811 -4420</p>

<p class="MsoNormal"><a href="mailto:kana.arunachalam@fh-wels.at" target="_blank">kana.arunachalam@fh-wels.at</a></p>

<p class="MsoNormal"><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></p>

<p class="MsoNormal"> </p>

</div>

</div>


<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><br>
<br></blockquote></div><br>