[ITK] [ITK-users] SimpleITK - Resampling Coronal Image in the Axial View
Sara Gh
sg.ele.eng at gmail.com
Tue Jul 12 16:54:25 EDT 2016
Hello Tim,
Thank you for your helpful email and sorry for late reply.
Yes, that's right. The size of resampled imageC should be 256x68x256 and
imageC should be rotated -pi/2 around the X axis.
Now, my first question is: Can I use the direction of imageA as
the OutputDirection instead of using Euler3DTransform? Something like this:
# Direction of imageA: (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
# Direction of imageC: (1.0, 0.0, 0.0, 0.0, -0.0, 1.0, 0.0, -1.0, -0.0)
resample = sitk.ResampleImageFilter()
resample.SetTransform(sitk.Transform(3, sitk.sitkIdentity))
resample.SetReferenceImage(imageC)
resample.SetOutputDirection(imageA.GetDirection())
resample.SetOutputOrigin(imageA.GetOrigin())
spacingCA = [spacingC[0],spacingC[2],spacingC[1]]
resample.SetOutputSpacing(spacingCA)
sizeC = imageC.GetSize()
sizeCA = [sizeC[0], sizeC[2], sizeC[1]]
resample.SetSize(sizeCA)
imageCA=resample.Execute(imageC)
sitk.Show(imageCA)
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.
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.
Thank you in advance.
Best regards,
Sara
On Mon, Jun 27, 2016 at 5:40 AM, Timothee Evain <tevain at telecom-paristech.fr
> wrote:
> Hello,
>
> 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.
> So I would expect the resampled imageC size to be 256x68x256 rather than
> 68x256x256.
>
> 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.
> If the imageC :
> -first direction represents the axis going from the patient's right to the
> patient's left
> -second direction represents the axis going from the patient's top to the
> patient's bottom
> -third direction represents the axis going from the patient's front to the
> patient's rear
> Then you should rotate the imageC by a -pi/2 angle around the X axis.
>
> You could use the Euler3DTransform to get this rotation.
> 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.
> Just be sure to fully understand the transformation you're making (I
> recommend the ResampleImageFilter part of the ITK guide which is quite
> useful).
>
> HTH,
>
> Tim
>
>
> ----- Mail original -----
> De: "Sara Gh" <sg.ele.eng at gmail.com>
> À: insight-users at itk.org
> Envoyé: Dimanche 26 Juin 2016 07:57:16
> Objet: [ITK] [ITK-users] SimpleITK - Resampling Coronal Image in the
> Axial View
>
> Hello experts,
>
> I have two MRI scans: Axial and Coronal
> # imageA : Axial MRI scan, size : 256x256x56 (256mmx256mmx168mm) ,
> spacing: 1,1,3 ( slice gap : 1 => slice thickness : 2 )
> # imageC : Coronal MRI scan, size : 256x256x68 (256mmx256mmx204mm) ,
> spacing: 1,1,3 ( slice gap : 1 => slice thickness : 2 )
>
> 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:
>
> resample = sitk.ResampleImageFilter()
> resample.SetReferenceImage(imageC)
> resample.SetOutputDirection(imageA.GetDirection())
> resample.SetOutputOrigin(imageA.GetOrigin())
> imageCA = resample.Execute(imageC)
> sitk.Show(imageCA)
>
> # Result: imageCA: size : 256x256x68 (256mmx256mmx204mm), spacing: 1,1,3
>
> 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] .
>
> I also tried to set the OutputSpacing to [3,1,1], but the size of the
> imageCA changes to 256x256x68 (768mmx256mmx68mm).
>
> I would be thankful if someone could help me in this regard.
>
> Best regards,
> Sara Gh
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
--
Sara Gharabaghi, Ph.D. Student
Graduate Research Assistant
Advanced Visual Data Analysis (AViDA) Lab
Biomedical Imaging Lab
Wright State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160712/f67b0fb4/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list