[Paraview] Reading Vtk files into say Matlab

Eric E. Monson emonson at cs.duke.edu
Thu Sep 2 16:49:12 EDT 2010


Hey Vishwa,

I haven't done this before, but what method is best/easiest will probably depend on what type of data you have stored in your .vtk file. 

If it's image data, then you might be able to write a simple VTK program to read in each of the vtk files and write out a more standard image format that Matlab can read. Have a look at the writers that inherit from vtkImageWriter (or maybe use that itself):

http://www.vtk.org/doc/nightly/html/classvtkImageWriter.html

Otherwise, you may have to write a reader in Matlab that will just read in the data and form a Matlab array directly. Here someone has done it for Structured Grid data (I have not tried this, I just found it on the web):

http://www.cb.uu.se/~erik/vtk/readVTK.m

Depending on how big your data is or what type of values it contains, ParaView might be able to save it as a CSV or PNG file, too. (Which could be scripted as a batch Python job.)

Hope this helps,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Aug 30, 2010, at 3:53 PM, Vishwa wrote:

> Hi,
> When running a simulation, I ended up saving slices of the data as a .vtk file. I now have to do some analysis of the data and I am having a tough time to find a matlab reader. Could anybody here in this forum suggest an idea as to how to do it.. I could also use a convertion of vtk data to another format which can be read by matlab.
> 
> Hope to hear soon. 
> 
> Thanks a bunch in advance
> Vishwa
> 
> 
> _______________________________________________
> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list