<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">Hi all,<br><br>I would like to do 3D non-rigid registration in with the built in example which is DeformableRegistration16.<br><br>I have modify it a little bit to convert the program to work with 3D following the instruction from Luis.<br><br>However, I would like to further extend this program for my research purpose.<br><br>Let say we input two 3D image, A (target image), B (moving image), I would like to input one more moving image C, <br><br>this C image will not be considered during registration between A and B. C will only be deformed by the same deformation field which is used to deform B. <br><br>Therefore, my concept is only adding a few lines to the original program. It can be built and run probably. <br><br>However, the result I got was two independent registration between A-B and A-C.<br><br>Below is what I added to
 the original image. (the color one) Would any one please help me how to solve this problem? I am sticking with this problem for a while already.<br><br>Thanks all of you in advanced!!<br><br>Please let me know if my question is too confused.<br><br>Thanks!<br>Edwin<br><br><br><br>(some lines are not type here, it is the same with the original one)<br>.......<br><br>&nbsp; // compute the output (warped) image<br>&nbsp; typedef itk::WarpImageFilter&lt; ImageType, ImageType, DeformationFieldType &gt; WarperType;<br>&nbsp; typedef itk::LinearInterpolateImageFunction&lt; ImageType, double &gt; InterpolatorType; <br><br>&nbsp;WarperType::Pointer warper = WarperType::New(); <br><br>&nbsp; InterpolatorType::Pointer interpolator = InterpolatorType::New(); <br><br>&nbsp; ImageType::Pointer targetImage = targetReader-&gt;GetOutput(); <br>&nbsp; warper-&gt;SetInput( sourceReader-&gt;GetOutput() ); <br>&nbsp; warper-&gt;SetInterpolator( interpolator ); <br>&nbsp;
 warper-&gt;SetOutputSpacing( targetImage-&gt;GetSpacing() ); <br>&nbsp; warper-&gt;SetOutputOrigin( targetImage-&gt;GetOrigin() );<br>&nbsp; warper-&gt;SetOutputDirection( targetImage-&gt;GetDirection() );<br>&nbsp; warper-&gt;SetDeformationField( multires-&gt;GetOutput() );<br><br>&nbsp; typedef itk::ImageFileWriter&lt; ImageType &gt;&nbsp; WriterType;<br>&nbsp; WriterType::Pointer writer = WriterType::New();<br>&nbsp; writer-&gt;SetFileName( argv[3] );<br>&nbsp; writer-&gt;SetInput( warper-&gt;GetOutput() );<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><span style="background-color: rgb(255, 127, 0); font-weight: bold;">&nbsp;//&nbsp; Read in the second source image</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><span style="background-color:
 rgb(255, 127, 0);">&nbsp; sourceReader-&gt;SetFileName( argv[5] );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);">&nbsp; sourceReader-&gt;Update();</span><br style="background-color: rgb(255, 127, 0);"><br style="background-color: rgb(255, 127, 0);"><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0); font-weight: bold;">&nbsp; // cast second source to float</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);">&nbsp; sourceImageCaster-&gt;SetInput( sourceReader-&gt;GetOutput() );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0); font-weight:
 bold;">&nbsp;&nbsp;&nbsp; // compute the second output (warped) image</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);">&nbsp; warper-&gt;SetInput( sourceReader-&gt;GetOutput() ); </span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);"></span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);">&nbsp; writer-&gt;SetFileName( argv[6] );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127, 0);">&nbsp; writer-&gt;SetInput( warper-&gt;GetOutput() );</span><br style="background-color: rgb(255, 127, 0);"><span style="background-color: rgb(255, 127,
 0);"></span>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; writer-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; excp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excp &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; // write the deformation field<br>&nbsp; typedef itk::ImageFileWriter&lt; DeformationFieldType &gt;&nbsp; DeformationWriterType;<br>&nbsp; DeformationWriterType::Pointer defwriter = DeformationWriterType::New();<br>&nbsp; defwriter-&gt;SetFileName( argv[4] );<br>&nbsp; defwriter-&gt;SetInput( multires-&gt;GetOutput() );<br><br><br></div></body></html>