Skip to main content

Application

Core

The root application class for the Scripting API.

Import

import ScriptingApi as api

# Create application instance
app = api.Application()

Methods

Properties

get_version

Retrieves the version string.

Signature:

get_version() -> str

Returns: str — A string representing the version.


get_project_file_path

Retrieves the file path of the currently opened project.

Signature:

get_project_file_path() -> str

Returns: str — A string representing the file path of the currently opened project.


set_volumes_visible

Sets the visibility state of specified volume objects.

Signature:

set_volumes_visible(volumeNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyA list containing the names of the volumes to modify.
visibleanyIf true, makes the volumes visible; if false, hides them.

isolate_volumes

Isolates specified volumes by showing only those and hiding all others.

Signature:

isolate_volumes(volumeNames: list) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyA list containing the names of the volumes to isolate. If empty, shows all volumes.

set_active_volume

Sets the active volume by its name. Active volume is the one that is in bold in the volume scene tree and used for certain operations.

Signature:

set_active_volume(volumeName: str) -> None

Parameters:

ParameterTypeDescription
volumeNameanyThe name of the volume to set as active.

get_active_volume_name

Returns the name of the currently active volume.

Signature:

get_active_volume_name() -> str

Returns: str — The name of the currently active volume if any; otherwise, returns an empty string.


get_visible_volume_names

Returns the names of visible volume objects in the current project.

Signature:

get_visible_volume_names() -> list

Returns: list — A list of strings containing the names of all volumes.


get_all_volume_names

Returns the names of all volume objects in the current project.

Signature:

get_all_volume_names() -> list

Returns: list — A list of strings containing the names of all volumes.


set_masks_visible

Sets the visibility state of specified mask objects.

Signature:

set_masks_visible(maskNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
maskNamesanyA list containing the names of the masks to modify.
visibleanyIf true, makes the masks visible; if false, hides them.

isolate_masks

Isolates specified masks by showing only those and hiding all others.

Signature:

isolate_masks(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNamesanyA list containing the names of the masks to isolate. If empty, shows all masks.

set_active_mask

Sets the active mask by its name. Active mask is the one that is in bold in the mask scene tree and used for certain operations.

Signature:

set_active_mask(maskName: str) -> None

Parameters:

ParameterTypeDescription
maskNameanyThe name of the mask to set as active.

get_active_mask_name

Returns the name of the currently active mask.

Signature:

get_active_mask_name() -> str

Returns: str — The name of the currently active mask if any; otherwise, returns an empty string.


get_visible_mask_names

Returns the names of visible mask objects in the current project.

Signature:

get_visible_mask_names() -> list

Returns: list — A list of strings containing the names of all masks.


get_all_mask_names

Returns the names of all mask objects in the current project.

Signature:

get_all_mask_names() -> list

Returns: list — A list of strings containing the names of all masks.


set_surfaces_visible

Sets the visibility state of specified surface objects.

Signature:

set_surfaces_visible(surfaceNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
surfaceNamesanyA list containing the names of the surfaces to modify.
visibleanyIf true, makes the surfaces visible; if false, hides them.

isolate_surfaces

Isolates specified surfaces by showing only those and hiding all others.

Signature:

isolate_surfaces(surfaceNames: list) -> None

Parameters:

ParameterTypeDescription
surfaceNamesanyA list containing the names of the surfaces to isolate. If empty, shows all surfaces.

set_active_surface

Sets the active surface by its name. Active surface is the one that is in bold in the surface scene tree and used for certain operations.

Signature:

set_active_surface(surfaceName: str) -> None

Parameters:

ParameterTypeDescription
surfaceNameanyThe name of the surface to set as active.

get_active_surface_name

Returns the name of the currently active surface.

Signature:

get_active_surface_name() -> str

Returns: str — The name of the currently active surface if any; otherwise, returns an empty string.


get_visible_surface_names

Returns the names of visible surface objects in the current project.

Signature:

get_visible_surface_names() -> list

Returns: list — A list of strings containing the names of all surfaces.


get_all_surface_names

Returns the names of all surface objects in the current project.

Signature:

get_all_surface_names() -> list

Returns: list — A list of strings containing the names of all surfaces.


set_volume_meshes_visible

Sets the visibility state of specified volume mesh objects.

Signature:

set_volume_meshes_visible(volumeMeshNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyA list containing the names of the volume meshes to modify.
visibleanyIf true, makes the volume meshes visible; if false, hides them.

isolate_volume_meshes

Isolates specified volume meshes by showing only those and hiding all others.

Signature:

isolate_volume_meshes(volumeMeshNames: list) -> None

Parameters:

ParameterTypeDescription
volumeMeshNamesanyA list containing the names of the volume meshes to isolate. If empty, shows all volume meshes.

set_active_volume_mesh

Sets the active volume mesh by its name. Active volume mesh is the one that is in bold in the volume mesh scene tree and used for certain operations.

Signature:

set_active_volume_mesh(volumeMeshName: str) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe name of the volume mesh to set as active.

get_active_volume_mesh_name

Returns the name of the currently active volume mesh.

Signature:

get_active_volume_mesh_name() -> str

Returns: str — The name of the currently active volume mesh if any; otherwise, returns an empty string.


get_visible_volume_mesh_names

Returns the names of visible volume mesh objects in the current project.

Signature:

get_visible_volume_mesh_names() -> list

Returns: list — A list of strings containing the names of all volume meshes.


get_all_volume_mesh_names

Returns the names of all volume mesh objects in the current project.

Signature:

get_all_volume_mesh_names() -> list

Returns: list — A list of strings containing the names of all volume meshes.


set_primitives_visible

Sets the visibility state of specified primitive objects.

Signature:

set_primitives_visible(primitiveNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
primitiveNamesanyA list containing the names of the primitives to modify.
visibleanyIf true, makes the primitives visible; if false, hides them.

isolate_primitives

Isolates specified primitives by showing only those and hiding all others.

Signature:

isolate_primitives(primitiveNames: list) -> None

Parameters:

ParameterTypeDescription
primitiveNamesanyA list containing the names of the primitives to isolate. If empty, shows all primitives.

get_visible_primitive_names

Returns the names of visible primitive objects in the current project.

Signature:

get_visible_primitive_names() -> list

Returns: list — A list of strings containing the names of all visible primitives.


get_all_primitive_names

Returns the names of all primitive objects in the current project.

Signature:

get_all_primitive_names() -> list

Returns: list — A list of strings containing the names of all primitives.


set_analyses_visible

Sets the visibility state of specified analysis objects.

Signature:

set_analyses_visible(analysisNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
analysisNamesanyA list containing the names of the analyses to modify.
visibleanyIf true, makes the analyses visible; if false, hides them.

rename_analysis

Renames an analysis object.

Signature:

rename_analysis(analysisName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
analysisNameanyThe current name of the analysis to rename.
newNameanyThe new name to assign to the analysis.

set_active_analysis

Sets the active analysis by its name. Active analysis is the one that is currently selected and used for certain operations.

Signature:

set_active_analysis(analysisName: str) -> None

Parameters:

ParameterTypeDescription
analysisNameanyThe name of the analysis to set as active.

get_active_analysis_name

Returns the name of the currently active analysis.

Signature:

get_active_analysis_name() -> str

Returns: str — The name of the currently active analysis if any; otherwise, returns an empty string.


get_visible_analysis_names

Returns the names of visible analysis objects in the current project.

Signature:

get_visible_analysis_names() -> list

Returns: list — A list of strings containing the names of all visible analyses.


get_all_analysis_names

Returns the names of all analysis objects in the current project.

Signature:

get_all_analysis_names() -> list

Returns: list — A list of strings containing the names of all analyses.


set_mask_3d_preview_quality

Sets the quality level for 3D mask previews.

Signature:

set_mask_3d_preview_quality(quality: Mask3dPreviewQuality) -> None

Parameters:

ParameterTypeDescription
qualityanyThe desired quality level for the 3D mask preview. Use api.Mask3dPreviewQuality.Low, api.Mask3dPreviewQuality.Medium, or api.Mask3dPreviewQuality.High.

get_mask_3d_preview_quality

Retrieves the current mask preview quality setting.

Signature:

get_mask_3d_preview_quality() -> Mask3dPreviewQuality

Returns: Mask3dPreviewQuality — The current mask preview quality (e.g., api.Mask3dPreviewQuality.Medium).


get_volume_operations

Returns a VolumeOperations object.

Signature:

get_volume_operations() -> VolumeOperations

Returns: VolumeOperations — A VolumeOperations object.


get_mask_operations

Returns a MaskOperations object.

Signature:

get_mask_operations() -> MaskOperations

Returns: MaskOperations — A MaskOperations object.


get_surface_operations

Returns a SurfaceOperations object.

Signature:

get_surface_operations() -> SurfaceOperations

Returns: SurfaceOperations — A SurfaceOperations object.


get_volume_mesh_operations

Returns a VolumeMeshOperations object.

Signature:

get_volume_mesh_operations() -> VolumeMeshOperations

Returns: VolumeMeshOperations — A VolumeMeshOperations object.


get_fem_operations

Returns a FemOperations object for finite element model operations.

Signature:

get_fem_operations() -> FemOperations

Returns: FemOperations — A FemOperations object for managing FEM models, materials, sets, and exports.


get_primitive_operations

Returns a PrimitiveOperations object for primitive/ROI operations.

Signature:

get_primitive_operations() -> PrimitiveOperations

Returns: PrimitiveOperations — A PrimitiveOperations object for creating and managing 3D primitive shapes.


get_registration_operations

Returns an RegistrationOperations object for global registration.

Signature:

get_registration_operations() -> RegistrationOperations

Returns: RegistrationOperations — A RegistrationOperations object providing access to registration functionality.


get_analysis_operations

Returns an AnalysisOperations object for analysis operations.

Signature:

get_analysis_operations() -> AnalysisOperations

Returns: AnalysisOperations — An AnalysisOperations object providing access to analysis functionality.


get_ai_segmentation

Returns an AiSegmentation object for AI-based medical image segmentation.

Signature:

get_ai_segmentation() -> AiSegmentation

Returns: AiSegmentation — An AiSegmentation object providing access to AI segmentation functionality.


get_view_operations

Returns a ViewOperations object for controlling application views and rendering.

Signature:

get_view_operations() -> ViewOperations

Returns: ViewOperations — A ViewOperations object providing access to layout, orientation, camera, representation, shading, and visualization controls.


File System

get_working_directory

Retrieves the current working directory as a string.

Signature:

get_working_directory() -> str

Returns: str — A string representing the current working directory.


save_project

Saves the current project to the specified file path.

Signature:

save_project(filePath: str = "") -> bool

Parameters:

ParameterTypeDescription
filePathanyThe path to the file where the project should be saved. If empty, the current project will be saved to its existing path.

Returns: bool — true if the project was saved successfully; false otherwise.


save_snapshot_to_disk

Captures a snapshot of the specified type and saves it to disk.

Signature:

save_snapshot_to_disk(snapshotType: SnapshotType, filePath: str, format: str = "PNG") -> bool

Parameters:

ParameterTypeDescription
snapshotTypeanyThe type of snapshot to capture. Use api.SnapshotType values (e.g., api.SnapshotType.Scene, api.SnapshotType.View3D).
filePathanyThe full path where the image will be saved.
formatanyThe image format (e.g., "PNG", "JPEG"). Defaults to "PNG".

Returns: bool — True if the image was saved successfully, false otherwise.


UI

show_message_box

Displays a message box with a specified text, title, and level. If the title is not specified, it defaults to "Information". If the level is not specified, it defaults to api.MsgBoxLevel.Info.

Signature:

show_message_box(text: str, title: str = "Information", level: MsgBoxLevel = api.MsgBoxLevel.Info) -> None

Parameters:

ParameterTypeDescription
textanyThe message text to display in the message box.
titleanyThe title to display on the message box title bar.
levelanyThe level or type of the message box. Use api.MsgBoxLevel.Info, api.MsgBoxLevel.Warn, or api.MsgBoxLevel.Error.

show_question_message_box

Displays a question message box with the specified text and title. If the title is not specified, it defaults to "Question".

Signature:

show_question_message_box(text: str, title: str = "Question") -> bool

Parameters:

ParameterTypeDescription
textanyThe message text to display in the question box.
titleanyThe title to display on the question box title bar.

Returns: bool — true if the user clicked "Yes", false otherwise.


Project Management

open_project

Opens a project from the specified file path.

Signature:

open_project(filePath: str) -> bool

Parameters:

ParameterTypeDescription
filePathanyThe path to the project file to open.

Returns: bool — true if the project was opened successfully; false otherwise.


close_project

Closes the currently opened project.

Signature:

close_project() -> None

General

undo

Undoes the last action in the current project.

Signature:

undo() -> None

redo

Redoes the last undone action in the current project.

Signature:

redo() -> None

duplicate_volumes

Duplicates volume objects with the specified names.

Signature:

duplicate_volumes(volumeNames: list) -> list

Parameters:

ParameterTypeDescription
volumeNamesanyA list containing the names of the volumes to duplicate.

Returns: list — A list of names for the duplicated volumes.


delete_volumes

Deletes volume objects with the specified names.

Signature:

delete_volumes(volumeNames: list) -> bool

Parameters:

ParameterTypeDescription
volumeNamesanyA list containing the names of the volumes to delete.

Returns: bool — true if all specified volumes were successfully deleted; false otherwise.


delete_all_volumes

Deletes all volume objects, optionally displaying a message box.

Signature:

delete_all_volumes(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all volumes were successfully deleted; otherwise, false.


rename_volume

Renames a volume object.

Signature:

rename_volume(volumeName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
volumeNameanyThe current name of the volume to rename.
newNameanyThe new name to assign to the volume.

duplicate_masks

Duplicates mask objects with the specified names.

Signature:

duplicate_masks(maskNames: list) -> list

Parameters:

ParameterTypeDescription
maskNamesanyA list containing the names of the masks to duplicate.

Returns: list — A list of names for the duplicated masks.


delete_masks

Deletes mask objects with the specified names.

Signature:

delete_masks(maskNames: list) -> bool

Parameters:

ParameterTypeDescription
maskNamesanyA list containing the names of the masks to delete.

Returns: bool — true if all specified masks were successfully deleted; false otherwise.


delete_all_masks

Deletes all mask objects, optionally displaying a message box.

Signature:

delete_all_masks(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all masks were successfully deleted; otherwise, false.


rename_mask

Renames a mask object.

Signature:

rename_mask(maskName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
maskNameanyThe current name of the mask to rename.
newNameanyThe new name to assign to the mask.

duplicate_surfaces

Duplicates surface objects with the specified names.

Signature:

duplicate_surfaces(surfaceNames: list) -> list

Parameters:

ParameterTypeDescription
surfaceNamesanyA list containing the names of the surfaces to duplicate.

Returns: list — A list of names for the duplicated surfaces.


delete_surfaces

Deletes surface objects with the specified names.

Signature:

delete_surfaces(surfaceNames: list) -> bool

Parameters:

ParameterTypeDescription
surfaceNamesanyA list containing the names of the surfaces to delete.

Returns: bool — true if all specified surfaces were successfully deleted; false otherwise.


delete_all_surfaces

Deletes all surface objects, optionally displaying a message box.

Signature:

delete_all_surfaces(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all surfaces were successfully deleted; otherwise, false.


rename_surface

Renames a surface object.

Signature:

rename_surface(surfaceName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
surfaceNameanyThe current name of the surface to rename.
newNameanyThe new name to assign to the surface.

duplicate_volume_meshes

Duplicates volume mesh objects with the specified names.

Signature:

duplicate_volume_meshes(volumeMeshNames: list) -> list

Parameters:

ParameterTypeDescription
volumeMeshNamesanyA list containing the names of the volume meshes to duplicate.

Returns: list — A list of names for the duplicated volume meshes.


delete_volume_meshes

Deletes volume mesh objects with the specified names.

Signature:

delete_volume_meshes(volumeMeshNames: list) -> bool

Parameters:

ParameterTypeDescription
volumeMeshNamesanyA list containing the names of the volume meshes to delete.

Returns: bool — true if all specified volume meshes were successfully deleted; false otherwise.


delete_all_volume_meshes

Deletes all volume mesh objects, optionally displaying a message box.

Signature:

delete_all_volume_meshes(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all volume meshes were successfully deleted; otherwise, false.


rename_volume_mesh

Renames a volume mesh object.

Signature:

rename_volume_mesh(volumeMeshName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
volumeMeshNameanyThe current name of the volume mesh to rename.
newNameanyThe new name to assign to the volume mesh.

duplicate_primitives

Duplicates primitive objects with the specified names.

Signature:

duplicate_primitives(primitiveNames: list) -> list

Parameters:

ParameterTypeDescription
primitiveNamesanyA list containing the names of the primitives to duplicate.

Returns: list — A list of names for the duplicated primitives.


delete_primitives

Deletes primitive objects with the specified names.

Signature:

delete_primitives(primitiveNames: list) -> bool

Parameters:

ParameterTypeDescription
primitiveNamesanyA list containing the names of the primitives to delete.

Returns: bool — true if all specified primitives were successfully deleted; false otherwise.


delete_all_primitives

Deletes all primitive objects, optionally displaying a message box.

Signature:

delete_all_primitives(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all primitives were successfully deleted; otherwise, false.


rename_primitive

Renames a primitive object.

Signature:

rename_primitive(primitiveName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
primitiveNameanyThe current name of the primitive to rename.
newNameanyThe new name to assign to the primitive.

duplicate_analyses

Duplicates analysis objects with the specified names.

Signature:

duplicate_analyses(analysisNames: list) -> list

Parameters:

ParameterTypeDescription
analysisNamesanyA list containing the names of the analyses to duplicate.

Returns: list — A list of names for the duplicated analyses.


delete_analyses

Deletes analysis objects with the specified names.

Signature:

delete_analyses(analysisNames: list) -> bool

Parameters:

ParameterTypeDescription
analysisNamesanyA list containing the names of the analyses to delete.

Returns: bool — True if all specified analyses were successfully deleted; false otherwise.


delete_all_analyses

Deletes all analysis objects, optionally displaying a message box.

Signature:

delete_all_analyses(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all analyses were successfully deleted; otherwise, false.


remove_mask_3d_preview

Removes 3D mask previews corresponding to the specified mask names.

Signature:

remove_mask_3d_preview(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNamesanyA list containing the names of the masks whose 3D previews should be removed.

remove_all_mask_3d_previews

Removes all mask 3D previews.

Signature:

remove_all_mask_3d_previews() -> None

grab_snapshot

Captures a snapshot of the specified type and returns it as image data. This function captures a snapshot from the application, including options for capturing the full application window, the 3D scene, or specific view windows such as 2D slices (Right, Front, Top) or various 3D viewing angles.

Signature:

grab_snapshot(snapshotType: SnapshotType) -> Image2D

Parameters:

ParameterTypeDescription
snapshotTypeanyThe type of snapshot to capture. Use api.SnapshotType values (e.g., api.SnapshotType.Scene, api.SnapshotType.View3D).

Returns: Image2D — A Image2D struct containing the captured image data, width, height, and format.


Analysis

duplicate_measurements

Duplicates measurement objects with the specified names.

Signature:

duplicate_measurements(measurementNames: list) -> list

Parameters:

ParameterTypeDescription
measurementNamesanyA list containing the names of the measurements to duplicate.

Returns: list — A list of names for the duplicated measurements.


delete_measurements

Deletes measurement objects with the specified names.

Signature:

delete_measurements(measurementNames: list) -> bool

Parameters:

ParameterTypeDescription
measurementNamesanyA list containing the names of the measurements to delete.

Returns: bool — true if all specified measurements were successfully deleted; False otherwise.


delete_all_measurements

Deletes all measurement objects, optionally displaying a message box.

Signature:

delete_all_measurements(showMsgBox: bool = False) -> bool

Parameters:

ParameterTypeDescription
showMsgBoxanyIf true, a message box is shown during the operation. Defaults to false.

Returns: bool — True if all measurements were successfully deleted; otherwise, false.


set_measurements_visible

Sets the visibility state of specified measurement objects.

Signature:

set_measurements_visible(measurementNames: list, visible: bool) -> None

Parameters:

ParameterTypeDescription
measurementNamesanyA list containing the names of the measurements to modify.
visibleanyIf true, makes the measurements visible; if false, hides them.

isolate_measurements

Isolates specified measurements by showing only those and hiding all others.

Signature:

isolate_measurements(measurementNames: list) -> None

Parameters:

ParameterTypeDescription
measurementNamesanyA list containing the names of the measurements to isolate. If empty, shows all measurements.

rename_measurement

Renames a measurement object.

Signature:

rename_measurement(measurementName: str, newName: str) -> None

Parameters:

ParameterTypeDescription
measurementNameanyThe current name of the measurement to rename.
newNameanyThe new name to assign to the measurement.

get_visible_measurement_names

Returns the names of visible measurement objects in the current project.

Signature:

get_visible_measurement_names() -> list

Returns: list — A list of strings containing the names of all measurements.


get_all_measurement_names

Returns the names of all measurement objects in the current project.

Signature:

get_all_measurement_names() -> list

Returns: list — A list of strings containing the names of all measurements.


get_measurement_operations

Returns a MeasurementOperations object.

Signature:

get_measurement_operations() -> MeasurementOperations

Returns: MeasurementOperations — A MeasurementOperations object.


get_measure_operations

Returns a MeasureOperations object for statistics and measurement operations.

Signature:

get_measure_operations() -> MeasureOperations

Returns: MeasureOperations — A MeasureOperations object providing access to statistics, histograms, mesh quality, and measurement functionality.


Creation

generate_mask_3d_preview

Generates 3D previews for the specified masks.

Signature:

generate_mask_3d_preview(maskNames: list) -> None

Parameters:

ParameterTypeDescription
maskNamesanyA list containing the names of the masks for which to generate 3D previews.

See Also