Hi Antonio<div><br></div><div>This example will show how to calculate the gradient <a href="http://www.vtk.org/Wiki/ITK/Examples/EdgesAndGradients/GradientRecursiveGaussianImageFilter">http://www.vtk.org/Wiki/ITK/Examples/EdgesAndGradients/GradientRecursiveGaussianImageFilter</a></div>
<div>While this one exemplifies how to traverse a image with iterators: <a href="http://www.vtk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator">http://www.vtk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator</a></div>
<div>In your app you should be traversing a covariant vector image and writing to two different write iterators associated to the gradient component images that you are generating</div><div>(so one iterators is to traverse the source covariant vector image while two additional iterators write the component images)</div>
<div>This other toy example shows how to access the separate components of the covariant vector <a href="http://www.vtk.org/Wiki/ITK/Examples/Math/CovariantVector">http://www.vtk.org/Wiki/ITK/Examples/Math/CovariantVector</a> </div>
<div><br></div><div>Hope to help, best regards</div><div>Sergio<br><br><div class="gmail_quote">2011/9/22 Antonio Gómez Barquero <span dir="ltr"><<a href="mailto:agb1@alu.upct.es">agb1@alu.upct.es</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="ES" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Thanks Sergio!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">I would like to generate separated x and y component as are given in the calculation of the gradient in Matlab. So I would try the second option, but I don’t fully understand “to transverse the convariance vector image”, can anyone give a example with pseudocode or something, please?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Thanks, merci!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Antonio<u></u><u></u></span></p><p class="MsoNormal">
<span lang="EN-US" style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt">De:</span></b><span style="font-size:10.0pt"> Sergio Vera [mailto:<a href="mailto:sergio.vera@alma3d.com" target="_blank">sergio.vera@alma3d.com</a>] <br>
<b>Enviado el:</b> jueves, 22 de septiembre de 2011 10:37<br><b>Para:</b> Antonio Gómez Barquero; itk Users<br><b>Asunto:</b> Re: [Insight-users] x&y component of the gradient of an image<u></u><u></u></span></p><div>
<div></div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><h3><span><span style="font-size:10.0pt;background:white;font-weight:normal">Hello!</span></span><span style="background:white"><u></u><u></u></span></h3>
<h3><span><span style="font-size:10.0pt;background:white;font-weight:normal">With itk::GradientImageFilter you obtain a output image consisting of a covariant vector image with the x and y components...</span></span><span style="background:white"><u></u><u></u></span></h3>
<p class="MsoNormal"><span><span style="background:white">If you want to generate separated x and y components in two different images you can use iterators to traverse the covariant vector image and just copy the x and y values into different images</span><u></u><u></u></span></p>
<h3><span><span style="font-size:9.0pt;background:white;font-weight:normal">regards</span></span><span style="font-size:9.0pt"><u></u><u></u></span></h3><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">2011/9/22 Antonio Gómez Barquero <<a href="mailto:agb1@alu.upct.es" target="_blank">agb1@alu.upct.es</a>><u></u><u></u></p>
<div><div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Hello!</span><u></u><u></u></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US">I would like to calculate the <b>x</b> and <b>y</b> component of the gradient of a 2D image. As in MATLAB is calculated with </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">[dT2,dT1] = gradient(T);</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">ReaderType::Pointer T_g <span style="color:#00B050">// image </span></span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> FilterType::Pointer gradientFilter = FilterType::New();</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> gradientFilter->SetInput( T_g->GetOutput());</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> gradientFilter->Update();</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">With this sentence, I get the result, but I want to have the x-component and the y-component</span><u></u><u></u></p>
<p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">gradientFilter->GetOutput()</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Is there any method to extract it? I am looking for it but I have no positive result!</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Thanks so much</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal">
<span lang="EN-US">Antonio</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span lang="ES-TRAD" style="font-size:8.0pt">Ingeniero de Telecomunicaciones -Becario Investigador asociado a Actividades de I+D+I </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="ES-TRAD" style="font-size:8.0pt">GTTS ( Grupo de Tratamiento y Teoría de la Señal)[ </span><span style="font-size:8.0pt"><a href="http://gtts.upct.es/" target="_blank">http://gtts.upct.es/</a></span><span lang="ES-TRAD" style="font-size:8.0pt">]</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="ES-TRAD" style="font-size:8.0pt">UPCT (Universidad Politécnica de Cartagena)[ </span><span style="font-size:8.0pt"><a href="http://www.upct.es/" target="_blank">http://www.upct.es/</a>]</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><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><u></u><u></u></p></div><p class="MsoNormal">
<br><br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. <a href="tel:%28%2B34%29%20932%20380%20592" value="+34932380592" target="_blank">(+34) 932 380 592</a><br>
<a href="http://www.alma3d.com" target="_blank">www.alma3d.com</a><u></u><u></u></p></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br>
08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com">www.alma3d.com</a><br>
</div>