| name | paraview |
| description | ParaView scientific visualization for volume data and meshes. Use this skill when Claude needs to: (1) Visualize 3D volume data (CT, MRI, scientific simulations), (2) Create isosurfaces, slices, volume renderings, (3) Visualize vector fields with streamlines/glyphs, (4) Generate publication-quality screenshots, (5) Work with VTK, EXODUS, RAW, or other scientific data formats
|
ParaView Scientific Visualization
API Documentation Version: 5.12.1
This skill's API reference is based on ParaView 5.12.1. If you're using a different version, some functions may not be available or behave differently.
Check version: from paraview.simple import GetParaViewVersion; print(GetParaViewVersion())
Critical: Always Use run.py Wrapper
NEVER call scripts directly. ALWAYS use python scripts/run.py [script]:
python scripts/run.py launch_paraview.py
python scripts/run.py launch_paraview.py --status
python scripts/launch_paraview.py
The run.py wrapper automatically:
- Creates
.venv if needed
- Installs all dependencies
- Activates environment
- Executes script properly
Workflow Decision Tree
Interactive Visualization (GUI)
Use the Opening ParaView GUI section to launch ParaView with pvserver
Batch Processing (Script Generation)
- Generate a ParaView Python script following examples
- Execute with pvpython:
$PARAVIEW_HOME/bin/pvpython script.py
MCP Integration (Claude Desktop)
Use the MCP Server section for direct tool integration
Opening ParaView GUI
When the user says "Open ParaView GUI" or requests to launch ParaView:
Method 1: Python Script (Recommended)
python scripts/run.py launch_paraview.py --status
python scripts/run.py launch_paraview.py
python scripts/run.py launch_paraview.py --host localhost --port 11111
Available options:
python scripts/run.py launch_paraview.py --help
Options:
--host HOST Server host (default: localhost)
--port PORT Server port (default: 11111)
--no-server Launch GUI only without starting pvserver
--no-connect Launch GUI without auto-connecting to server
--server-only Start pvserver only without launching GUI
--single-client Start pvserver in single-client mode
--status Check status of PARAVIEW_HOME and pvserver
Method 2: Manual Launch
-
Start pvserver first:
$PARAVIEW_HOME/bin/pvserver --server-port=11111 --multi-clients &
-
Launch ParaView GUI with auto-connect:
$PARAVIEW_HOME/bin/paraview --server-url=cs://localhost:11111 &
Script Reference
Launch ParaView (launch_paraview.py)
python scripts/run.py launch_paraview.py
python scripts/run.py launch_paraview.py --status
python scripts/run.py launch_paraview.py --server-only
python scripts/run.py launch_paraview.py --no-server
python scripts/run.py launch_paraview.py --port 22222
Core Operations
Loading Data
from paraview.simple import *
data = OpenDataFile('path/to/file.vtk')
data = LegacyVTKReader(FileNames=['path/to/file.vtk'])
data = IOSSReader(FileName=['path/to/file.ex2'])
data.UpdatePipeline()
reader = OpenDataFile('path/to/file.raw')
reader.DataExtent = [0, 255, 0, 255, 0, 255]
reader.DataScalarType = 'unsigned char'
reader.DataByteOrder = 'LittleEndian'
reader.FileDimensionality = 3
reader.NumberOfScalarComponents = 1
Get Data Information
source = GetActiveSource()
bounds = source.GetDataInformation().GetBounds()
pd = source.PointData
min_val, max_val = pd.GetArray('fieldName').GetRange()
center = [(bounds[0]+bounds[1])/2, (bounds[2]+bounds[3])/2, (bounds[4]+bounds[5])/2]
Volume Rendering
source = GetActiveSource()
pd = source.PointData
min_val, max_val = pd.GetArray(0).GetRange()
lut = GetColorTransferFunction('fieldName')
lut.RGBPoints = [min_val, 0.0, 0.0, 0.75,
(min_val + max_val)/2, 0.75, 0.75, 0.75,
max_val, 0.75, 0.0, 0.0]
pwf = GetOpacityTransferFunction('fieldName')
pwf.Points = [min_val, 0.0, 0.5, 0.0,
(min_val + max_val)/2, 0.5, 0.5, 0.0,
max_val, 1.0, 0.5, 0.0]
display = Show(source, renderView)
display.Representation = 'Volume'
display.ColorArrayName = ['POINTS', 'fieldName']
display.LookupTable = lut
display.ScalarOpacityFunction = pwf
Isosurfaces (Contours)
contour = Contour(Input=source)
contour.ContourBy = ['POINTS', 'fieldName']
contour.Isosurfaces = [0.5]
contour.PointMergeMethod = 'Uniform Binning'
Show(contour, renderView)
Slices
slice_filter = Slice(Input=source)
slice_filter.SliceType = 'Plane'
slice_filter.SliceType.Origin = [x, y, z]
slice_filter.SliceType.Normal = [0, 0, 1]
Show(slice_filter, renderView)
Clip
clip = Clip(Input=source)
clip.ClipType = 'Plane'
clip.ClipType.Origin = [0.0, 0.0, 0.0]
clip.ClipType.Normal = [1.0, 0.0, 0.0]
clip.InsideOut = False
Show(clip, renderView)
Streamlines
bounds = source.GetDataInformation().GetBounds()
center = [(bounds[0]+bounds[1])/2, (bounds[2]+bounds[3])/2, (bounds[4]+bounds[5])/2]
tracer = StreamTracer(Input=source, SeedType='Point Cloud')
tracer.Vectors = ['POINTS', 'vectorField']
tracer.IntegrationDirection = 'BOTH'
tracer.MaximumStreamlineLength = 50.0
tracer.SeedType.Center = center
tracer.SeedType.NumberOfPoints = 100
tracer.SeedType.Radius = 1.0
tube = Tube(Input=tracer)
tube.Radius = 0.1
Show(tube, renderView)
ColorBy(tubeDisplay, ('POINTS', 'scalarField'))
Glyphs
glyph = Glyph(Input=source, GlyphType='Cone')
glyph.OrientationArray = ['POINTS', 'vectorField']
glyph.ScaleArray = ['POINTS', 'vectorField']
glyph.ScaleFactor = 0.05
Show(glyph, renderView)
Delaunay Triangulation (Points to Surface)
delaunay = Delaunay3D(Input=points)
Show(delaunay, renderView)
Render View Setup
renderView = CreateView('RenderView')
renderView.ViewSize = [1920, 1080]
renderView.Background = [0.1, 0.1, 0.15]
layout = CreateLayout(name='Layout')
layout.AssignView(0, renderView)
renderView.CameraPosition = [3.86, 3.86, 3.86]
renderView.CameraViewUp = [-0.408, 0.816, -0.408]
renderView.CameraPosition = [center[0] - 1.5*max_dim, center[1], center[2]]
renderView.CameraFocalPoint = center
renderView.CameraViewUp = [0.0, 0.0, 1.0]
ResetCamera(renderView)
SaveScreenshot('output.png', renderView, ImageResolution=[1920, 1080],
OverrideColorPalette='WhiteBackground')
Display Properties
display = GetDisplayProperties(source, renderView)
display.SetRepresentationType('Surface')
ColorBy(display, ('POINTS', 'fieldName'))
display.RescaleTransferFunctionToDataRange(True)
ColorBy(display, None)
display.DiffuseColor = [1.0, 0.0, 0.0]
display.Opacity = 0.5
display.Visibility = 1
Color Map Presets
from paraview.simple import ApplyPreset
lut = GetColorTransferFunction('fieldName')
ApplyPreset(lut, 'Cool to Warm', True)
Scalar Bar (Color Legend)
lut = GetColorTransferFunction('fieldName')
colorBar = GetScalarBar(lut, renderView)
colorBar.Title = 'Field Name'
colorBar.ComponentTitle = ''
colorBar.Visibility = 1
colorBar.ScalarBarLength = 0.3
MCP Server Integration
For direct integration with Claude Desktop, use the ParaView MCP Server:
Setup
-
Start pvserver with multi-clients:
$PARAVIEW_HOME/bin/pvserver --multi-clients --server-port=11111 &
-
Connect ParaView GUI to the server (File > Connect)
-
Configure Claude Desktop's claude_desktop_config.json:
{
"mcpServers": {
"ParaView": {
"command": "/path/to/python",
"args": ["/path/to/paraview_mcp/paraview_mcp_server.py"]
}
}
}
Available MCP Tools
| Tool | Description |
|---|
load_data(file_path) | Load data file into ParaView |
create_isosurface(value, field) | Create isosurface visualization |
create_slice(origin_x, origin_y, origin_z, normal_x, normal_y, normal_z) | Create slice plane |
toggle_volume_rendering(enable) | Enable/disable volume rendering |
toggle_visibility(enable) | Show/hide active source |
set_active_source(name) | Set active pipeline object |
get_active_source_names_by_type(source_type) | List sources by type |
edit_volume_opacity(field_name, opacity_points) | Edit opacity transfer function |
set_color_map(field_name, color_points) | Set color transfer function |
color_by(field, component) | Color visualization by field |
set_representation_type(rep_type) | Set representation (Surface, Wireframe, etc.) |
get_pipeline() | Get current pipeline structure |
get_available_arrays() | List available data arrays |
create_streamline(seed_point_number, vector_field, ...) | Create streamlines |
get_screenshot() | Capture screenshot |
rotate_camera(azimuth, elevation) | Rotate camera view |
reset_camera() | Reset camera to show all data |
plot_over_line(point1, point2, resolution) | Create plot over line |
warp_by_vector(vector_field, scale_factor) | Warp by vector field |
compute_surface_area() | Compute surface area |
save_contour_as_stl(stl_filename) | Save contour as STL |
Complete Example Scripts
Volume Rendering
from paraview.simple import *
data = LegacyVTKReader(FileNames=['/path/to/volume.vtk'])
source = GetActiveSource()
pd = source.PointData
min_val, max_val = pd.GetArray(0).GetRange()
lut = GetColorTransferFunction('var0')
lut.RGBPoints = [min_val, 0.0, 0.0, 0.75,
(min_val + max_val)/2, 0.75, 0.75, 0.75,
max_val, 0.75, 0.0, 0.0]
pwf = GetOpacityTransferFunction('var0')
pwf.Points = [min_val, 0.0, 0.5, 0.0,
(min_val + max_val)/2, 0.5, 0.5, 0.0,
max_val, 1.0, 0.5, 0.0]
renderView = CreateView('RenderView')
renderView.ViewSize = [1920, 1080]
renderView.CameraPosition = [3.86, 3.86, 3.86]
renderView.CameraViewUp = [-0.408, 0.816, -0.408]
layout = CreateLayout(name='Layout')
layout.AssignView(0, renderView)
display = Show(data, renderView)
display.Representation = 'Volume'
display.ColorArrayName = ['POINTS', 'var0']
display.LookupTable = lut
display.ScalarOpacityFunction = pwf
SaveScreenshot('/path/to/dvr.png', renderView, ImageResolution=[1920, 1080])
Streamlines with Glyphs
from paraview.simple import *
data = IOSSReader(FileName=['/path/to/disk.ex2'])
data.UpdatePipeline()
bounds = data.GetDataInformation().GetBounds()
center = [(bounds[0]+bounds[1])/2, (bounds[2]+bounds[3])/2, (bounds[4]+bounds[5])/2]
tracer = StreamTracer(Input=data, SeedType='Point Cloud')
tracer.Vectors = ['POINTS', 'V']
tracer.MaximumStreamlineLength = 20.0
tracer.SeedType.Center = center
tracer.SeedType.Radius = 2.0
glyph = Glyph(Input=tracer, GlyphType='Cone')
glyph.OrientationArray = ['POINTS', 'V']
glyph.ScaleArray = ['POINTS', 'V']
glyph.ScaleFactor = 0.06
tube = Tube(Input=tracer)
tube.Radius = 0.075
renderView = CreateView('RenderView')
renderView.ViewSize = [1920, 1080]
renderView.CameraPosition = [center[0] - 1.5*max(bounds[1]-bounds[0], bounds[3]-bounds[2]),
center[1], center[2]]
renderView.CameraFocalPoint = center
renderView.CameraViewUp = [0.0, 0.0, 1.0]
layout = CreateLayout(name='Layout')
layout.AssignView(0, renderView)
tubeDisplay = Show(tube, renderView)
glyphDisplay = Show(glyph, renderView)
ColorBy(tubeDisplay, ('POINTS', 'Temp'))
ColorBy(glyphDisplay, ('POINTS', 'Temp'))
tubeDisplay.RescaleTransferFunctionToDataRange(True)
glyphDisplay.RescaleTransferFunctionToDataRange(True)
SaveScreenshot('/path/to/streamlines.png', renderView, ImageResolution=[1920, 1080])
RAW Volume File
from paraview.simple import *
raw_file = '/path/to/tooth_103x94x161_uint8.raw'
reader = ImageReader(FileNames=[raw_file])
reader.DataScalarType = 'unsigned char'
reader.DataByteOrder = 'LittleEndian'
reader.DataExtent = [0, 102, 0, 93, 0, 160]
reader.FileDimensionality = 3
reader.NumberOfScalarComponents = 1
reader.UpdatePipeline()
Script Template
from paraview.simple import *
INPUT_FILE = '/path/to/input.vtk'
OUTPUT_FILE = '/path/to/screenshot.png'
IMAGE_SIZE = [1920, 1080]
data = LegacyVTKReader(FileNames=[INPUT_FILE])
bounds = data.GetDataInformation().GetBounds()
center = [(bounds[0]+bounds[1])/2, (bounds[2]+bounds[3])/2, (bounds[4]+bounds[5])/2]
renderView = CreateView('RenderView')
renderView.ViewSize = IMAGE_SIZE
layout = CreateLayout(name='Layout')
layout.AssignView(0, renderView)
display = Show(data, renderView)
SaveScreenshot(OUTPUT_FILE, renderView,
ImageResolution=IMAGE_SIZE,
OverrideColorPalette='WhiteBackground')
Environment Management
The virtual environment is automatically managed:
- First run creates
.venv automatically
- Dependencies install automatically
- Everything isolated in skill directory
Manual setup (only if automatic fails):
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Troubleshooting
| Problem | Solution |
|---|
| PARAVIEW_HOME not set | export PARAVIEW_HOME=/path/to/ParaView |
| pvserver not found | Check PARAVIEW_HOME path is correct |
| Port already in use | Use --port to specify different port |
| Connection failed | Check firewall, try --status to debug |
| ModuleNotFoundError | Use run.py wrapper |
| "No active source" | Load data first before applying filters |
| Transfer function not working | Check field name matches array name |
Resources
references/api-reference-5.12.1.md - Complete Python API reference (v5.12.1)
references/operations.md - Common operations quick reference
references/examples.md - Complete example scripts