[ITK-users] How to write the codes in python?

Matt McCormick matt.mccormick at kitware.com
Thu Nov 5 12:17:16 EST 2015


Hi Zhuangming Shen,

There is some documentation in the ITK Software Guide:

  http://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch3.html#x34-410003.7

Please review this patch, which add notes about .GetTypes() and type conversion:

  http://review.source.kitware.com/20362

Thanks,
Matt

On Thu, Nov 5, 2015 at 1:09 AM, 沈庄明 <zhuangming.shen at sphic.org.cn> wrote:
> Hi Matt,
>
> Thanks for your prompt response. BTW, How can I convert "ImageType::SpacingType spacing" and "ImageType::PointType origin" to Python? Currently, is there a manual or a website (e.g. like http://www.itk.org/Doxygen/html/) for me to get information on ITK using Python? Thanks again.
>
> Regards,
>
> Zhuangming Shen
> ________________________________________
> From: Matt McCormick <matt.mccormick at kitware.com>
> Sent: Wednesday, November 4, 2015 12:52 PM
> To: 沈庄明
> Cc: insight-users at itk.org
> Subject: Re: [ITK-users] How to write the codes in python?
>
> Hello Zhuangming,
>
> Here is a gist:
>
>   https://gist.github.com/thewtex/ce403fef7bc09ca5392d
>
> Note that you should ensure that ITK_WRAP_unsigned_short is ON in your
> CMake configuration.
>
> HTH,
> Matt
>
> On Tue, Nov 3, 2015 at 7:17 PM, 沈庄明 <zhuangming.shen at sphic.org.cn> wrote:
>> Hi all,
>>
>>
>> I'd like to know how to convert Image1.cxx (see codes below) to python,
>> especially "ImageType::RegionType region;". Could anyone give me some hints?
>> Thanks in advance.
>>
>>
>>
>> typedef itk::Image<unsigned short, 3> ImageType;
>>
>> ImageType::Pointer image = ImageType::New();
>>
>>
>> ImageType::IndexType start;
>>
>> start[0] = 0;
>>
>> start[1] = 0;
>>
>> start[2] = 0;
>>
>>
>> ImageType::SizeType size;
>>
>> size[0] = 200;
>>
>> size[1] = 200;
>>
>> size[2] = 200;
>>
>>
>> ImageType::RegionType region;
>>
>> region.SetSize(size);
>>
>> region.SetIndex(start);
>>
>>
>> image->SetRegions(region);
>>
>> image->Allocate();
>>
>>
>>
>> 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
>>


More information about the Insight-users mailing list