ParaView/Data formats

From KitwarePublic
< ParaView(Redirected from Data formats)
Jump to: navigation, search

Introduction

This page describes different data formats that ParaView can read and gives guidance over how to use them.

The full list of file formats

The file formats that ParaView understands includes at least the ones described in the in tool help (Help->ParaView->Readers). See http://paraview.org/Wiki/ParaView/Users_Guide/List_of_readers for a listing.

Note that many plugins add new file formats at runtime. Once loaded, new file formats are displayed in the "Files of type" dropdown in the File->Open dialog.

File formats that are readable via plugins distributed with the ParaView source code as of version 3.8 include:

  • NIH Analyze/Nifti
  •  H5part HDF5 Particle files
  •  .tlp tulip graphs
  •  .xml tree structures
  •  netdmf
  •  sql table interface
  •  prism sesame files

CSV (Comma Separated Variable) files

CSV files can be read by ParaView, and are a good quick and dirty format. This data can be converted into points or structured grids. This data is just a number of rows, each row representing a point in space. The columns should include X, Y, Z and any other data. An example follows. Cut and paste this block of data into a file named test.csv.

x coord, y coord, z coord, scalar
0, 0, 0, 0
1, 0, 0, 1
0, 1, 0, 2
1, 1, 0, 3
-0.5, -0.5, 1, 4
0.5, -0.5, 1, 5
-0.5, 0.5, 1, 6
0.5, 0.5, 1, 7

Read a CSV file into Paraview

Start ParaView, and read in this data. Note that the default settings should be used:

    • Detect Numeric Columns ON
    • Use String Delimiter ON
    • Have Headers ON
    • Field Delimiter Characters should be a comma - ','

The data should show up as a table.

Next, we need to tell ParaView what this data means. There are two ways to do this - as a structured grid or as points.

<< NOTE - As of 3.98.1, there is a bug in the delimited text reader. Make sure there are no spaces after numbers and before commas or carriage returns in your data file (such as may occur if you cut and paste the sample files below) >>

Displaying data as points

  • Run the filter Filters/ Alphabetical/ Table To Points.
  • Tell ParaView what columns are the X, Y and Z coordinate. Be sure to not skip this step. Apply.
  • ParaView probably didn't open up a 3d window (this is a bug).
    • Split screen Horizontal (Icon, top right).
    • 3D View
    • Turn visibility on for the Table to Points filter (click on the eyeball in the Pipeline Browser)
    • If desired, color by your variable.
    • If desired, run the glyph filter on these points. Be sure to change Glyph Type to Sphere.

Displaying data as structured grid

  • You may want to delete the Table to Points filter listed above.
  • Run the filter Filters/ Alphabetical/ Table To Structured Grid.
  • Tell ParaView what extent, or array sizes, your data is in. For instance, the data above has 8 points, forming a leaning cube. Points arrays are in X == size 2, Y == size 2, and Z == size 2. In this example we will use C indexing for the arrays, thus they go from 0 to 1 (2 entries).
    • Whole extent is as follows:
    • 0 1
    • 0 1
    • 0 1
  • Tell ParaView what columns are the X, Y and Z coordinate. Be sure to not skip this step. Apply.
  • ParaView probably didn't open up a 3d window (this is a bug).
    • Split screen Horizontal (Icon, top right).
    • 3D View
    • Turn visibility on for the Table to Points filter (click on the eyeball in the Pipeline Browser)
    • If desired, change representation to solid, and color by your variable.

CSV time series

  • You can also hold multiple time steps as CSV files. You put each time step into it's own file, and label the files as someName.csv.[0-n]
  • Here is an example of three timesteps. Enter the following data into three files in the same directory, named as follows.
    • test.csv.0:
x coord, y coord, z coord, scalar
0, 0, 0, 0
1, 0, 0, 1
0, 1, 0, 2
1, 1, 0, 3
-0.5, -0.5, 1, 4
0.5, -0.5, 1, 5
-0.5, 0.5, 1, 6
0.5, 0.5, 1, 7
    • test.csv.1:
x coord, y coord, z coord, scalar
0, 0, 0, 0
1, 0, 0, 1
0, 1, 0, 2
1, 1, 0, 3
0.5, 0.5, 1, 4
1.5, 0.5, 1, 5
0.5, 1.5, 1, 6
1.5, 1.5, 1, 7
    • test.csv.2:
x coord, y coord, z coord, scalar
0, 0, 0, 0
1, 0, 0, 1
0, 1, 0, 2
1, 1, 0, 3
1.5, 1.5, 1, 4
2.5, 1.5, 1, 5
1.5, 2.5, 1, 6
2.5, 2.5, 1, 7
    • Use the directions above to read in the CSV files and display them as points.

Raw files

Raw data files are binary files of one or more data variables, in an X by Y by Z layout. The spacial locations of the data points are implicit. Raw data files are a good format for voxel data, or datasets that are huge. The ParaView raw data reader will automatically spread your file among all of the ParaView servers that are running.

An example 2X2X2 file would look like this (obviously, with the data written as binary data):

15 16 17 18 19 20 21 22

It would be represented as follows:

15 16

17 18


19 20

21 22

There are numerous raw files located here: http://www.gris.uni-tuebingen.de/edu/areas/scivis/volren/datasets/datasets.html

Read a Raw file into Paraview

Start ParaView, and read in your raw data. You will need to know the layout of your data. Items that you will need to input:

  • Data Scalar Type - is your data 8 bit, 16 bit, unsigned, etc?
  • Data Byte Order - probably dependent on the machine that wrote it. Probably BigEndian.
  • File Dimensionality. Probably 2 or 3.
  • Data Extent. This needs to be 0 based. Thus, for a cube of data 256X256X256, use a Data Extent of 0-255, 0-255, 0-255. For 2d data, set the last item to 0-0.

Note - for byte sized data, ParaView uses the data itself as a gray scale component. To use the user selected color table, select Display/ Map Scalars.

Reading a time varying Raw file into Paraview

One way to read time varying raw files is to leverage the XDMF meta file format. To do so, put a set of grids that use the binary data storage backend inside a temporal collection. An example file that loads part of the 2004 IEEE Visualization data set is:

 
<?xml version="1.0" ?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf xmlns:xi="http://www.w3.org/2001/XInclude" Version="2.0">
<Domain>
    <Topology name="topo" TopologyType="3DCoRectMesh"
        Dimensions="100 500 500">
    </Topology>
    <Geometry name="geo" Type="ORIGIN_DXDYDZ">
        <!-- Origin -->
        <DataItem Format="XML" Dimensions="3">
        0.0 0.0 0.0
        </DataItem>
        <!-- DxDyDz -->
        <DataItem Format="XML" Dimensions="3">
        1.0 1.0 1.0
        </DataItem>
    </Geometry>
 
    <Grid Name="TimeSeries" GridType="Collection" CollectionType="Temporal">
        <Time TimeType="HyperSlab">
            <DataItem Format="XML" NumberType="Float" Dimensions="3">
            0.0 1.0 2
            </DataItem>
        </Time>
 
        <Grid Name="T1" GridType="Uniform">
            <Topology Reference="/Xdmf/Domain/Topology[1]"/>
            <Geometry Reference="/Xdmf/Domain/Geometry[1]"/>
            <Attribute Name="CLOUDf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    CLOUDf01.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Pf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Pf01.bin
                </DataItem>
            </Attribute>
            <Attribute Name="TCf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    TCf01.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Uf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Uf01.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Vf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Vf01.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Wf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Wf01.bin
                </DataItem>
            </Attribute>
        </Grid>
 
        <Grid Name="T2" GridType="Uniform">
            <Topology Reference="/Xdmf/Domain/Topology[1]"/>
            <Geometry Reference="/Xdmf/Domain/Geometry[1]"/>
            <Attribute Name="CLOUDf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    CLOUDf02.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Pf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Pf02.bin
                </DataItem>
            </Attribute>
            <Attribute Name="TCf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    TCf02.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Uf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Uf02.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Vf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Vf02.bin
                </DataItem>
            </Attribute>
            <Attribute Name="Wf" Center="Node">
                <DataItem Format="Binary" 
                 DataType="Float" Precision="4" Endian="Big"
                 Dimensions="100 500 500">
                    Wf02.bin
                </DataItem>
            </Attribute>
        </Grid>
 
    </Grid>
</Domain>
</Xdmf>

VTK(Visualization ToolKit) files

VTK file format, along with all of it's relatives, are a preferred format for ParaView. These file formats are fairly complex, but are also very powerful. This file format can be found here: standard VTK file formats. Example files are available upon request.


PVD File Format

A ParaView Data (PVD) File Format ParaView’s native data file format (PVD) supports any type of data set that can be loaded or created in ParaView (polygonal, uniform rectilinear, nonuniform rectilinear, curvilinear, or unstructured), including spatially partitioned, multi-block, and time series data. This file format is XML-based. The PVD file actually provides pointers to the collection of data files required to store the various components of the current data set. Each of the data files in the collection uses the XML-based VTK file format (either the serial or parallel version - but NOT legacy ".vtk" file format files). The first line in the PVD file specifies the XML version (currently "1.0"). Following that is the VTKFile element. The attributes of this element are as follows.

  • type: This attribute is set to "Collection", indicating that loading this data file requires loading a group of data files.
  • version: The version attribute lists the version of the vtkXMLWriter used in writing this file. The current version is "0.1". This attribute is for informational purposes only; it is not required.
  • byte_order: Because this is an ASCII file, this attribute is not required. If present, set to "BigEndian" or "LittleEndian", depending on the byte order of the platform where this file is being written. Intel CPUs (most commodity laptops and desktops) use little endian byte order; PowerPC CPUs (older Macintosh machines and IBM clusters and supercomputers) use big endian.
  • compressor: This attribute should be set to "vtkZLibDataCompressor". This attribute is not required.

The immediate XML sub-element of VTKFile is Collection. The <Collection> </Collection> tags surround the DataSet elements listing the individual data files in this collection. The DataSet elements (one per sub-file) support the following XML attributes.

  • timestep: This attribute is only required for storing time-varying data sets. Its value is a floating point value.
  • group: The group attribute lists the unique ParaView-assigned identifier of the source, reader, or filter that created this data set. This attribute is not required; it is only for informational purposes.
  • part: This attribute’s value is an identification number for this part of the current data set. It is an integer value greater than or equal to 0.
  • file: This attribute contains the file name of one of the sub-files in this data set. If the sub-file is not in the same directory as the .pvd file, this attribute will contain a relative path to the sub-file from the location of the .pvd file.

An example .pvd file is shown below. It contains five time steps of a time-varying data set.

 
<?xml version="1.0"?>
<VTKFile type="Collection" version="0.1"
         byte_order="LittleEndian"
         compressor="vtkZLibDataCompressor">
  <Collection>
    <DataSet timestep="0" group="" part="0"
             file="examplePVD/examplePVD_T0000.vtp"/>
    <DataSet timestep="1" group="" part="0"
             file="examplePVD/examplePVD_T0001.vtp"/>
    <DataSet timestep="2" group="" part="0"
             file="examplePVD/examplePVD_T0002.vtp"/>
    <DataSet timestep="3" group="" part="0"
             file="examplePVD/examplePVD_T0003.vtp"/>
    <DataSet timestep="4" group="" part="0"
             file="examplePVD/examplePVD_T0004.vtp"/>
  </Collection>
</VTKFile>

Acknowledgements

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.