Luis,<br><br>Thanks for the great summary. I agree with everything except point 8. I am confident we can come to a solution in the future that will have the correct behaviour but maintain backward compatibility. Realistically, the results of registration may change, but not dramatically I think.<br>
<br>Bill<br><br><div class="gmail_quote">On Fri, Feb 1, 2008 at 3:31 PM, Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt; 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>
<br>
Just to clarify on the status of this problem:<br>
<br>
<br>
1) Today: itkImage accepts, and carries Direction<br>
 &nbsp; &nbsp;but *does not* take it into account when<br>
 &nbsp; &nbsp;converting between indexes and physical points.<br>
<br>
<br>
2) Today: itkOrientedImage accepts, and carries<br>
 &nbsp; &nbsp;Direction *and* takes it into account when<br>
 &nbsp; &nbsp;converting between indexes and physical points.<br>
<br>
<br>
3) Today: Computation of derivatives *by default*<br>
 &nbsp; &nbsp;do not take image direction into account. BUT,<br>
 &nbsp; &nbsp;if you turn the following CMake option ON:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ITK_USE_ORIENTED_IMAGE_DIRECTION<br>
<br>
 &nbsp; &nbsp;Then they will offer the option of<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UseImageDirectionOn / Off<br>
<br>
 &nbsp; &nbsp;*and* if you use them on itkOrientedImages<br>
 &nbsp; &nbsp;then they will compute the derivatives by<br>
 &nbsp; &nbsp;taking orientation into account.<br>
<br>
<br>
4) The comments regarding the inconsistency of<br>
 &nbsp; &nbsp;the API are justified, and we can simply say<br>
 &nbsp; &nbsp;&quot;shame on use&quot; because we failed to retain<br>
 &nbsp; &nbsp;image direction into the image when we removed<br>
 &nbsp; &nbsp;the default affine transform that was originally<br>
 &nbsp; &nbsp;mapping from indexes to points in the very early<br>
 &nbsp; &nbsp;stage of the project.<br>
<br>
<br>
5) Image registration of oriented images can be done<br>
 &nbsp; &nbsp;correctly today in ITK by doing:<br>
<br>
 &nbsp; &nbsp; A) Turn &nbsp;&quot;ITK_USE_ORIENTED_IMAGE_DIRECTION&quot; &nbsp; ON<br>
 &nbsp; &nbsp; B) Using itkOrientedImage instead of itkImage<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...It is not ideal...<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...It is not pretty...<br>
<br>
 &nbsp; &nbsp;But it is the compromise we reached when trying to<br>
 &nbsp; &nbsp;fix the bug and at the same time maintain backward<br>
 &nbsp; &nbsp;compatibility.<br>
<br>
<br>
6) Registration of oriented images is tested Nightly<br>
 &nbsp; &nbsp;in all machines that have the above CMake flag<br>
 &nbsp; &nbsp;turned on. (e.g. Zion, Redwall).<br>
<br>
<br>
<br>
7) This is the behavior that we are planning to<br>
 &nbsp; &nbsp;ship with ITK 3.6.<br>
<br>
<br>
8) If there is enough support from the users community,<br>
 &nbsp; &nbsp;it will be great to fix this the right way in ITK 4.0.<br>
<br>
 &nbsp; &nbsp;[That means that some level of backward compatibility<br>
 &nbsp; &nbsp; may need to be sacrificed in the interest of removing<br>
 &nbsp; &nbsp; the current misleading/inconsistent API]<br>
<br>
<br>
<br>
<br>
 &nbsp; Regards,<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; Luis<br>
<br>
<br>
<br>
--------------------<br>
Rupert Brooks wrote:<br>
&gt; Yes the OrientedImage derivative problem is troublesome.<br>
&gt;<br>
&gt; If your images are small enough, and your transformation is simple<br>
&gt; enough, the easiest way around it is to use an optimizer that does not<br>
&gt; need derivatives. &nbsp;Powell&#39;s would probably be my choice. &nbsp;This<br>
&gt; approach gets slow for any sort of complex problem, unfortunately.<br>
&gt;<br>
&gt; I wrote an Insight Journal paper on the topic that may interest you,<br>
&gt; with some code. &nbsp;I use the classes in it on a daily basis, so i am<br>
&gt; quite confident in them. &nbsp;However, you would have to modify the code<br>
&gt; of your metrics.<br>
&gt; <a href="http://insight-journal.org/midas/handle.php?handle=1926/1293" target="_blank">http://insight-journal.org/midas/handle.php?handle=1926/1293</a><br>
&gt;<br>
&gt; I&#39;ve also been poring over the code for the multithreaded/optimized<br>
&gt; metrics (it is now in the Review directory in CVS) &nbsp;It seems to have a<br>
&gt; general gradient method where the problem probably COULD be corrected.<br>
&gt; (<a href="http://hdl.handle.net/1926/566" target="_blank">http://hdl.handle.net/1926/566</a>)<br>
&gt;<br>
&gt; Please understand, i am just reading, not developing those<br>
&gt; multithreaded metrics, so I cannot say for sure if they correct this<br>
&gt; problem or not. Perhaps someone working on that project can advise.<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Rupert B.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&gt;Date: Fri, 1 Feb 2008 08:17:34 -0500<br>
&gt;&gt;From: &quot;Bill Lorensen&quot; &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt;<br>
&gt;&gt;Subject: Re: [Insight-users] image orientation and registration,<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; current status ?<br>
&gt;&gt;To: &quot;Stefan Klein&quot; &lt;<a href="mailto:stefan@isi.uu.nl">stefan@isi.uu.nl</a>&gt;<br>
&gt;&gt;Cc: <a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>
&gt;&gt;Message-ID:<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; &lt;<a href="mailto:4db4735c0802010517pc6f45bdw7506c29200b1d64d@mail.gmail.com">4db4735c0802010517pc6f45bdw7506c29200b1d64d@mail.gmail.com</a>&gt;<br>
&gt;&gt;Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt;&gt;<br>
&gt;&gt;The gradient problem is being corrected for itkOrientedImage. See:<br>
&gt;&gt;<a href="http://public.kitware.com/Bug/view.php?id=5081" target="_blank">http://public.kitware.com/Bug/view.php?id=5081</a><br>
&gt;&gt;<br>
&gt;&gt;If you need to take into account orientation, you should use<br>
&gt;&gt;itkOrientedImage. Another option is to use itkImage and reorient the series<br>
&gt;&gt;with itkOrientImageFilter so that both series have the same orientation.<br>
&gt;&gt;<br>
&gt;&gt;Bill<br>
&gt;<br>
&gt;<br>
_______________________________________________<br>
Insight-users mailing list<br>
<a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><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>