Try subclassing itk::ImageFunction and write a function to compute the divergence at a given voxel. It should be relatively staightforward. If you use VTK, you can use the class vtkImageDivergence to accomplish this.<br><br>
That said, you seem to be taking the divergence of the gradient, which is nothing but the laplacian. There is a class in ITK to compute the laplacian directly : itk::LaplacianImageFilter. You method seems a little convoluted.<br>
<br><br>-- <br>Karthik Krishnan<br>R&amp;D Engineer,<br>Kitware Inc.<br>Ph: 518 881 4919<br>Fax: 518 371 4573<br><br><br><div class="gmail_quote">On Sun, Mar 29, 2009 at 4:20 PM, A.Burak Yoldemir <span dir="ltr">&lt;<a href="mailto:yoldemir@gmail.com">yoldemir@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello all,<br><br>I am currently trying to simulate linear isotropic diffusion, which requires taking the divergence of the gradient of an image. To compute the gradient, I used the GradientRecursiveGaussianImageFilter and separated the covariant vectors in different directions using VectorIndexSelectionCastImageFilter. Now, I need to take the divergence of the resulting vector field, however I could not find a way to accomplish this. I have seen that it was formerly suggested to modify VectorGradientMagnitudeFilter but I could not find out how to do that. Can anyone provide me some pointers?<br>


<br>Thanks in advance,<br><br clear="all">Ahmet Burak Yoldemir<br>
<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>
Please keep messages on-topic and check the ITK FAQ at: <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><br clear="all"><br>