<div dir="ltr"><font face="arial, helvetica, sans-serif">Hello Tim,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thank you for your helpful email and sorry for late reply.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Yes, that's right. The size of resampled imageC should be 256x68x256 and imageC should be rotated -pi/2 around the X axis.</font></div><div><font face="arial, helvetica, sans-serif">Now, my first question is: Can I use the direction of imageA as the OutputDirection instead of using Euler3DTransform? Something like this:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"># Direction of imageA: (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)</font></div><div><font face="arial, helvetica, sans-serif"># Direction of imageC: (1.0, 0.0, 0.0, 0.0, -0.0, 1.0, 0.0, -1.0, -0.0)</font></div><div><div><font face="arial, helvetica, sans-serif">resample = sitk.ResampleImageFilter()<br></font></div><div><font face="arial, helvetica, sans-serif">resample.SetTransform(sitk.Transform(3, sitk.sitkIdentity))</font></div><div><font face="arial, helvetica, sans-serif">resample.SetReferenceImage(imageC)</font></div><div><font face="arial, helvetica, sans-serif">resample.SetOutputDirection(imageA.GetDirection()) </font></div><div><font face="arial, helvetica, sans-serif">resample.SetOutputOrigin(imageA.GetOrigin())<br></font></div><div><font face="arial, helvetica, sans-serif">spacingCA = [spacingC[0],spacingC[2],spacingC[1]]</font></div><div><font face="arial, helvetica, sans-serif">resample.SetOutputSpacing(spacingCA)</font></div><div><font face="arial, helvetica, sans-serif">sizeC = imageC.GetSize()<br></font></div><div><font face="arial, helvetica, sans-serif">sizeCA = [sizeC[0], sizeC[2], sizeC[1]]<br></font></div><div><font face="arial, helvetica, sans-serif">resample.SetSize(sizeCA)</font></div><div><font face="arial, helvetica, sans-serif">imageCA=resample.Execute(imageC)</font></div><div><font face="arial, helvetica, sans-serif">sitk.Show(imageCA)</font></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Second, I think I haven't set the correct OutputOrigin for the resampled image because when I compare imageCA with the axial view of imageC (calculated by ImageJ > Stacks> Orthogonal Views), it seems that the resulted imageCA is the translated version of the correct axial view.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I have read the ITK guide chapter 2.9 about transformation and resampling processes but it is still vague to me how one should calculate/select the correct origin for the output image. I would be thankful if you could refer me to any other resources that could be helpful to me in this regard.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thank you in advance.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Best regards,</font></div><div><font face="arial, helvetica, sans-serif">Sara</font></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 27, 2016 at 5:40 AM, Timothee Evain <span dir="ltr"><<a href="mailto:tevain@telecom-paristech.fr" target="_blank">tevain@telecom-paristech.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
First of all, it depends on the patient position in the data, but usually the X axis describe the left/right direction, the Y axis the anterior/posterior direction and the Z axis the top/bottom one.<br>
So I would expect the resampled imageC size to be 256x68x256 rather than 68x256x256.<br>
<br>
Then, I think you should try to transform your imageC to be in the imageA orientation. Let say the imageA have a LPS coordinate system.<br>
If the imageC :<br>
-first direction represents the axis going from the patient's right to the patient's left<br>
-second direction represents the axis going from the patient's top to the patient's bottom<br>
-third direction represents the axis going from the patient's front to the patient's rear<br>
Then you should rotate the imageC by a -pi/2 angle around the X axis.<br>
<br>
You could use the Euler3DTransform to get this rotation.<br>
Then you feed the resample filter with this transform, plus the needed parameters (origin, spacing, size,...), and you should be able to have your resampled data.<br>
Just be sure to fully understand the transformation you're making (I recommend the ResampleImageFilter part of the ITK guide which is quite useful).<br>
<br>
HTH,<br>
<br>
Tim<br>
<br>
<br>
----- Mail original -----<br>
De: "Sara Gh" <<a href="mailto:sg.ele.eng@gmail.com">sg.ele.eng@gmail.com</a>><br>
À: <a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>
Envoyé: Dimanche 26 Juin 2016 07:57:16<br>
Objet: [ITK] [ITK-users] SimpleITK - Resampling Coronal Image in the Axial View<br>
<span class=""><br>
Hello experts,<br>
<br>
I have two MRI scans: Axial and Coronal<br>
# imageA : Axial MRI scan, size : 256x256x56 (256mmx256mmx168mm) , spacing: 1,1,3 ( slice gap : 1 => slice thickness : 2 )<br>
# imageC : Coronal MRI scan, size : 256x256x68 (256mmx256mmx204mm) , spacing: 1,1,3 ( slice gap : 1 => slice thickness : 2 )<br>
<br>
I am trying to view Coronal image from the axial view i.e. resampling Coronal image using the direction of Axial image. Here is my code:<br>
<br>
resample = sitk.ResampleImageFilter()<br>
resample.SetReferenceImage(imageC)<br>
resample.SetOutputDirection(imageA.GetDirection())<br>
resample.SetOutputOrigin(imageA.GetOrigin())<br>
imageCA = resample.Execute(imageC)<br>
sitk.Show(imageCA)<br>
<br>
# Result: imageCA: size : 256x256x68 (256mmx256mmx204mm), spacing: 1,1,3<br>
<br>
</span>I believe I have missed something because, in my idea, the size of resampled coronal image (imageCA) should be 68x256x256 ( 204mmx256mmx256mm) with the spacing [3,1,1] .<br>
<span class=""><br>
I also tried to set the OutputSpacing to [3,1,1], but the size of the imageCA changes to 256x256x68 (768mmx256mmx68mm).<br>
<br>
I would be thankful if someone could help me in this regard.<br>
<br>
Best regards,<br>
Sara Gh<br>
<br>
</span>_____________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>
_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Sara Gharabaghi, Ph.D. Student<div>Graduate Research Assistant</div><div>Advanced Visual Data Analysis (AViDA) Lab</div><div>Biomedical Imaging Lab</div><div>Wright State University </div><div><div style="color:rgb(0,0,0);font-family:Corbel,sans-serif;font-size:16px"><div style="font-size:12pt"><div name="divtagdefaultwrapper"><div name="divtagdefaultwrapper"><br><div><font face="Comic Sans MS, fantasy, cursive" color="#808080" size="2"><br></font></div></div></div></div></div></div></div></div>
</div>