[Insight-developers] SimpleITK - Image::GetPixel methods

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Apr 26 21:41:17 EDT 2011


Great! 

I know I was doing things not quite right there!


On Apr 26, 2011, at 5:36 AM, Gaëtan Lehmann wrote:
> 
> 
> It would be interesting to look at the GetPixel() performance - if it is a lot slower than the specialized versions, then it may be better to not hide the specialized versions, for the users who wants to write faster code.

Is your concern that the cost of all the if statements will be too great? I have seen switch like statements implemented with dictionaries. This should reduce the switch statement from cost of N to logN or perhaps they are implemented with a hash... either way N is only 8, and it should be an interesting comparison.

The current implementation in sitkImage is  that the correct set/get methods is required to be call or else and exception will be thrown. For strongly typed languages like C++ or Java this will be a pain, for for the implementation we have discussed here in python or other scripting languages, should be pretty easy to use.


On another note, what do you think of implementing the iteration hidden function in python for the simpleITK Image?

Brad 

> 
> Gaëtan
> 
> 
> 
> 
> Le 22 avr. 11 à 22:25, Bradley Lowekamp a écrit :
> 
>> Gaetan,
>> 
>> You have provided valuable feedback with several other python related issues and was looking for comments on the current.
>> 
>> Despite it sounding easy, implementing the sitk::Image::GetPixel method is rather challenging due to the numerous types of images underneath. I have a branch in my SimpleITK github, which will add this much needed feature.
>> 
>> The sitk::Image class will be customized for each language to provide a natural interface. This is what I have done for python:
>> 
>> https://github.com/blowekamp/SimpleITK/commit/b821617f013ee18c7cc2ae727eec3d20ad2b5875
>> 
>> I realize now it needs some comments....
>> 
>> It is not clear to me if the index argument should be multiple arguments or an array, or both. As arguments are not strongly typed, I am not certain of how to do methods overloading, based on the arguments. In another methods I used isinstance(), but some frown about that. Do you have a suggestion on how I should overload methods in python? What do you think of this current interface?
>> 
>> Brad
>> 
>> ========================================================
>> Bradley Lowekamp
>> Lockheed Martin Contractor for
>> Office of High Performance Computing and Communications
>> National Library of Medicine
>> blowekamp at mail.nih.gov
>> 
>> 
> 
> -- 
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr  http://www.itk.org
> http://www.mandriva.org  http://www.bepo.fr
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110426/bff05a34/attachment.htm>


More information about the Insight-developers mailing list