[ITK] [ITK-users] Change codes from C++ supported ITK to Python supported ITK
Matt McCormick
matt.mccormick at kitware.com
Sat May 27 11:00:48 EDT 2017
Hi Zhuangming Shen,
For now, we need to reproduce the logic in itkSpatialOrientation.h
[1]. However, I created an issue to expose itk.SpatialOrientation in
Python [2].
Here is an example:
import itk
ITK_COORDINATE_UNKNOWN = 0
ITK_COORDINATE_Right = 2
ITK_COORDINATE_Left = 3
ITK_COORDINATE_Posterior = 4
ITK_COORDINATE_Anterior = 5
ITK_COORDINATE_Inferior = 8
ITK_COORDINATE_Superior = 9
ITK_COORDINATE_PrimaryMinor = 0
ITK_COORDINATE_SecondaryMinor = 8
ITK_COORDINATE_TertiaryMinor = 16
ITK_COORDINATE_ORIENTATION_RIP = ( ITK_COORDINATE_Right <<
ITK_COORDINATE_PrimaryMinor ) \
+ ( ITK_COORDINATE_Inferior <<
ITK_COORDINATE_SecondaryMinor ) \
+ ( ITK_COORDINATE_Posterior <<
ITK_COORDINATE_TertiaryMinor )
ImageType = itk.Image[itk.ctype('unsigned char'), 3]
orienter = itk.OrientImageFilter[ImageType, ImageType].New()
orienter.SetUseImageDirection(True)
orienter.SetDesiredCoordinateOrientation(ITK_COORDINATE_ORIENTATION_RIP)
HTH,
Matt
[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkSpatialOrientation.h
[2] https://issues.itk.org/jira/browse/ITK-3550
On Fri, May 26, 2017 at 11:34 PM, 沈庄明 <zhuangming.shen at sphic.org.cn> wrote:
> Hi all,
>
>
> I don't know how to write
> "itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RIP" in the codes below
> using Python supported ITK. Could someone provide me an example? Thanks in
> advance.
>
>
> itk::OrientImageFilter<ImageType,ImageType>::Pointer orienter =
> itk::OrientImageFilter<ImageType,ImageType>::New();
> orienter->UseImageDirectionOn();
> orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RIP);
> orienter->SetInput(rval);
> orienter->Update();
>
>
> Regards,
>
> Zhuangming Shen
>
>
>
> _____________________________________
> 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
>
_____________________________________
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