<br>Hi Sharath,<br><br>If you are interested in Affine registration you should probably <br>start with ImageRegistration9.cxx instead of modifying <br>ImageRegisration2.cxx.<br><br>In particular, you are probably missing to set up the <br>
ParameterScaling array, which is critical for normalizing the<br>dynamic range of the different Transform parameters.<br><br>This was not critical for the case of the Translation Transform,<br>but it becomes very important in Rigid and Affine transforms.<br>
<br><br>Please study the ImageRegistration9.cxx example and <br>let us know if you have any questions.<br><br><br>       Thanks<br><br><br>             Luis<br><br><br>----------------------------------------------------<br>
<div class="gmail_quote">On Tue, Jun 23, 2009 at 7:44 PM, sharath v <span dir="ltr">&lt;<a href="mailto:sharath20284@yahoo.com">sharath20284@yahoo.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;">
<br>
Hi,<br>
<br>
I am trying to run example ImageRegistration2 with Affine Transform. This example uses originally used Mutual Information based registration with Translation.<br>
<br>
I extended by using AffineTransform, and used the  CenteredTransformInitializer for initialization ( according to example ImageRegistration9, which uses Affine with MeanSquares optimizer)<br>
<br>
But, I do run into errors.<br>
<br>
For the CenteredTransformInitializer, I use the following piece of code<br>
<br>
typedef itk::CenteredTransformInitializer&lt; TransformType,  FixedImageType,  MovingImageType &gt;  TransformInitializerType;<br>
    TransformInitializerType::Pointer initializer = TransformInitializerType::New();<br>
    initializer-&gt;SetTransform(   transform );<br>
    initializer-&gt;SetFixedImage(  fixedImageReader-&gt;GetOutput() ); //*******<br>
    initializer-&gt;SetMovingImage( movingImageReader-&gt;GetOutput() ); //*******<br>
    initializer-&gt;MomentsOn();<br>
<br>
    initializer-&gt;InitializeTransform();<br>
    registration-&gt;SetInitialTransformParameters(transform-&gt;GetParameters() );<br>
<br>
The program runs into completion, but gives WRONG values for scale and rotation parameters. The translation parameters obtained are correct.<br>
<br>
If I change the starred lines (above in the code) to the take the output of the  fixedSmoother and movingSmoother respectively ( which I think is correct, as they are output of the smoothing function in example2) , I get an exception<br>

<br>
***** Description: itk::ERROR: MutualInformationImageToImageMetric(012D3058): All the sampled point mapped  to outside of the moving image<br>
<br>
I have tried the same with Mattes Mutual Information example, to get the same exception.<br>
<br>
I have also used the appropriate scale setting code as in example 9.<br>
<br>
<br>
<br>
Thanks in advance for the help,<br>
<br>
Sharath Venkatesha<br>
<br>
<br>
<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>
</blockquote></div><br>