[Insight-users] ITK Python Wrapping Examples

Luis Ibanez luis . ibanez at kitware . com
Thu, 31 Jul 2003 10:42:37 -0400


Charl,

After looking closer at the conflict between the two GetElement()
methods in itkArray.h it seems that the best way to go is to simply
remove the non-const version of GetElement().  The functionality
is already provided by the SetElement() method.

As Brad pointed out, we should encourage the use of

      array.SetElement( 10, value );

as oppossed to

      array.GetElement( 10 ) = value;

So, we are voting for removing the method:

 >
>  TValueType & GetElement( unsigned int i )
>      { return this->operator[]( i ); }
>

in line 70 of itkArray.h


Would you like to give it a try to build with this
method removed ?


   Thanks


   Luis



--------------------
Brad King wrote:
>>At a second glance, if the two GetElement() declarations in itkArray.h
>>are simply swapped around, the wrapped GetElement() that is chosen by
>>the overloaded method resolver in SWIG should be the const one (because
>>its first and there are no other parameter differences to resolve with)
>>and its result will be a Python float and not a _double_p.
>>GetElement()  in Python will then just return a number.
>>
>>Are there any opinions with regards to this?  Should these two
>>declarations be swapped if this would be the end result?  It looks like
>>a win-win to me.
> 
> 
> Go ahead and swap them.
> 
> -Brad
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>