<br>Hi Ganesh,<br><br>The code that you are using is producing the <br>deformation field but it is not saving it into a file.<br><br>Please note that the code from this Insight Journal <br>paper was added to ITK a while ago.<br>
<br>You will find it now in<br><br>Insight/Code/Review/<br>     itkDiffeomorphicDemonsRegistrationFilter.h<br>     itkDiffeomorphicDemonsRegistrationFilter.txx<br><br>and<br><br>Insight/Testing/Code/Review<br>   itkDiffeomorphicDemonsRegistrationFilterTest.cxx<br>
   itkDiffeomorphicDemonsRegistrationFilterTest2.cxx<br><br><br><br>The deformation field is actually the output of the<br>DiffeomorphicDemons filter.<br><br>See line 299 of <br><br>   itkDiffeomorphicDemonsRegistrationFilterTest.cxx:<br>
<br>  warper-&gt;SetDeformationField( registrator-&gt;GetOutput() );<br><br><br>and line 206 of <br><br>   itkDiffeomorphicDemonsRegistrationFilterTest2.cxx:<br>
<br>  warper-&gt;SetDeformationField( registrator-&gt;GetOutput() );<br><br><br>Note also that both of these examples are *already*<br>deforming the moving image by applying to it the <br>deformation field via the WarpImageFilter.<br>
<br><br>If you want to save the Deformation field into a file,<br>you just need to add:<br><br>typedef itk::ImageFileWriter&lt; FieldType &gt; FieldWriterType;<br>FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<br>
fieldWriter-&gt;SetFileName(&quot;deformationField.mhd&quot;);<br>fieldWriter-&gt;SetInput( demonsRegistration-&gt;GetOutput() );<br>fieldWriter-&gt;Update();<br><br><br><br>       Regards,<br><br><br>             Luis<br>
<br><br><br>---------------------------------------------------------------------------------<br><div class="gmail_quote">On Fri, Apr 16, 2010 at 11:00 AM, Ganesh Narayanasamy <span dir="ltr">&lt;<a href="mailto:nganesh76@hotmail.com">nganesh76@hotmail.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;">



<div>
<br>Thanks for your suggestions. I have been using 3D-Slicer for viewing the images.<br>What I would like to do is use diffeomorphic demons algorithm developed by Vercauteren T et al. (<a href="http://www.insight-journal.org/browse/publication/154" target="_blank">http://www.insight-journal.org/browse/publication/154</a>) to register a pair of image volumes and apply the resulting deformation onto a 3rd image volume.<br>
The command used for registering images I1, I2 is:<br><br>&gt;DemonsRegistration.exe -f I1.mha -m I2.mha -o OutputI1I2.mha -a 1 -l 0.5 -s 0.8 -i 50x50x50 -d 1<br><br>This command generates these output files:<br> WarpedGridImage.mha<br>
 TransformJacobianDeteminant.mha<br> OutputI1I2.mha<br> ForwardWarpedGridImage.mha<br> and<br> metricvalues.xls<br><br>I can see that WarpedGridImage.mha is the deformation warping grid, but which one of these files is the deformation field ? Is there a way to convert these output mha files into tif format as 3D-Slicer cannot convert some of them?<br>
<br>As stated above, I would like to apply the resulting deformation onto a 3rd image volume, say, I3 and this can be done using WarpImageFilter1.exe. Should the command be like:<br><br>&gt; WarpImageFilter1 I3.mha WarpedGridImage.mha Final.mha<br>
<br>Thank you,<div class="im"><br>Ganesh<br><br><font color="#1f497d" face="Verdana">************************************************************************</font><font color="#1f497d" face="Verdana"><br></font><font color="#1f497d" face="Verdana">
&quot;What the mind of man can conceive and believe, It can achieve&quot; - </font><font color="#1f497d" face="Verdana"><span>Napolean</span></font><font color="#1f497d" face="Verdana"> </font><font color="#1f497d" face="Verdana"><span>Hill</span></font><font color="#1f497d" face="Verdana"><br>
</font><font color="#1f497d" face="Verdana">
-Ganesh 
Narayanasamy,Ph.D., PostDoc-University of Kentucky Cancer Center</font><font color="#1f497d" face="Verdana"><br></font><font color="#1f497d" face="Verdana">
Earlier work: 
<a href="http://www.sciencedaily.com/releases/2007/05/070504133017.htm" target="_blank">http://www.sciencedaily.com/releases/2007/05/070504133017.htm</a></font><font color="#1f497d" face="Verdana"><br></font><font color="#1f497d" face="Verdana">
************************************************************************</font><br> <br></div>&gt; Message: 2<br>&gt; Date: Thu, 15 Apr 2010 21:36:36 -0400<div class="im"><br>&gt; From: Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>&gt;<br>
</div>&gt; Subject: Re: [Insight-users] Deformable transform<br>&gt; To: Ganesh Narayanasamy &lt;<a href="mailto:nganesh76@hotmail.com" target="_blank">nganesh76@hotmail.com</a>&gt;<br>&gt; Cc: <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
&gt; Message-ID:<br>&gt;         &lt;<a href="mailto:g2gf7abd23c1004151836n31198261ze51659653f880167@mail.gmail.com" target="_blank">g2gf7abd23c1004151836n31198261ze51659653f880167@mail.gmail.com</a>&gt;<br>&gt; Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<div>
<div></div><div class="h5"><br>&gt; <br>&gt; Hi Ganesh,<br>&gt; <br>&gt; You may want to use the<br>&gt; <br>&gt; <a href="http://www.itk.org/Doxygen/html/classitk_1_1WarpImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1WarpImageFilter.html</a><br>
&gt; <br>&gt; You may also find useful the &quot;vv&quot; application:<br>&gt; <br>&gt;                    <a href="http://www.creatis.insa-lyon.fr/rio/vv" target="_blank">http://www.creatis.insa-lyon.fr/rio/vv</a><br>&gt; <br>
&gt; It provides functionalities for visualizing the outcome of deformable<br>&gt; registration, including the overlapping of the deformation field.<br>&gt; <br>&gt; <br>&gt;     Regards,<br>&gt; <br>&gt; <br>&gt;           Luis<br>
&gt; <br>&gt; <br>&gt; ------------------------------------------------------------------<br>&gt; On Mon, Apr 12, 2010 at 5:17 PM, Ganesh Narayanasamy<br>&gt; &lt;<a href="mailto:nganesh76@hotmail.com" target="_blank">nganesh76@hotmail.com</a>&gt;wrote:<br>
&gt; <br>&gt; &gt;<br>&gt; &gt; We have 2 sets of 3D-CT data, one from radiotherapy planning CT (call it as<br>&gt; &gt; image I1) and another one is a cone-beam CT on the treatment table (image<br>&gt; &gt; I2). Performing a deformable registration on these gives us a deformation<br>
&gt; &gt; field, say DF.<br>&gt; &gt; I would like to see how the individual structures have deformed between<br>&gt; &gt; image I1 and image I2. The structure that we are interested in (say, S1) is<br>&gt; &gt; masked from image I1 and DF should be applied on it. We would like to see<br>
&gt; &gt; how this structure has deformed in the image I2 (its new form is called say,<br>&gt; &gt; S2).<br>&gt; &gt; Error = || DF(S1) - S2 ||<br>&gt; &gt;<br>&gt; &gt; Can you help me in applying DF onto S1. Probably for a few out there, this<br>
&gt; &gt; is probably trivial. Should I write a new set of code or is there something<br>&gt; &gt; that is already available?<br>&gt; &gt;<br>&gt; &gt; Thanks,<br>&gt; &gt; Ganesh<br>&gt; &gt;<br><br>                                               <br></div>
</div><hr>The New Busy is not the old busy. Search, chat and e-mail from your inbox. <a href="http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3" target="_blank">Get started.</a></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>