[Insight-users] Python Numeric requirement

Luis Ibanez luis.ibanez at kitware.com
Fri May 28 08:56:20 EDT 2004


Hi Charl,

Following on this issue, a new CMake variable was
introduced in the configuration:

           ITK_USE_PYTHON_NUMARRAY

This variable is available in "Advanced" mode when
you run CMake. The Numarray headers will be required
only if you enable the variable.  For locating the
headers, the following CMake module is now used:

       Insight/CMake/FindNUMARRAY.cmake

An example on how to pass the itkImage buffer to an
array, and back has been committed under


     Insight/
         Examples/
             DataRepresentation/
                            Image/
                               ImageToArray.py


The code in itkPyBuffer.cxx still needs some work,
the transfer is currently crashing at the moment
of creating the array.... but the good news is that
the configuration should be ok now for not requiring
you to use numarray unless you explicitly ask for it.

Since you may already have the previous INCLUDE
variable for "numeric" in your ITK CMakeCache, it
is probably a good idea to delete it from the cache,
this can be done directly when you run CMake.



   Regards,


     Luis



-----------------
Luis Ibanez wrote:

> 
> Hi Charl,
> 
> Nope, the intention is not to make it a hard requirement.
> 
> It should be just optional. The idea is to make possible
> to take the buffer from an ITK image and pass it to a
> Python array, and viceversa.
> 
> 
> What we want to be able to write is something like
> 
>    reader = itkImageFileReaderUC2_New()
>    reader.SetFileName("toto.png")
>    reader.Update()
>    connector = itkPyBufferUC2_New()
>    parr = connector.GetArrayFromImage( reader.GetOutput() )
> 
> and
> 
>    writer = itkImageFileWriterUC2_New()
>    writer.SetFileName("tata.png")
>    writer.SetInput( connector.GetImageFromArray( parr ) )
>    writer.Update()
> 
> 
> The itkPyBuffer class is now under
> 
> 
>   Insight/Wrapping/CSwig/Common
> 
> 
> 
> We are still working out some configuration issues...
> 
> I'm affraid that by misunderstanding I was taking numeric
> as the most recent package. Thanks for the correction,
> we will change the CMakeLists.txt file for looking for
> "numarray" instead of "numeric". That means that the
> internal code of itkPyBuffer will have to change too.
> 
> 
> 
>   Thanks for pointing this out.
> 
> 
> 
>     Luis
> 
> 
> 
> 
> ------------------------
> Charl P. Botha wrote:
> 
>> Dear list,
>>
>> Is the Python Numeric package now a hard requirement when building ITK 
>> with the Python wrappings (it seems so judging by the relevant 
>> CMakeLists.txt)?  From looking at the web page[1], it also seems that 
>> the numeric package is being phased out in favour of numarray, a new 
>> implementation.  This might be something to take into account.
>>
>> Any more information with regards to this would be much appreciated!
>>
>> Thanks,
>> Charl
>>
>> [1] http://www.pfdubois.com/numpy/
>>
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 





More information about the Insight-users mailing list