ViewOperations
Provides operations for application views, scene orientation, camera, layout, rendering representation, and visualization settings. This class exposes the functionality available through the View ribbon tab, including layout presets, scene orientations, 3D/2D view operations, surface representation modes, shading options, and object widget visibility.
Import
import ScriptingApi as api
# Access via Application
app = api.Application()
ops = app.get_view_operations()
Methods
Properties
set_layout
Sets the workspace layout to a predefined arrangement of 3D and 2D slice views.
Signature:
set_layout(preset: LayoutPreset) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
preset | LayoutPreset | The layout preset to apply. Use api.LayoutPreset values (e.g., api.LayoutPreset.Conventional, api.LayoutPreset.ThreeDOnly, api.LayoutPreset.FourUpRight). |
get_layout
Returns the current workspace layout preset.
Signature:
get_layout() -> LayoutPreset
Returns: LayoutPreset — The active layout preset value as api.LayoutPreset.
set_scene_orientation
Sets the scene orientation type, which determines the axis labels and view directions for both 3D and 2D slice views. Standard and Classic orientations use engineering conventions (X, Y, Z). Medical orientations use anatomical camera conventions (Radiologist/Neurologist viewpoints).
Signature:
set_scene_orientation(orientation: SceneOrientation) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
orientation | SceneOrientation | The scene orientation to apply. Use api.SceneOrientation values (e.g., api.SceneOrientation.Standard, api.SceneOrientation.Medical1). |
get_scene_orientation
Returns the current scene orientation type.
Signature:
get_scene_orientation() -> SceneOrientation
Returns: SceneOrientation — The active scene orientation value as api.SceneOrientation.
set_3d_contours_enabled
Enables or disables the visibility of 3D contours in the 2D slice views for the specified object type. When enabled, the intersection of 3D objects with the current slice plane is rendered as contour lines in the 2D views.
Signature:
set_3d_contours_enabled(objectType: ContourObjectType, enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
objectType | ContourObjectType | The type of object whose contours to set. Use api.ContourObjectType.Surface, api.ContourObjectType.VolumeMesh, or api.ContourObjectType.MaskPreview. |
enabled | bool | True to show the contours, false to hide them. |
set_crosshair_enabled
Enables or disables the crosshair in both the slice and 3D views. When enabled, the crosshair indicates the intersection of the three orthogonal slice planes in all views.
Signature:
set_crosshair_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | If true, enables the crosshair; if false, disables it. |
is_crosshair_enabled
Returns whether the crosshair is currently enabled.
Signature:
is_crosshair_enabled() -> bool
Returns: bool — True if the crosshair is enabled; false otherwise.
set_slice_views_linked
Enables or disables camera synchronization (linking) of the slice views. When enabled, panning and zooming in one slice view is synchronized across all slice views.
Signature:
set_slice_views_linked(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | If true, links the slice views; if false, unlinks them. |
is_slice_views_linked
Returns whether the slice views are currently linked (camera synchronized).
Signature:
is_slice_views_linked() -> bool
Returns: bool — True if slice views are linked; false otherwise.
set_window_level
Sets the window and level values for the active volume in the slice views. Window defines the range of gray values displayed, and level defines the center of that range. Together they control the brightness and contrast of the 2D slice views. The window value must be non-negative. A window of 0 means all voxels at the level value will be displayed at maximum brightness. The values are stored with the active volume, but they are only displayed in the standard slice display. While the slice views use one of the gray value interval modes, those modes define the displayed colors themselves and the values stay stored until the slice display is set back to standard.
Signature:
set_window_level(window: float, level: float) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
window | float | The window (contrast) value. Must be >= 0. |
level | float | The level (brightness center) value. |
get_window_level
Returns the current window and level values of the active volume. The returned array contains two elements: [window, level]. Window is the range of displayed gray values and level is the center of that range.
Signature:
get_window_level() -> list
Returns: list — A std::array with [window, level] values.
get_mask_3d_preview_quality
Returns the current quality level used for mask 3D previews.
Signature:
get_mask_3d_preview_quality() -> Mask3dPreviewQuality
Returns: Mask3dPreviewQuality — The current mask preview quality value as api.Mask3dPreviewQuality.
set_mask_volume_rendering_enabled
Enables or disables direct volume rendering of masks in the 3D view. When enabled, all masks are rendered directly as GPU volumes without generating surface meshes, so mask edits are reflected immediately in the 3D view. Enabling this mode implicitly turns off any active mesh preview for all masks. Selecting any 'Mask 3D Preview (Mesh)' quality button will disable this mode again.
Signature:
set_mask_volume_rendering_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable direct volume rendering; false to disable it. |
is_mask_volume_rendering_enabled
Returns whether mask direct volume rendering is currently enabled.
Signature:
is_mask_volume_rendering_enabled() -> bool
Returns: bool — True if mask direct volume rendering is active; false otherwise.
set_outline_enabled
Enables or disables the bounding box outline for all objects of the specified type.
Signature:
set_outline_enabled(objectType: WidgetObjectType, enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
objectType | WidgetObjectType | The type of objects to set the outline for. Use api.WidgetObjectType.Volume, api.WidgetObjectType.Surface, or api.WidgetObjectType.VolumeMesh. |
enabled | bool | True to show the bounding box outline, false to hide it. |
set_corner_outline_enabled
Enables or disables the corner bounding box outline for all objects of the specified type.
Signature:
set_corner_outline_enabled(objectType: WidgetObjectType, enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
objectType | WidgetObjectType | The type of objects to set the corner outline for. Use api.WidgetObjectType.Volume, api.WidgetObjectType.Surface, or api.WidgetObjectType.VolumeMesh. |
enabled | bool | True to show the corner outline, false to hide it. |
set_slice_planes_enabled
Enables or disables the visibility of the 3D slice planes in the 3D view. Slice planes show the current slice positions from the 2D views overlaid in the 3D view.
Signature:
set_slice_planes_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to show the slice planes, false to hide them. |
set_axes_planes_enabled
Enables or disables the visibility of the axes planes in the 3D view. Axes planes show the three orthogonal planes at the origin of the volume coordinate system.
Signature:
set_axes_planes_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to show the axes planes, false to hide them. |
set_volume_shading_enabled
Enables or disables volume shading in the 3D view. When shading is enabled, the volume rendering uses lighting to enhance depth perception of the rendered volume data.
Signature:
set_volume_shading_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable volume shading, false to disable it. |
set_surface_representation
Sets the surface representation mode for all surface, volume mesh, and mask objects. Changes how the 3D mesh geometry is rendered in the 3D view for all objects.
Signature:
set_surface_representation(representation: SurfaceRepresentation) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
representation | SurfaceRepresentation | The representation mode to apply. Use api.SurfaceRepresentation values (e.g., api.SurfaceRepresentation.Solid, api.SurfaceRepresentation.Wireframe). |
set_surface_shading
Sets the surface shading (interpolation) method for all surface, volume mesh, and mask objects. Controls the shading algorithm used to render surfaces in the 3D view.
Signature:
set_surface_shading(interpolation: SurfaceInterpolation) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
interpolation | SurfaceInterpolation | The interpolation method to apply. Use api.SurfaceInterpolation values (e.g., api.SurfaceInterpolation.Flat, api.SurfaceInterpolation.Phong). |
set_point_colors_enabled
Enables or disables the visibility of scalar colors on all surface, volume mesh, and mask objects. When enabled, objects are rendered using their vertex color data (if available). When disabled, objects are rendered with their assigned solid color.
Signature:
set_point_colors_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to show scalar (point) colors, false to use the assigned solid color. |
set_standard_view
Sets the 3D view camera to a predefined standard view direction.
Signature:
set_standard_view(view: StandardView) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
view | StandardView | The standard view direction. Use api.StandardView values (e.g., api.StandardView.XPlus, api.StandardView.ZMinus, api.StandardView.Isometric). |
reset_3d_view
Resets the 3D view camera to fit all visible objects in the scene. Adjusts the camera position, focal point, and zoom so that all visible objects fit within the view.
Signature:
reset_3d_view() -> None
reset_slice_views
Resets the 2D slice view cameras to fit the image data. Restores all slice views to their default zoom and pan positions, and resets the slice positions to the middle of the volume.
Signature:
reset_slice_views() -> None
get_3d_camera_settings
Returns the current 3D camera settings, as api.CameraSettings(). The returned structure contains the full camera pose together with the derived distance, projection parameters, and current clipping range.
Signature:
get_3d_camera_settings() -> CameraSettings
Returns: CameraSettings — The current full 3D camera state as api.CameraSettings().
set_3d_camera_settings
Applies a full 3D camera state. The distance value must match the Euclidean distance between position and focalPoint. The viewUp vector must be non-zero and must not be parallel to the viewing direction. The renderer may refine the final clipping range after the settings are applied.
Signature:
set_3d_camera_settings(settings: CameraSettings) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
settings | CameraSettings | The camera settings to apply. Use api.CameraSettings() to construct the settings structure. |
get_3d_center_of_rotation
Returns the current 3D center of rotation.
Signature:
get_3d_center_of_rotation() -> list
Returns: list — The current world-space center of rotation [x, y, z].
set_3d_center_of_rotation
Sets the 3D center of rotation.
Signature:
set_3d_center_of_rotation(center: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
center | list | The world-space center of rotation [x, y, z]. |
reset_3d_center_of_rotation
Resets the 3D center of rotation to the center of the visible scene.
Signature:
reset_3d_center_of_rotation() -> None
set_gpu_volume_rendering_enabled
Enables or disables GPU volume rendering for the 3D view. When enabled, the graphics card is used for grayscale volume rendering, which provides better quality and performance. When disabled, the CPU is used instead.
Signature:
set_gpu_volume_rendering_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | If true, enables GPU rendering; if false, uses CPU rendering. |
is_gpu_volume_rendering_enabled
Returns whether GPU volume rendering is currently enabled.
Signature:
is_gpu_volume_rendering_enabled() -> bool
Returns: bool — True if GPU volume rendering is enabled; false if CPU rendering is used.
set_gpu_memory_budget
Sets the GPU memory budget for grayscale volume rendering in the 3D view. Controls how much graphics memory the application may use for volume rendering. Lower values can reduce image quality when large datasets are displayed.
Signature:
set_gpu_memory_budget(budget: GpuMemoryBudget) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
budget | GpuMemoryBudget | The memory budget to apply. Use api.GpuMemoryBudget values (e.g., api.GpuMemoryBudget.Auto, api.GpuMemoryBudget.GB4, api.GpuMemoryBudget.GB8). |
get_gpu_memory_budget
Returns the current GPU memory budget setting.
Signature:
get_gpu_memory_budget() -> GpuMemoryBudget
Returns: GpuMemoryBudget — The active GPU memory budget value as api.GpuMemoryBudget.
set_volume_multi_volume_renderer
Enables or disables the multi-volume renderer for grayscale volumes in the 3D view. When enabled, overlapping grayscale volumes are blended together correctly. When disabled, each grayscale volume is rendered separately.
Signature:
set_volume_multi_volume_renderer(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | If true, enables multi-volume blending; if false, uses single-volume rendering. |
is_volume_multi_volume_renderer
Returns whether the multi-volume renderer is active for grayscale volumes.
Signature:
is_volume_multi_volume_renderer() -> bool
Returns: bool — True if multi-volume rendering is enabled for grayscale volumes; false otherwise.
set_mask_direct_multi_volume_renderer
Enables or disables the multi-volume renderer for direct mask previews in the 3D view. When enabled, overlapping direct mask previews are blended together correctly. When disabled, each direct mask preview is rendered separately.
Signature:
set_mask_direct_multi_volume_renderer(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | If true, enables multi-volume blending for mask previews; if false, uses separate rendering. |
is_mask_direct_multi_volume_renderer
Returns whether the multi-volume renderer is active for direct mask previews.
Signature:
is_mask_direct_multi_volume_renderer() -> bool
Returns: bool — True if multi-volume rendering is enabled for direct mask previews; false otherwise.
set_rendering_quality
Sets the interactive rendering quality for the 3D view. The quality controls how much detail is kept while the scene is being rotated, panned, or zoomed. Higher quality preserves more detail but can lower the frame rate.
Signature:
set_rendering_quality(quality: RenderingQuality) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
quality | RenderingQuality | The rendering quality to apply. Use api.RenderingQuality values (api.RenderingQuality.Adaptive, api.RenderingQuality.Normal, or api.RenderingQuality.Maximum). |
get_rendering_quality
Returns the current interactive rendering quality of the 3D view.
Signature:
get_rendering_quality() -> RenderingQuality
Returns: RenderingQuality — The active rendering quality value as api.RenderingQuality.
set_rendering_update_rate
Sets the interactive update rate (target frames per second) for the rendering views. The update rate controls the interactive speed while the scene is being manipulated. Higher values favor smoother interaction over detail. The value must be between 1 and 100. This setting has no effect while the rendering quality is set to api.RenderingQuality.Maximum, where full detail is always used during interaction.
Signature:
set_rendering_update_rate(framesPerSecond: float) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
framesPerSecond | float | The desired update rate in frames per second. Must be between 1 and 100. |
get_rendering_update_rate
Returns the current interactive update rate (frames per second) of the rendering views.
Signature:
get_rendering_update_rate() -> float
Returns: float — The active update rate in frames per second.
set_depth_peeling_enabled
Enables or disables depth peeling in the 3D view. Depth peeling renders translucent geometry in the correct order. Enabling it can reduce rendering performance.
Signature:
set_depth_peeling_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable depth peeling; false to disable it. |
is_depth_peeling_enabled
Returns whether depth peeling is currently enabled in the 3D view.
Signature:
is_depth_peeling_enabled() -> bool
Returns: bool — True if depth peeling is enabled; false otherwise.
set_fxaa_enabled
Enables or disables FXAA anti-aliasing in the 3D view. FXAA smooths the edges of 3D geometry when supported by the graphics card.
Signature:
set_fxaa_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable FXAA anti-aliasing; false to disable it. |
is_fxaa_enabled
Returns whether FXAA anti-aliasing is currently enabled in the 3D view.
Signature:
is_fxaa_enabled() -> bool
Returns: bool — True if FXAA is enabled; false otherwise.
set_hidden_line_removal_enabled
Enables or disables hidden line removal in the 3D view. When enabled, only the front wireframe surface is drawn for wireframe geometry.
Signature:
set_hidden_line_removal_enabled(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | True to enable hidden line removal; false to disable it. |
is_hidden_line_removal_enabled
Returns whether hidden line removal is currently enabled in the 3D view.
Signature:
is_hidden_line_removal_enabled() -> bool
Returns: bool — True if hidden line removal is enabled; false otherwise.