Question

I have 3D binary array which represents a volume, where a[x,y,z] = 0 indicates no object and a[x,y,z] = 1 indicates the object region.

I want to save this as a VTK file and view it in ParaView. What is the simplest way to achieve this? Suggestions for other approaches are welcome.

I looked through the VTK file format, but I have not found direct way to achieve what I need, just via other structures.

Was it helpful?

Solution

It seems Paraview accepts raw data http://paraview.org/Wiki/Data_formats#Raw_files.
So why not just write out your data in a triple for-loop to raw binary data?

How to open raw data file in Paraview (edit):

Example: Fuel from Uni Tuebingen

  1. open .raw file

  2. properties: Data Scalar Type: unsigned char
    properties: Data Extend: 1<tab>64<tab>1<tab>64<tab>1<tab>64
    properties: Apply

  3. click on Contour (next to the calculator symbol) properties: Apply

Now you should see something. From here you can play around a bit.

In VTK itself (i.e. calling from C++) I remember there were some nice volume render algorithms available (ray casting, 2D textures, etc) but I could not find them in paraview right now. Edit: But Robert could (see comment).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top