<html><head><base href="x-msg://43/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Ryan,<div><br></div><div>Maybe someone else will have a better suggestion, but when I need to view Matlab data using VTK classes, I work in python. If you haven't used python then the following will probably be gibberish, but...</div><div><br></div><div>The scipy.io.loadmat() function can read old (pre-v7.3) .mat files into structures that contain numpy arrays. If you're using the newer HDF5-based .mat file format, then pytables can navigate through the hierarchical file and read in (numpy) arrays. </div><div><br></div><div>VTK has support for converting both directions between numpy arrays and VTK data arrays (vtkIntArray, vtkFloatArray, etc) in vtk.util.numpy_support [numpy_to_vtk() & vtk_to_numpy()]. You can then build whatever type of vtkDataSet you need (vtkImageData, maybe?) right there in python and assign the values you've read from your matlab arrays as attributes of the VTK structure and start building your VTK visualization pipeline from there.</div><div><br></div><div>Otherwise, your best bet may be to try to write your data out from Matlab as an ascii-format legacy VTK file, or some other format VTK can read natively, and load that file directly into your VTK pipeline.</div><div><br></div><div>Hope this helps. If you need a C++ solution for reading Matlab files someone else will have to chime in.</div><div><br></div><div>-Eric</div><div> </div><div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>------------------------------------------------------</div><div>Eric E Monson</div><div>Duke Visualization Technology Group</div><div><span class="Apple-style-span" style="font-size: medium;"><br></span></div></span>
</div>
<br><div><div>On Jan 20, 2010, at 6:53 AM, Ryan Bloor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; "><br> <br><hr id="stopSpelling">From:<span class="Apple-converted-space"> </span><a href="mailto:ryanbloor@hotmail.com">ryanbloor@hotmail.com</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>Subject: vtk dataset import<br>Date: Wed, 20 Jan 2010 11:30:19 +0000<br><br>Hello,<span class="Apple-converted-space"> </span><br><br>I am wondering whether VTK provides functionality to read in .mat dataset files. I currently have three files corresponding to the three primary eigenvectors and would like to load them into VTK and view some 2D slices to make sure it has worked. The data files are quite large so I cannot upload them unfortunately.<span class="Apple-converted-space"> </span><br><br>Any help and guidance would be great,<span class="Apple-converted-space"> </span><br><br>Thanks<span class="Apple-converted-space"> </span><br><br><hr>Do you have a story that started on Hotmail?<span class="Apple-converted-space"> </span><a href="http://clk.atdmt.com/UKM/go/195013117/direct/01/">Tell us now</a><span class="Apple-converted-space"> </span><br><hr>We want to hear all your funny, exciting and crazy Hotmail stories.<span class="Apple-converted-space"> </span><a href="http://clk.atdmt.com/UKM/go/195013117/direct/01/" target="_new">Tell us now</a><span class="Apple-converted-space"> </span>_______________________________________________<br>Powered by<span class="Apple-converted-space"> </span><a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at:<a href="http://www.vtk.org/Wiki/VTK_FAQ">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></div></span></blockquote></div><br></div></body></html>