<DIV>Thank you very much Xiaodong,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Following your suggestion, I have tried to convert the versorRigid3DTransform to vtkTransform. But unfortunately, the registration result is not accurate.&nbsp;Please view the registration result on&nbsp;<A href="http://www.geocities.com/tanya_lll/index.html">http://www.geocities.com/tanya_lll/index.html</A>.&nbsp;I hope you can view them. Both images are blended. The MRI image is the fixed image and the PET is the moving one.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The registration code is the same with imageRegistration8. I only change the MeanSquareImageToImageMetric to MattesMutualInformationImageToImageMetric.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Below is my code in the Command Observer:<BR>&nbsp;&nbsp; typedef itk::VersorRigid3DTransform&lt; double &gt; TransformType;&nbsp;&nbsp; <BR>&nbsp;&nbsp; TransformType::Pointer transform = TransformType::New();<BR>&nbsp;&nbsp; transform-&gt;SetParameters(optimizer-&gt;GetCurrentPosition());<BR>&nbsp;&nbsp; TransformType::MatrixType matrix = transform-&gt;GetMatrix();<BR>&nbsp;&nbsp; TransformType::OutputVectorType translation = transform-&gt;GetTranslation();<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; pMatrix = vtkMatrix4x4::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(0,0, matrix[0][0]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(0,1, matrix[0][1]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(0,2, matrix[0][2]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(1,0, matrix[1][0]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(1,1, matrix[1][1]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(1,2, matrix[1][2]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(2,0,
 matrix[2][0]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(2,1, matrix[2][1]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(2,2, matrix[2][2]);<BR>&nbsp; <BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(0,3, translation[0]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(1,3, translation[1]);<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(2,3, translation[2]);</DIV>
<DIV>&nbsp;&nbsp; pMatrix-&gt;SetElement(3,3, 1);//////Matrix[3][3] == 1</DIV>
<DIV>&nbsp;&nbsp; pMatrix-&gt;SetElement(3,0, 0);//////Matrix[3][0] ==&nbsp;0<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(3,1, 0);//////Matrix[3][1] ==&nbsp;0<BR>&nbsp;&nbsp; pMatrix-&gt;SetElement(3,2, 0);//////Matrix[3][2] ==&nbsp;0<BR>&nbsp;&nbsp; pTransform-&gt;SetMatrix(pMatrix);</DIV>
<DIV>&nbsp;</DIV>
<DIV>Maybe you have loose my previous emails, below I wrote again the description of the volumes I register:<BR>- MRI image<BR>Dimension:256, 256, 168<BR>Voxel size(mm): 0.86,0.86, 1.5</DIV>
<DIV>- PET image<BR>Dimension: 128, 128, 94<BR>Voxel size(mm): 2.0, 2.0, 3.0</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank you very much for your kind attention. I would really appreciate any help.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Best regards,<BR>.Tanya.<BR><BR><B><I>"Tao, Xiaodong (Research)" &lt;taox@research.ge.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>Tanya,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>You can try the following in your command observer:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>typedef <SPAN class=268124212-04102005>itk::VersorRigid3DTransform TransformType;</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>TransformType::Pointer transform = TransformType::New();</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>transform-&gt;SetParameter (optimizer-&gt;GetCurrentPosition());</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>TransformType::MatrixType matrix = transform-&gt;GetMatrix();</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>TransformType::TranslationType translation = transform-&gt;GetTranslation();</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>/* use matrix and translation to form a 4x4 homogeneous transformation matrix </SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>&nbsp;&nbsp; vtkmatrix */</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>pTransform -&gt; SetMatrix ( vtkmatrix );</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=268124212-04102005>Xiaodong&nbsp;</SPAN></FONT></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Tanya S [mailto:tanya_lll@yahoo.com]<BR><B>Sent:</B> Tuesday, October 04, 2005 7:36 AM<BR><B>To:</B> Tao, Xiaodong (Research); insight-users@itk.org<BR><B>Subject:</B> RE: [Insight-users] ImageRegistration8 takes 2 hours 45 menit!<BR><BR></FONT></DIV>
<DIV>Thank you Xiaodong, Junyi and Luis,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I change the metric of imageRegistration8 from MeanSquareImageToImageMetric to MattesMutualInformationImageToImageMetric and it runs&nbsp;no more than&nbsp;2 minutes! Thank you very much!</DIV>
<DIV>&nbsp;</DIV>
<DIV>However, I have other problem :(.</DIV>
<DIV>I would like to know how to convert VersorRigid3DTransform to vtkTransform.</DIV>
<DIV>I have displayed the Fixed and the Moving Image using VTK. Now, what I want to do is I would send all the versors and translations from VersorRigid3DTransform to vtkTransform from each iteration of the registration process, so that the Moving Image is moved showing the registration process&nbsp;from each iteration.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have one class that inherits itk::Command and has Execute method. Inside this method, I call:</DIV>
<DIV>&nbsp;</DIV>
<DIV>pTransform-&gt;RotateX(optimizer-&gt;GetCurrentPosition()[0])</DIV>
<DIV>pTransform-&gt;RotateY(optimizer-&gt;GetCurrentPosition()[1])</DIV>
<DIV>pTransform-&gt;RotateZ(optimizer-&gt;GetCurrentPosition()[2])</DIV>
<DIV>pTransform-&gt;Translate(optimizer-&gt;GetCurrentPosition()[3],</DIV>
<DIV>optimizer-&gt;GetCurrentPosition()[4],</DIV>
<DIV>optimizer-&gt;GetCurrentPosition()[5])</DIV>
<DIV>&nbsp;</DIV>
<DIV>pTransform is of type vtkTransform*.</DIV>
<DIV>But this code give wrong transformation.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have also tried to set the optimizer-&gt;GetCurrentPosition() values to vtkMatrix4x4 and then call :</DIV>
<DIV>pTransform-&gt;SetMatrix(theMatrix) </DIV>
<DIV>but this gives me also wrong transformation. "theMatrix" is of type vtkMatrix4x4.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Any hint would be really appreciated.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Best regards,</DIV>
<DIV>.Tanya.</DIV>
<DIV><BR><BR><B><I>Tao, Xiaodong (Research)" &lt;taox@research.ge.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR>
<DIV><FONT face=Arial size=2><SPAN class=472375612-30092005><STRONG>Tanya,</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=472375612-30092005><STRONG></STRONG></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT size=+0><SPAN class=472375612-30092005><FONT face=Arial size=2><STRONG>ImageRegistration8 uses MeanSquaresImageToImageMetric and VersorRigid3DTransform for registration. This combination may work well for images acquired for&nbsp;the same subject using the same modality, in&nbsp;which case,&nbsp;two images&nbsp;can be aligned using a rigid transform (same subject), and corresponding points in the&nbsp;moving image and &nbsp;the fixed image have same intensity (same modality). For your application, you are registering a PET image with an MRI image. You may want to&nbsp;try one of the mutual information based image to image metric to get more accurate result, such as </STRONG></FONT>
<P><FONT face=Arial><FONT size=2><STRONG>itkNormalizedMutualInformationHistogramImageToImageMetri<SPAN class=472375612-30092005>c </SPAN></STRONG><SPAN class=472375612-30092005><STRONG>or </STRONG></SPAN></FONT></FONT><SPAN class=472375612-30092005><FONT face=Arial size=2><STRONG>itkMattesMutualInformationImageToImageMetric</STRONG></FONT></P>
<P><STRONG><SPAN class=472375612-30092005><FONT face=Arial size=2>There are a few examples showing how to used these metrics.</FONT></SPAN></STRONG></P>
<P><STRONG><SPAN class=472375612-30092005><FONT face=Arial size=2>The MeanSquaresImageToImageMetric&nbsp;is also one of the reasons that the program takes long time to run, since at each iterattion, it transforms and interpolates ALL points in the Fixed image region in order to compute the metric. When you use itkNormalizedMutualInformationHistogramImageToImageMetri<SPAN class=472375612-30092005>c </SPAN><SPAN class=472375612-30092005><STRONG>or </STRONG></SPAN><SPAN class=472375612-30092005><FONT face=Arial size=2><STRONG>MattesMutualInformationImageToImageMetric, you can always control the running time by setting the number of samples in the fixed image region for metric computation.</STRONG></FONT></SPAN></FONT></SPAN></STRONG></P>
<P><STRONG><SPAN class=472375612-30092005><FONT face=Arial size=2>If you still want to use <SPAN class=472375612-30092005><FONT face=Arial size=2><STRONG>ImageRegistration8, you can use the PET image (which has fewer voxels than the MRI image) as the fixed image to cut down the running time.</STRONG></FONT></SPAN></FONT></SPAN></STRONG></P>
<P><STRONG><SPAN class=472375612-30092005><FONT face=Arial size=2><SPAN class=472375612-30092005>Xiaodong</SPAN></FONT></SPAN></STRONG></P></SPAN></SPAN></FONT><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> insight-users-bounces+taox=research.ge.com@itk.org [mailto:insight-users-bounces+taox=research.ge.com@itk.org]<B>On Behalf Of </B>Tanya S<BR><B>Sent:</B> Thursday, September 29, 2005 11:34 PM<BR><B>To:</B> Luis Ibanez; insight-users@itk.org<BR><B>Subject:</B> Re: [Insight-users] ImageRegistration8 takes 2 hours 45 menit!<BR><BR></FONT></DIV>
<BLOCKQUOTE>
<DIV>Hi Luis,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have tried to run imageRegistration8 for Release version and it took 21 minutes :((. My machine spesification and the image size&nbsp;are the same as what I wrote on my last email (email attached). </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks beforehand for your answer.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Best regards,</DIV>
<DIV>.Tanya.<BR><BR></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE><p>
                <hr size=1>Yahoo! for Good<br> 
<a href="http://store.yahoo.com/redcross-donate3/">Click here to donate</a> to the Hurricane Katrina relief effort.