Getting Started
Getting Started with the Scripting API.
This tutorial introduces the basic concepts and usage patterns of the Scripting API. It covers creating an Application instance, accessing version information, working with projects, and displaying messages to the user.
Prerequisites
- Volvicon application must be running
- A valid license must be active
Quick Tips
- Instantiate the Application: app = api.Application()
- Use snake_case or descriptive names for variables (e.g., app, volume_operations, ai_segmentation).
- Hover over the variable to view available methods and properties. If no tooltip appears, IntelliSense does not recognize the variable name. For details, refer to the documentation.
- All API calls require positional arguments; keyword arguments are not supported.
- Example:
- mask_operations = app.get_mask_operations()
- mask_operations.smooth_mean_filter([mask], 1, 1, 1)
Creating an Application Instance​
# The Application class is the primary entry point for interacting with Volvicon.
# Create an instance to access all API functionality.
#
# For better IntelliSense support, use one of these variable names:
# - app
# - application
# - Application
app = api.Application()
Version Information​
# Get the current version of the application
version = app.get_version()
print(f"Volvicon Version: {version}")
# Get the current working directory
working_dir = app.get_working_directory()
print(f"Working Directory: {working_dir}")
Message Box Display​
# Display informational, warning, and error messages to the user
# Information message (default level)
app.show_message_box(
"This is an informational message.",
"Information"
)
# Warning message
app.show_message_box(
"This is a warning message.",
"Warning",
api.MsgBoxLevel.Warn
)
# Error message
app.show_message_box(
"This is an error message.",
"Error",
api.MsgBoxLevel.Error
)
Question Dialog​
# Display a yes/no question dialog and get user response
response = app.show_question_message_box(
"Do you want to continue with this tutorial?",
"Confirmation"
)
if response:
print("User clicked Yes")
else:
print("User clicked No")
Project Management​
# Projects contain all objects (volumes, masks, surfaces, etc.)
# Close any currently open project
app.close_project()
# Open an existing project (modify the path to an existing project file)
# Supported format: .vvcx (Volvicon project file)
# project_path = r'C:\path\to\your\project.vvcx'
# success = app.open_project(project_path)
# if success:
# print("Project opened successfully")
# else:
# print("Failed to open project")
# Save the current project
# - If a path is provided, saves to that location
# - If empty string, saves to the current project location
# app.save_project() # Save to current location
# app.save_project(r'C:\path\to\new_project.vvcx') # Save to new location
Undo and Redo​
# The API supports undo/redo for most operations
# Undo the last action
# app.undo()
# Redo the last undone action
# app.redo()
Accessing Operations Objects​
# The Application provides access to specialized operations objects
# Volume operations - for working with 3D volume images
VolumeOperations = app.get_volume_operations()
# Mask operations - for working with segmentation masks
MaskOperations = app.get_mask_operations()
# Surface operations - for working with 3D surface meshes
SurfaceOperations = app.get_surface_operations()
# Volume mesh operations - for working with tetrahedral meshes
VolumeMeshOperations = app.get_volume_mesh_operations()
# Measurement operations - for creating and analyzing measurements
MeasurementOperations = app.get_measurement_operations()
# AI segmentation - for AI-powered image segmentation
AiSegmentation = app.get_ai_segmentation()
print("Getting started tutorial completed successfully.")
Related Resources​
- API Reference - API documentation
- Quick Reference - Common methods at a glance