View Operations
View Operations Tutorial.
This tutorial demonstrates how to control the Volvicon view tab operations through the scripting API, including workspace layouts, scene orientations, slice view settings, 3D view rendering options, surface representation and shading, and camera controls.
Prerequisites
- Volvicon application must be running
- A valid license must be active
- For some operations, a loaded volume or surface is required
Layout Presets​
# Set the workspace layout to a predefined arrangement of 3D and 2D slice views.
# Available presets:
# api.LayoutPreset.Conventional - 3D view with three orthogonal slices
# api.LayoutPreset.ThreeDOnly - 3D view only
# api.LayoutPreset.FourUpRight - Four views with 3D at upper right
# api.LayoutPreset.FourDownRight - Four views with 3D at lower right
# api.LayoutPreset.FourUpLeft - Four views with 3D at upper left
# api.LayoutPreset.FourDownLeft - Four views with 3D at lower left
# api.LayoutPreset.SliceViewsRight - Three slice views on the right, 3D on left
# api.LayoutPreset.SliceViewsLeft - Three slice views on the left, 3D on right
# api.LayoutPreset.SagittalOnly - Sagittal (or X-axis) slice view only
# api.LayoutPreset.CoronalOnly - Coronal (or Y-axis) slice view only
# api.LayoutPreset.AxialOnly - Axial (or Z-axis) slice view only
# api.LayoutPreset.HorizontalSliceViewsOnly - Three slices arranged horizontally
# api.LayoutPreset.VerticalSliceViewsOnly - Three slices arranged vertically
# api.LayoutPreset.AxialLeftSagittalRight - Two panels: axial left, sagittal right
# api.LayoutPreset.AxialLeftCoronalRight - Two panels: axial left, coronal right
# api.LayoutPreset.SagittalLeft3DRight - Two panels: sagittal left, 3D right
# api.LayoutPreset.SagittalRight3DLeft - Two panels: sagittal right, 3D left
# api.LayoutPreset.CoronalLeft3DRight - Two panels: coronal left, 3D right
# api.LayoutPreset.CoronalRight3DLeft - Two panels: coronal right, 3D left
# api.LayoutPreset.AxialLeft3DRight - Two panels: axial left, 3D right
# api.LayoutPreset.AxialRight3DLeft - Two panels: axial right, 3D left
# Set the conventional (default) layout
ViewOperations.set_layout(api.LayoutPreset.Conventional)
# Get the current layout preset
current_layout = ViewOperations.get_layout()
print(f"Current layout: {current_layout}")
# Set the 3D-only layout
# ViewOperations.set_layout(api.LayoutPreset.ThreeDOnly)
# Set a two-panel layout with axial on the left and 3D on the right
# ViewOperations.set_layout(api.LayoutPreset.AxialLeft3DRight)
Scene Orientation​
# Set the scene orientation type, which determines the axis labels and view
# directions for both 3D and 2D slice views.
#
# Available orientations:
# api.SceneOrientation.Standard - Standard engineering (X, Y, Z)
# api.SceneOrientation.Classic - Classic engineering orientation
# api.SceneOrientation.Medical1 - Radiologist convention (most common in clinical radiology)
# api.SceneOrientation.Medical2 - Neurologist convention
# api.SceneOrientation.Orientation1 - Custom orientation preset 1
# api.SceneOrientation.Orientation2 - Custom orientation preset 2
# api.SceneOrientation.Orientation3 - Custom orientation preset 3
# api.SceneOrientation.Orientation4 - Custom orientation preset 4
# Set standard engineering orientation
ViewOperations.set_scene_orientation(api.SceneOrientation.Standard)
# Get the current scene orientation
current_orientation = ViewOperations.get_scene_orientation()
print(f"Current orientation: {current_orientation}")
# Set radiologist (medical) orientation
# ViewOperations.set_scene_orientation(api.SceneOrientation.Medical1)
Slice Views - 3D Contours​
# Toggle the visibility of 3D contours in the 2D slice views.
# When enabled, the intersection of 3D objects with the current slice plane
# is rendered as contour lines in the 2D views.
#
# Available contour object types:
# api.ContourObjectType.Surface - Surface object contours
# api.ContourObjectType.VolumeMesh - Volume mesh object contours
# api.ContourObjectType.MaskPreview - Mask 3D preview contours
# Toggle surface contours in slice views
# ViewOperations.toggle_3d_contours(api.ContourObjectType.Surface)
# Toggle volume mesh contours in slice views
# ViewOperations.toggle_3d_contours(api.ContourObjectType.VolumeMesh)
# Toggle mask preview contours in slice views
# ViewOperations.toggle_3d_contours(api.ContourObjectType.MaskPreview)
Slice Views - Crosshair, Voxel Info, and Linked Views​
# The crosshair shows the intersection of the three orthogonal slice planes.
# Check crosshair state
# is_crosshair_on = ViewOperations.is_crosshair_enabled()
# print(f"Crosshair enabled: {is_crosshair_on}")
# Enable the crosshair
# ViewOperations.set_crosshair_enabled(True)
# Disable the crosshair
# ViewOperations.set_crosshair_enabled(False)
# Check voxel information state
# is_voxel_info_on = ViewOperations.is_voxel_information_enabled()
# print(f"Voxel information enabled: {is_voxel_info_on}")
# Enable voxel information display in the status bar
# ViewOperations.set_voxel_information_enabled(True)
# Disable voxel information display
# ViewOperations.set_voxel_information_enabled(False)
# Check slice views linked state
# are_views_linked = ViewOperations.is_slice_views_linked()
# print(f"Slice views linked: {are_views_linked}")
# Link slice views so panning/zooming is synchronized
# ViewOperations.set_slice_views_linked(True)
# Unlink slice views
# ViewOperations.set_slice_views_linked(False)
Slice Views - Window / Level​
# Window and Level control the brightness and contrast of the 2D slice views.
# Window defines the range of gray values displayed, and Level defines the
# center of that range.
#
# For example, for CT bone visualization: window=1000, level=500
# For CT lung visualization: window=500, level=-200
# Get the current window and level values of the active volume
# wl = ViewOperations.get_window_level()
# print(f"Window: {wl[0]}, Level: {wl[1]}")
# Set window and level for bone visualization
# ViewOperations.set_window_level(1000.0, 500.0)
# Set window and level for soft tissue
# ViewOperations.set_window_level(400.0, 40.0)
# Set window and level for lung
# ViewOperations.set_window_level(500.0, -200.0)
3D View - Mask Preview​
# Generate a 3D surface preview of the visible masks.
# Get the current mask preview quality level
# quality = ViewOperations.get_mask_3d_preview_quality()
# print(f"Current mask preview quality: {quality}")
# Generate mask preview with the current quality setting
# ViewOperations.generate_mask_3d_preview()
# Generate mask preview with a specific quality level
# Available quality levels:
# api.Mask3dPreviewQuality.Optimal - Full resolution (slowest)
# api.Mask3dPreviewQuality.High - High quality
# api.Mask3dPreviewQuality.Medium - Medium quality
# api.Mask3dPreviewQuality.Low - Low quality (fastest)
# ViewOperations.generate_mask_3d_preview_with_quality(api.Mask3dPreviewQuality.High)
# Remove all mask previews from the 3D view
# ViewOperations.remove_all_mask_previews()
3D View - Object Widgets (Bounding Boxes)​
# Toggle bounding box and corner bounding box outlines for visible objects.
#
# Available widget object types:
# api.WidgetObjectType.Volume - Volume objects
# api.WidgetObjectType.Surface - Surface and mask objects
# api.WidgetObjectType.VolumeMesh - Volume mesh objects
# Toggle volume bounding box outline
# ViewOperations.toggle_outline(api.WidgetObjectType.Volume)
# Toggle surface bounding box outline
# ViewOperations.toggle_outline(api.WidgetObjectType.Surface)
# Toggle volume mesh bounding box outline
# ViewOperations.toggle_outline(api.WidgetObjectType.VolumeMesh)
# Toggle volume corner bounding box outline
# ViewOperations.toggle_corner_outline(api.WidgetObjectType.Volume)
# Toggle surface corner bounding box outline
# ViewOperations.toggle_corner_outline(api.WidgetObjectType.Surface)
3D View - Volume Rendering Options​
# Toggle visibility of slice planes, axes planes, and volume shading.
# Toggle 3D slice planes visibility
# ViewOperations.toggle_slice_planes()
# Toggle axes planes visibility
# ViewOperations.toggle_axes_planes()
# Toggle volume shading (lighting)
# ViewOperations.toggle_volume_shading()
3D View - Surface Representation​
# Set the surface representation mode for all surface, volume mesh, and mask objects.
#
# Available representation modes:
# api.SurfaceRepresentation.Solid - Filled solid surface
# api.SurfaceRepresentation.SolidEdges - Solid surface with visible edges
# api.SurfaceRepresentation.Wireframe - Wireframe (edges only)
# api.SurfaceRepresentation.Points - Point cloud
# Set solid representation
# ViewOperations.set_surface_representation(api.SurfaceRepresentation.Solid)
# Set wireframe representation
# ViewOperations.set_surface_representation(api.SurfaceRepresentation.Wireframe)
# Set solid with edges representation
# ViewOperations.set_surface_representation(api.SurfaceRepresentation.SolidEdges)
3D View - Surface Shading​
# Set the surface shading (interpolation) method for all surface, volume mesh,
# and mask objects.
#
# Available interpolation methods:
# api.SurfaceInterpolation.Flat - Flat shading (per-face)
# api.SurfaceInterpolation.Gouraud - Gouraud shading (smooth, per-vertex)
# api.SurfaceInterpolation.Phong - Phong shading (smooth, per-pixel)
# api.SurfaceInterpolation.PBR - Physically Based Rendering
# Set flat shading
# ViewOperations.set_surface_shading(api.SurfaceInterpolation.Flat)
# Set Phong shading
# ViewOperations.set_surface_shading(api.SurfaceInterpolation.Phong)
# Set PBR shading
# ViewOperations.set_surface_shading(api.SurfaceInterpolation.PBR)
3D View - Point Colors​
# Toggle scalar color visibility on all surface, volume mesh, and mask objects.
# When enabled, objects are colored by their vertex data (if available).
# When disabled, objects use their assigned solid color.
# Toggle point colors
# ViewOperations.toggle_point_colors()
Camera - Standard Views​
# Set the 3D view camera to a predefined standard view direction.
#
# Available standard views:
# api.StandardView.XMinus - View from negative X direction (Left/Right)
# api.StandardView.XPlus - View from positive X direction (Right/Left)
# api.StandardView.YMinus - View from negative Y direction (Posterior/Anterior)
# api.StandardView.YPlus - View from positive Y direction (Anterior/Posterior)
# api.StandardView.ZMinus - View from negative Z direction (Inferior/Superior)
# api.StandardView.ZPlus - View from positive Z direction (Superior/Inferior)
# api.StandardView.Isometric - Isometric (45-degree) view
# Set the camera to look from the positive Z direction
# ViewOperations.set_standard_view(api.StandardView.ZPlus)
# Set the camera to the isometric view
# ViewOperations.set_standard_view(api.StandardView.Isometric)
Camera - Center and Reset​
# Center the 3D view on the scene without changing zoom level.
# ViewOperations.center_3d_view()
# Reset the 3D view camera to fit all visible objects.
# ViewOperations.reset_3d_view()
# Reset all 2D slice view cameras and slice positions.
# ViewOperations.reset_slice_views()
Related Resources​
- API Reference - API documentation
- Quick Reference - Common methods at a glance