LoadVoidArray

David Gobbi dgobbi at irus.rri.on.ca
Sun Apr 30 16:52:30 EDT 2000


Hi Randall,

Having a vtkDataArray::LoadVoidArray() method sounds like a good idea,
it would be easy to implement, about 5 extra lines of code to 
vtkDataArray.h.  I don't think that any other classes would have to
be modified.  Want to give it a try?

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Sun, 30 Apr 2000, Randall Hopper wrote:

> David Gobbi:
>  |Randall Hopper:
>  |> Is there a better way to bulk-load floating-point data into VTK from a
>  |> scripting language (without having to loop through every grid cell)?
>  |
>  |Unfortunately no.  The SetVoidArray() method is meant specifically for
>  |moving large chunks of data into VTK.  For image data (including
>  |structured points) you can use the vtkImageImport() class, or even
>  |the vtkImageImportFromArray.py pseudo-class that is in vtk/python.
> 
> Unfortunately this isn't part of an imaging pipeline, so SetVoidArray still
> sounds like my best option (possibly wrapped into a separate class).
> 
>  |For python, in particular, I think that it's best if you hide
>  |any code that uses SetVoidArray() in helper classes like
>  |vtkImageImportFromArray.py.  You also have to be very careful
>  |with the .tostring() method... what guarantees to you have that
>  |Python won't garbage-collect the string before VTK is done with it?
> 
> I saw the caveat about that in the archives.  So I keep the tostring() data
> attached to a data object.  It's a pain, but the best I could do with the
> available methods... (iterating over all cells isn't really an option).
> 
> Rather than cooking a new object for every import case, it seems like what
> we really need is a LoadVoidArray() method that "copies" the data into VTK
> (unlike SetVoidArray) and puts it under a VTK reference count.  The client
> can then dispose of their data block.
> 
> With this, VTK can still remain out-of-the-loop of all the machinizations
> users need to go through to coerce data into VTK format, and at the same
> time still allow users to bulk load data into VTK.
> 
> Thanks,
> 
> Randall
> 
> -- 
> Randall Hopper
> aa8vb at ipass.net
> 

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list