[vtkusers] Voxel Data from MATLAB to VTK

David Gobbi david.gobbi at gmail.com
Mon May 17 12:25:59 EDT 2010

Hi Brian,

It's much easier to use flat arrays to store n-dimensional data in
VTK.  This is how VTK manages structured data such as vtkImageData.
Then all you need to do when moving the data into Matlab is reshape
the flat array into an n-dimensional array by using the known
dimensions of the desired n-dimensional array.

For example, when moving vtkImageData to Python's NumPy, I grab the
Dimensions and NumberOfScalarComponents from the image data and use
that information to reshape the array into a 3D or 4D array.  The same
could be done with Matlab, I think.


On Mon, May 17, 2010 at 10:15 AM, Brian Davis <bitminer at gmail.com> wrote:
> So latest in my search for how to do this I came across:
> http://www.vtk.org/doc/nightly/html/classvtkArrayData.html
> With the important part:
> --snip--
> Because vtkArray cannot be stored as attributes of data objects (yet), a
> "carrier" object is needed to pass vtkArray through the pipeline.
> vtkArrayData  acts as a container of zero-to-many vtkArray instances, which
> can be retrieved via a zero-based index. Note that a collection of arrays
> stored in vtkArrayData  may-or-may-not have related types, dimensions, or
> extents.
> --end snip--
> and looking at the api and input types for ImageData and the volumeMappers
> the input to these appears to only be a route that involves vtkDataSet.  I
> get the feeling that using the Array classes in an attempt to create image
> data is an futile attempt at "round hole square plug" am I correct with this
> assessment?  Array data appears to have a path to filters and not image
> data.  Is this correct?
> Which means I may have to result to awful for loops as in the examples.  I
> also looked at the examples for
> Brian
> _______________________________________________
> 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

More information about the vtkusers mailing list