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

Matt McCormick matt.mccormick at kitware.com
Fri Nov 6 10:49:00 EST 2015


Hi,

Yes, some of the Python examples in the ITK repository have been
updated for ITK 4.9 in Git master.  But, more examples with Python
versions should be added to http://itk.org/ITKExamples/index.html
going forward.

Thanks,
Matt




On Fri, Nov 6, 2015 at 3:22 AM, 沈庄明 <zhuangming.shen at sphic.org.cn> wrote:
> Hi Matt,
>
> Thank you so much. By the way,the Python examples in InsightToolkit-4.8.1.tar.gz are out of date.  I currently could find a few Python examples supporting ITK 4.x from http://itk.org/ITKExamples/index.html.  Are there more examples available at the moment? Thanks again.
>
> Regards,
>
> Zhuangming Shen
> ________________________________________
> From: Matt McCormick <matt.mccormick at kitware.com>
> Sent: Friday, November 6, 2015 1:17 AM
> To: 沈庄明
> Cc: insight-users at itk.org
> Subject: Re: [ITK-users] How to write the codes in python?
>
> 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