The latest I found suports using flat arrays as you suggest and as I tried to do and reshaping with and example I found at:<br><br><div class="gmail_quote"><a href="http://www.kitware.com/InfovisWiki/index.php/Matlab_Interface">http://www.kitware.com/InfovisWiki/index.php/Matlab_Interface</a><br>
<br>The vtkMatlabMexAdapter looks exactly like what I am looking for<br><br>--snip<br><br> edata = vtkMatlabMexAdapter::mxArrayTovtkDataArray(const_cast<mxArray*>(prhs[0]));<br><br> id->SetDimensions(300,300,1);<br>
id->SetOrigin(0.0,0.0,0.0);<br> id->SetSpacing(1.0,1.0,1.0);<br> id->SetScalarTypeToUnsignedChar();<br> id->SetNumberOfScalarComponents(3);<br> id->SetWholeExtent(0,299,0,299,0,0);<br><br> id->GetPointData()->SetScalars(edata);<br>
<br>--end snip--<br><br>However a search in my tree vtkMatlabMexAdapter returns nothing. Seems to be a part of Titan?<br><br>Though it looks as thought it is in latest:<br><br><a href="http://www.vtk.org/doc/nightly/html/classvtkMatlabMexAdapter.html">http://www.vtk.org/doc/nightly/html/classvtkMatlabMexAdapter.html</a><br>
<br><br>Brian<br><br><br>On Mon, May 17, 2010 at 11:25 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Brian,<br>
<br>
It's much easier to use flat arrays to store n-dimensional data in<br>
VTK. This is how VTK manages structured data such as vtkImageData.<br>
Then all you need to do when moving the data into Matlab is reshape<br>
the flat array into an n-dimensional array by using the known<br>
dimensions of the desired n-dimensional array.<br>
<br>
For example, when moving vtkImageData to Python's NumPy, I grab the<br>
Dimensions and NumberOfScalarComponents from the image data and use<br>
that information to reshape the array into a 3D or 4D array. The same<br>
could be done with Matlab, I think.<br>
<br>
David<br>
<div><div></div><div class="h5"><br>
<br>
On Mon, May 17, 2010 at 10:15 AM, Brian Davis <<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>> wrote:<br>
> So latest in my search for how to do this I came across:<br>
><br>
> <a href="http://www.vtk.org/doc/nightly/html/classvtkArrayData.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkArrayData.html</a><br>
><br>
> With the important part:<br>
><br>
> --snip--<br>
> Because vtkArray cannot be stored as attributes of data objects (yet), a<br>
> "carrier" object is needed to pass vtkArray through the pipeline.<br>
> vtkArrayData acts as a container of zero-to-many vtkArray instances, which<br>
> can be retrieved via a zero-based index. Note that a collection of arrays<br>
> stored in vtkArrayData may-or-may-not have related types, dimensions, or<br>
> extents.<br>
> --end snip--<br>
><br>
> and looking at the api and input types for ImageData and the volumeMappers<br>
> the input to these appears to only be a route that involves vtkDataSet. I<br>
> get the feeling that using the Array classes in an attempt to create image<br>
> data is an futile attempt at "round hole square plug" am I correct with this<br>
> assessment? Array data appears to have a path to filters and not image<br>
> data. Is this correct?<br>
><br>
> Which means I may have to result to awful for loops as in the examples. I<br>
> also looked at the examples for<br>
><br>
> Brian<br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</blockquote></div><br><br clear="all"><br>-- <br>Brian J. Davis<br><br>