<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=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</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="EN-US" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp; I am trying to save the deformation field from some images and the apply the same deformation field on another set of images. For saving the deformation field I am using a file write and
 saving it as .mhd file as given in the example DeformableRegistration5.cxx<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#002060"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; typedef itk::ImageFileWriter&lt; DeformationFieldType &gt; FieldWriterType;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; fieldWriter-&gt;SetFileName(&#8220;DeformationFieldBuffer.mhd&#8221;);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; fieldWriter-&gt;SetInput( filter-&gt;GetDeformationField() ); ///</span><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">here filter is LevelSetMotionRegistrationFilter
 type <o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; DeformationFieldType::Pointer deformationMap = filter-&gt;GetDeformationField();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">&nbsp; fieldWriter-&gt;Update();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">&nbsp;Then I am trying to apply the same on another image as following here reader is imagefilereader for an image of type .mha.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;">&nbsp;
<span style="color:#002060">warper1-&gt;SetInput( reader-&gt;GetOutput() );<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; warper1-&gt;SetInterpolator( interpolator1 );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; warper1-&gt;SetOutputSpacing( reader-&gt;GetOutput()-&gt;GetSpacing() );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; warper1-&gt;SetOutputOrigin( reader-&gt;GetOutput()-&gt;GetOrigin() );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; warper1-&gt;SetDeformationField(deformationMap);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp; warper1-&gt;Update();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp;&nbsp; typedef itk::ImageFileWriter&lt; ImageType &gt; WriterType;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp;&nbsp; WriterType::Pointer writer = WriterType::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp;&nbsp; writer-&gt;SetFileName(&quot;Result.mha&quot;&nbsp; );<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#002060">&nbsp;&nbsp; writer-&gt;SetInput( warper1-&gt;GetOutput()&nbsp;&nbsp; );<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#002060">&nbsp;&nbsp; &nbsp;writer-&gt;Update();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">The update fails for warper1 as well as writer. I want to know how can I implement this? Can I use the Image
</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">DeformationFieldBuffer.mhd
</span><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">for setting the deformation field for</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">
</span><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">the test image and for that whether I need to create another filter?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Rejitha<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified
 that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.<br>
</font>
</body>
</html>