[vtkusers] dramatic difference in performance btw C++ and python

Dominik Szczerba dominik at itis.ethz.ch
Fri Aug 14 13:01:36 EDT 2009


Many thanks, will give it a try!
- Dominik

Berk Geveci wrote:
> Yes. Use numpy. I can't remember exactly how to do it but it goes like this:
> 
> from vtk.util import numpy_support
> 
> narray = numpy_support.vtk_to_numpy(image.GetPointData().GetScalars())
> # do something with narray
> 
> -berk
> 
> On Fri, Aug 14, 2009 at 9:13 AM, Dominik Szczerba<dominik at itis.ethz.ch> wrote:
>> I am walking my (large) image in C++ with GetScalarPointer and in python
>> with GetComponentAsFloat (pointer stuff not available) and the latter
>> performs dramatically slower. Is there still a way to speed it up?
>>
>> --
>> d o m i n i k   s z c z e r b a ,   p h d . . . . . . . . . . .
>> c o m p u t a t i o n a l   l i f e   s c i e n c e   g r o u p
>> . . . . . . . i t ' i s   r e s e a r c h   f o u n d a t i o n
>> . . . . . . . . . . . . . . . . . . . . http://www.itis.ethz.ch
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
> 


-- 
d o m i n i k   s z c z e r b a ,   p h d . . . . . . . . . . .
c o m p u t a t i o n a l   l i f e   s c i e n c e   g r o u p
. . . . . . . i t ' i s   r e s e a r c h   f o u n d a t i o n
. . . . . . . . . . . . . . . . . . . . http://www.itis.ethz.ch




More information about the vtkusers mailing list