[Insight-users] [ITK Community] C# Wrapper for ITK

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jan 2 11:47:32 EST 2014


Hello Zhongliu,

SimpleITK does provide buffer access and per-pixel set get methods. It is designed to expose the algorithms in ITK with an easy to use interface. It's purpose is really designed to expose the building blocks available in ITK that make ITK a robust environment for development new algorithms.

For cases such as you are looking for, going through the layers of Manage and Unmanaged C# code, and the SimpleITK extraction is just too expensive to be done on a per pixel basis.

If your goal to to make available your algorithm in CSharp and you already have it in C++, why not consider wrapping it in SimpleITK?

Its frequently possible to implement algorithms as composites of other filters. With SimpleITK's operator overloading, consider how your algorithm could be implemented by operating on whole images and not at the pixel level.

Please consider your options carefully,
Brad

On Jan 2, 2014, at 11:33 AM, Zhongliu Xie <zhongliu.xie10 at imperial.ac.uk> wrote:

> Dear Brad,
> 
> Thanks for your note. I think I need some example code of using SimpleITK on C#, in particular about how to walk an image region, and for each voxel in the region find a series of offset voxels in its neighbourhood for further processing. Could you give a clue on how to find such example code, and perhaps also examples for other functions? Thanks.
> 
> Regards,
> Zhongliu
> 
> On 02/01/2014 14:44, Bradley Lowekamp wrote:
>> What information are you looking for in a tutorial? Please be specific to guide the writing of a new wiki page. There has been a lot of interest in using SimpleITK with C# recently so, I think a guided wiki page needs to be written.
>> 
>> Here is some generic getting started info:
>> http://www.itk.org/Wiki/SimpleITK/GettingStarted
>> 
>> Here is some pretty detailed information with how to load the CSharp binaries into Visual Studio:
>> http://public.kitware.com/pipermail/community/2013-December/000814.html
>> 
>> Here is a basic example:
>> http://www.itk.org/SimpleITKDoxygen/html/SimpleGaussian_8cs-example.html
>> 
>> Then there are some crude C# tests:
>> https://github.com/SimpleITK/SimpleITK/blob/master/Testing/Unit/CSharpImageTest.cs
>> 
>> The C# interface follows closely with the C++ interface. Here is the SimpleITK doxygen:
>> http://www.itk.org/SimpleITKDoxygen/html/classes.html
>> 
>> Hope that's enough to get you started!
>> Brad
>> 
>> 
>> On Jan 2, 2014, at 9:24 AM, Zhongliu Xie <zhongliu.xie10 at imperial.ac.uk> wrote:
>> 
>>> Thanks very much for your note, Dan.
>>> 
>>> I actually was using ITK on C++ previously and now switching to C#, so my code contains operation with iterators for processing of regions. I guess I would take the advice to use SimpleITK.
>>> 
>>> Then for SimpleITK, is there a tutorial for using it on C#? The ITK Software Guide does not include SimpleITK, and as far as I know most SimpleITK tutorials are python based. Thanks.
>>> 
>>> Regards,
>>> Zhongliu
>>> 
>>> On 30/12/2013 12:36, Dan Mueller wrote:
>>>> Hi Nicholas,
>>>> 
>>>> WrapITK does not currently support C#, and I know of no current plans to do so.
>>>> 
>>>> Even if WrapITK did support C#, iterators would be of little practical use because the cost of transferring from the native language to the wrapped language would incur too great a performance penalty (i.e. it would be too slow).
>>>> 
>>>> I would recommend using SimpleITK. What operation do you need to use iterators? Can you create a custom filter utilising the iterator and wrap that? Or create the desired operation by chaining together existing filters?
>>>> 
>>>> Good luck.
>>>> 
>>>> Cheers, Dan
>>>> 
>>>> On 30 Dec 2013 06:48, "Zhongliu Xie" <zhongliu.xie10 at imperial.ac.uk> wrote:
>>>> 
>>>> Dear fellow ITK users,
>>>> 
>>>> I have been trying to use ITK on C#, but have encountered difficulties.
>>>> For the moment, I have tried Simple ITK which has been a success,
>>>> however as far as I know Simple ITK does not support Iterators.
>>>> Therefore I have been thinking of wrapping ITK for C# environment. I
>>>> have also checked the ManagedITK page at
>>>> http://code.google.com/p/manageditk/, but it says the project is no
>>>> longer under active development, and the "ITK version 4 may include
>>>> internal support for C# wrapping, making ManagedITK unnecessary".
>>>> Therefore I would like to ask what is the latest way to wrap ITK? Does
>>>> anybody have a clue?
>>>> 
>>>> Many thanks,
>>>> Nicholas
>>>> 
>>>> 
>>>> 
>>>> _____________________________________
>>>> 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://www.itk.org/mailman/listinfo/insight-users
>>>> _______________________________________________
>>>> Community mailing list
>>>> Community at itk.org
>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>> 
>>> _____________________________________
>>> 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://www.itk.org/mailman/listinfo/insight-users
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140102/a61da4dc/attachment.htm>


More information about the Insight-users mailing list