Skip to content

osirix.vr_controller

Functionality for the 3D viewer.

Example usage
import osirix

vr_controller = osirix.frontmost_vr_controller()  # Raises GrpcException if not available.
vr_controller.wlww = (50, 100)  # Set the window level and width
print(f"This window has {len(vr_controller.roi_volumes())} ROI volumes")

VRController

Bases: OsirixBase

Represents one of the displayed volume render windows.

rendering_mode property writable

The rendering mode: "VR" for volume render, "MIP" for maximum intensity projection.

style property

The style of the volume render window.

title property

The title of the volume render window.

wlww property writable

The window level and window width of the viewer.

blending_controller()

The 2D ViewerController instance currently being blended (fused).

Returns:

Type Description
ViewerController

The fused ViewerController instance.

Example usage
vr_controllers = frontmost_viewer.vr_controllers()
if len(vr_controllers) > 0:
    vr_controller = vr_controllers[0]
    fused_viewer = vr_controller.blending_controller()

display_roi_volume(roi_volume)

Ensure that an input ROI is visible on the 3D display.

Parameters:

Name Type Description Default
roi_volume ROIVolume

The ROI volume to make visible.

required

hide_roi_volume(roi_volume)

Ensure that an input ROI is hidden on the 3D display.

Parameters:

Name Type Description Default
roi_volume ROIVolume

The ROI volume to hide.

required

needs_display_update()

Update the VRController display

Example usage
vr_controllers = frontmost_viewer.vr_controllers()
vr_controller = vr_controllers[0]
vr_controller.needs_display_update()

roi_volumes()

Obtain references to all volumetric ROIs.

Returns:

Type Description
List[ROIVolume]

A list of ROIVolume instances.

Example usage
frontmost_viewer = osirix.frontmost_viewer()
vr_controllers = frontmost_viewer.vr_controllers()
if len(vr_controllers) == 0:
    print("No open VR Controller.  Creating one.")
    vr_controller = frontmost_viewer.open_vr_viewer(mode="MIP")
else:
    vr_controller = vr_controllers[0]

roi_volumes = vr_controller.roi_volumes()
if len(roi_volumes) == 0:
    print("No valid ROI volumes available")
for roi_volume in roi_volumes:
    print(f"Displaying ROI volume with name {roi_volume.name}")
    roi_volume.visible = True

viewer_2d()

The 2D ViewerController instance from which the 3D viewer was started.

Returns:

Type Description
ViewerController

The ViewerController instance.

Example usage
vr_controllers = frontmost_viewer.vr_controllers()
if len(vr_controllers) > 0:
    vr_controller = vr_controllers[0]
    viewer_controller = vr_controller.viewer_2d()