32
Weiguang Guan [email protected] Code and data: http://www.sharcnet.ca/~guanw

Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 2: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 3: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 5: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 6: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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)

Page 7: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Structured data Having topological structure

Uniform rectilinear grid Rectilinear grid Curvilinear grid

Page 8: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Unstructured data Without regular topological structure

Polygonal data Unstructured grid

Page 9: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Points vs Cells

Page 10: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Cell types

Page 11: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 12: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Attributes Attributes associated with points and/or cells

Point data

Cell data

Page 13: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Attributes Attribute types

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

Vector (e.g., velocity)

Normal

Color

Tensor

Field

Page 14: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 15: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

ParaView is great!

What if my data are not recognized by Paraview?

Page 16: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 17: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 18: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 19: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Conversion to formats supported by Paraview

Page 20: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Formats converted to VTK legacy formats

VTK XML formats

Many others such as netCDF

Page 22: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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)

Page 23: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 24: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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)

Page 25: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 26: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

Page 27: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

ImageData

Page 28: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

RectilinearGrid

Page 29: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

ImageData

Rectilinear grid

Structured grid

Scattered points as unstructured data

Page 30: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

Parallel VTK XML-based formats

Page 31: Weiguang Guan guanw@sharcnetguanw/ss2018/ss-2018-viz.pdf · Many file formats ... Example of VTK legacy formats File “quadrilateral.vtk” # vtk DataFile Version 3.0 Just an example

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

XDMF – eXtensible Data Model and Format