[ITK-users] [ITK] itk Python: change orientation of CT scan

Timothee Evain tevain at telecom-paristech.fr
Mon Sep 19 04:20:10 EDT 2016


Hello Fabio,

The ResampleImageFilter is the correct way to do it.
I think it's the output origin that fails you. 
The image origin is the most negative coordinate point <=> where the image start.
You want a -90° rotation around X-axis, if X facing toward you (quoting "the y coordinate of the input origin should become the –z coordinate"). So the point that is going to be the new origin is the most negative X,Z and most positive Y in the initial image. Apply the transformation on it and you should have the correct output origin.

The size and spacing should be [SizeX,SizeZ,SizeY] and [SpacingX,SpacingZ,SpacingY] as you already said, and direction should stay the same.

HTH,

Tim


----- Mail original -----
De: "D'Isidoro Fabio" <fisidoro at ethz.ch>
À: insight-users at itk.org
Envoyé: Vendredi 16 Septembre 2016 23:51:32
Objet: [ITK] [ITK-users] itk Python: change orientation of CT scan



Hallo, 



I have a CT scan of a pelvis and I want to re-orient the axes (I need to rotate the physical coordinate system by 90° around the x-axis, with image center as centre of rotation). How could I do it? 



1) Flip Image Filter. However, I will need to generate Digitally Reconstructed Radiographs DRR at different orientations of the CT scan. Hence I would be scared to change the direction cosine matrix, because I don’t really understand what will happen when the CT scan will be further rotated. 



2) A more understable solution would be to use a ResampleImageFilter with transform a CenteredEuler3DTransform. However I get completely lost when I need to assign the origin, the spacing and the size to the output image: 



- Ouptput origin : would be a properly roto-translated version of the input origin, right? Describing with M the roto-translation matrix obtained with the CenteredEuler3DTransform, I would do “resample_filter.SetOutputOrigin(M*input_origin)”. 



- Output spacing : I would need that the input_spacing = (0.7, 0.7, 1.0) would have to become output_ spacing = (0.7, 1.0, 0.7). This would in practice be the clumsy operation “resample_filter.SetOutputSpacing(abs(M*input_ spacing))”. 



- Output size : same as for the origin “resample_filter.SetOutputSize(abs(M*input_ size))”. 



- Output Direction : does it have to be changed at all? My understanding is that it has nothing to do with the transform, because it only defines the way pixel indexes are retrieved from the physical coordinates. So I would not change the OutputDirection for the output image. 



I have read the section 2.9 of the ITK guide (Geometric Transformations), however in all the examples the origin, spacing and size of the output image were arbitrarily chosen independently from the transform. In my case I need to obtain an output image that is consistent with the input image (for example, the y coordinate of the input origin should become the –z coordinate of the output origin and so on). If I arbitrarily choose the output parameters, the output image will be partially black and parts of the pelvis will be cut out. 



Please help, 



Thank you. 



Fabio. 

_____________________________________
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


More information about the Insight-users mailing list