<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv1808897040"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-family: 'Times New Roman'; "><pre>Hi David,</pre><pre><br></pre><pre>You can not use the affine transform or any other type of linear</pre><pre><br></pre><pre>or rigid transform to warp an ellipse into a circle since they don't&nbsp;</pre><pre><br></pre><pre>have enough degrees of freedom to induce that kind of deformation.&nbsp;</pre><pre><br></pre><pre>The best choice would be to either B-Spline or kernel (e.g. Elastic body,</pre><pre><br></pre><pre>Thin-Plate Spline) transformation&nbsp;functions.</pre><pre><br></pre><pre>The result with the affine transform is probably worst because during</pre><pre><br></pre><pre>the optimization process the transformation function which has more</pre><pre><br></pre><pre>degrees of freedom comparing
 to the translation function tries to deforms</pre><pre><br></pre><pre>the image to optimize the metric but it only over-deforms the image </pre><pre><br></pre><pre>and stops after predetermined number of iterations.</pre><pre><br></pre><pre>Regards,</pre><pre><br></pre><pre>Dawood</pre><pre><br></pre><pre><br></pre><pre>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</pre><pre><br></pre><pre>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</pre><pre><br></pre><pre><br></pre><pre>I tried adapting the example ImageRegistration2.cxx to use
 an affine
transform instead of a translation transform:

<a href="http://www.itk.org/Wiki/ITK/Examples/Registration/MutualInformationAffine">http://www.itk.org/Wiki/ITK/Examples/Registration/MutualInformationAffine</a>

I create synthetic images (a centered circle for the fixed image and an
uncentered ellipse as the moving image) instead of reading images.

The problem is that the resulting "output.png" (the moving image transformed
by the final transform) is very wrong. Using the translation transform, the
ellipse moves nicely over to the sphere as I would expect. Using the affine
transform, the cylinder image is wildly warped or in a very wrong position.
I tried various LearningRate's and numberOfSamples - the only parameters I
really saw to play with.

I have attached an image of the the fixed and moving images and the output
from the translation only registration.

Any thoughts on how to get it to work with the affine transform? I am kind
of expecting the ellipse to warp into a circle, but I'd at least expect it
to do as well as the translation only.

Thanks,

David</pre></span></span></div></td></tr></table><br>