tonic-data-generator
Helper toolkit for generating DataSet for ArcticViewer. The current implementation provide a Python module that can be used by any visualization tool but additional helper class and method are provided for its usage within ParaView.
Installation
First you should let tonic-data-generator know where you want to deploy the tonic python module and which executable should be used.
To do that locally, you can just export those variables, but it might be more useful to set them up globally in your ~/.bashrc or ~/.profile.
# OS X using installed ParaView inside /Applications $ export TONIC_PYTHON_PATH=/Applications/paraview.app/Contents/Python # OS X + Linux using build tree $ export TONIC_PYTHON_PATH=/.../ParaView/build/lib/site-packages # Optionally you can set the TONIC_PYTHON_EXEC one. # If not provided __tonic-run-py__ will search for vtkpython or pvpython using # the TONIC_PYTHON_PATH one. $ export TONIC_PYTHON_PATH=/.../ParaView/build/bin/pvpython
Then you can install and run tonic-data-generator with the following set of commands.
# Install globally $ npm install -g tonic-data-generator # Update your python path with latest tonic code base $ tonic-install-py # Run a data generator script (TONIC_PYTHON_PATH must be set) $ tonic-run-py /path/to/your/python/script.py
Usage
Once the tonic module has been deployed inside ParaView, you can run the following script:
from paraview.simple import *from tonic.paraview.dataset_builder import * dataset_destination_path = '/tmp/cylinder_v2' # Initial ParaView scene setup rep = view = view.CenterOfRotation = view.CameraFocalPoint normalsLUT = normalsLUT.VectorMode = 'Component'normalsLUT.VectorComponent = 0 # Create Tonic Dataset dsb =
Or if you prefer a time dependent dataset like the can.ex2.
from paraview.simple import *from tonic.paraview.dataset_builder import * # Can.ex2 file path fileToLoad = '/Users/seb/Work/code/ParaView/data/can.ex2'dataset_destination_path = '/tmp/can' # Initial ParaView scene setup can = can.ElementVariables = can.PointVariables = can.GlobalVariables = can.ElementBlocks = rep = view = anim = timeValues = anim.TimeKeeper.TimestepValues view.CameraPosition = view.CameraFocalPoint = view.CameraViewUp = view.CenterOfRotation = view.CameraFocalPoint # Create Tonic Dataset dsb = # Add time information . # Explore dataset for time in .time: anim.TimeKeeper.Time = time