Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK...

Preview:

Citation preview

Weiguang Guan

guanw@sharcnet.ca

Code and data: http://www.sharcnet.ca/~guanw

Overview of ParaView Introduction

Open source

General-purpose visualization package

Large user base

Kitware, Los Alomas, Sandia National Labs, etc

www.paraview.org

Latest version 5.5

Overview of ParaView Introduction

Parallel visualization of large data

Either standalone or client/server mode

Multiple platforms (Windows, Linux/Unix, MacOS)

Multi-dimensional and/or Multi-variables

Rich functionalities implemented as filters

Many file formats

Various data types

Scripting

Overview of ParaView Documentations and resources

Guide: http://www.paraview.org/paraview-guide

Wiki: http://www.paraview.org/Wiki/ParaView

Tutorials: http://www.paraview.org/tutorials

Webinars: http://www.paraview.org/webinars

Dataset types inside ParaView Structured data

vtkImageData (uniform rectilinear grid, *.vti)

vtkRectilinearGrid (rectilinear grid, *.vtr)

vtkStructuredGrid (curvilinear grid, *.vts)

Unstructured data

vtkPolyData (*.vtp)

vtkUnstructuredGrid (*.vtu)

Structured data Having topological structure

Uniform rectilinear grid Rectilinear grid Curvilinear grid

Unstructured data Without regular topological structure

Polygonal data Unstructured grid

Points vs Cells

Cell types

Why cells? A cell is defined by

One or more points, and

Their connections (topology)

Points are discrete in 3D space

Cells are enclosed space in 1D (lines), 2D (polygons), and 3D (hexahedra)

Continuous space

Interpolation

Attributes Attributes associated with points and/or cells

Point data

Cell data

Attributes Attribute types

Scalar (e.g., temperature, density, pressure, etc.)

Vector (e.g., velocity)

Normal

Color

Tensor

Field

Data formats supported by ParaView VTK formats (legacy and XML)

Various non-VTK formats DICOM

EnSight

NetCDF

STL

……

See the full list (of 73 formats) https://www.paraview.org/Wiki/ParaView/Users_Guide/List_of_readers

ParaView is great!

What if my data are not recognized by Paraview?

What if ParaView does not support my data format? Import as CSV or Raw

Write a converter to transform your data into a format that is recognizable by ParaView

VTK legacy formats

VTK XML formats

NetCDF

Write a plugin for your data format

Loading CSV Pseudo CSV to CSV using Excel or OpenOffice

Load CSV file as table

Convert table to Either points

Or structured grid (the order of data: x index increasing fastest, then y index, z index is the slowest)

Examples CVS without header and attribute data

CVS with header but no attribute data

CVS with header and one scalar attribute data

CVS with header and two scalar attribute data

Import raw data Only for uniform rectilinear grids

The data is stored in the order of x increasing the fastest, then y, then z.

You need to know

Data type (integer, float, etc.)

Endian-ness

Spacing and origin

Conversion to formats supported by Paraview

Formats converted to VTK legacy formats

VTK XML formats

Many others such as netCDF

VTK legacy formats Identifier and version: # vtk DataFile Version x.y

Description (<=256 characters)

ASCII or Binary (NOTE: Stored in big endian)

Geometry and topology: DATASET type type = STRUCTURED_POINTS

RECTILINEAR_GRID

STRUCTURED_GRID

UNSTRUCTURED_GRID

POLYDATA

FIELD

POINT_DATA n (optional)

CELL_DATA n (optional)

Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example by Weiguang Guan ASCII DATASET POLYDATA POINTS 4 float 0 0 0 1 0 0 1.1 1.1 0 0 1 0 POLYGONS 1 5 4 0 1 2 3 CELL_DATA 1 POINT_DATA 4 SCALARS pressure float LOOKUP_TABLE default 0 1 2 1.1

How to write in VTK legacy formats Build a VTK pipeline and add vtk writer at the end

Native way --- write data to a file without using any tool.

Use third-party tools

pyVTK (https://sysbio.ioc.ee/projects/pyvtk)

TVTK (http://code.enthought.com/pages/mayavi-project.html#TVTK)

Examples By editing manually

A cube as STRUCTURED_POINTS (volume)

A cube as RECTILINEAR_GRID (volume)

A hexahedron as STRUCTURED_GRID (volume)

A hexahedron as polygonal data (surface only)

A hexahedron as UNSTRUCTURED_GRID (volume)

C++ program

a volume data of STRUCTURED_POINTS in both ASCII and BINARY formats

VTK XML-based formats Serial formats

ImageData (.vti) — Serial vtkImageData

PolyData (.vtp) — Serial vtkPolyData

RectilinearGrid (.vtr) — Serial vtkRectilinearGrid

StructuredGrid (.vts) — Serial vtkStructuredGrid

UnstructuredGrid (.vtu) — Serial vtkUnstructuredGrid

Parallel formats PImageData (.pvti) — Parallel vtkImageData

PPolyData (.pvtp) — Parallel vtkPolyData

PRectilinearGrid (.pvtr) — Parallel vtkRectilinearGrid

PStructuredGrid (.pvts) — Parallel vtkStructuredGrid

PUnstructuredGrid (.pvtu) — Parallel vtkUnstructuredGrid

ImageData

RectilinearGrid

Write VTK XML-based formats Using PyEVTK (python Export VTK)

ImageData

Rectilinear grid

Structured grid

Scattered points as unstructured data

Parallel VTK XML-based formats

Time-series data A series of files named “prefix-xxxx.extension”

XDMF – eXtensible Data Model and Format

Recommended