PreferencesOperations
Provides scripting access to the application preferences. Use this class to read the current preference values and update them from a script. The available settings correspond to the application's configurable preference values.
Import
import ScriptingApi as api
# Access via Application
app = api.Application()
ops = app.get_preferences_operations()
Methods
Properties
get_user_interface_options
Returns the current User Interface preference values.
Signature:
get_user_interface_options() -> UserInterfaceOptions
Returns: UserInterfaceOptions — The current User Interface preferences as api.UserInterfaceOptions.
get_general_options
Returns the current General preference values.
Signature:
get_general_options() -> GeneralOptions
Returns: GeneralOptions — The current General preferences as api.GeneralOptions.
get_rendering_options
Returns the current Rendering preference values.
Signature:
get_rendering_options() -> RenderingOptions
Returns: RenderingOptions — The current Rendering preferences as api.RenderingOptions.
get_view_3d_options
Returns the current 3D View preference values.
Signature:
get_view_3d_options() -> View3dOptions
Returns: View3dOptions — The current 3D View preferences as api.View3dOptions.
get_view_2d_options
Returns the current 2D View preference values.
Signature:
get_view_2d_options() -> View2dOptions
Returns: View2dOptions — The current 2D View preferences as api.View2dOptions.
set_border_in_fullscreen
Set or clear a border in fullscreen mode.
Signature:
set_border_in_fullscreen(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to show a border while the application is fullscreen. |
set_enable_high_dpi_scaling
Enable or disable high DPI scaling for the application. Changes take effect the next time the application starts.
Signature:
set_enable_high_dpi_scaling(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to enable high DPI scaling. |
set_application_font_size
Sets the application font size preset.
Signature:
set_application_font_size(size: ApplicationFontSize) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
size | ApplicationFontSize | The font size preset to apply throughout the application. Use api.ApplicationFontSize.SystemDefault |
set_maximum_undos
Set the maximum number of undos. Specify 0 to disable undos/redos and release the associated memory.
Signature:
set_maximum_undos(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The non-negative number of undo steps to keep available. |
set_maximum_camera_undos
Set the maximum number of camera undos. Specify 0 to disable camera undos/redos and release the associated memory.
Signature:
set_maximum_camera_undos(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The non-negative number of camera undo steps to keep available. |
clear_undo_history
Clear all scene undos and redos and release the memory.
Signature:
clear_undo_history() -> None
clear_camera_undo_history
Clear all camera undos and redos and release the memory.
Signature:
clear_camera_undo_history() -> None
set_undo_storage_location
Store undo data in RAM for faster access or on disk in the current working directory to reduce memory usage.
Signature:
set_undo_storage_location(location: UndoStorageLocation) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
location | UndoStorageLocation | Choose whether undo data is stored in RAM or on disk. Use api.UndoStorageLocation.Ram |
set_maximum_undo_state_memory
Set the maximum memory used by a single undo state. An undo state larger than this is written to disk instead of being kept in memory, which keeps a large volume out of memory while smaller meshes and masks can stay in memory for a fast undo. The whole-history budget can also route a snapshot to disk. This applies only while the undo storage location is RAM. The default is derived from the memory installed on the computer.
Signature:
set_maximum_undo_state_memory(megabytes: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
megabytes | int | The non-negative size in megabytes. Specify 0 for no size limit. |
set_maximum_undo_history_memory
Set the memory budget used by the object undo history. When the history exceeds this target, the oldest history is discarded where possible. The adjacent undo and redo steps are retained, so the reported total can remain above the target. States that hold no object data do not increase the measured memory, but can be removed with an older prefix to keep the undo chain contiguous. The maximum undo count still applies. The default is derived from installed memory.
Signature:
set_maximum_undo_history_memory(megabytes: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
megabytes | int | The non-negative size in megabytes. Specify 0 for no limit. |
set_maximum_recent_files
Set the maximum number of recently used files to show.
Signature:
set_maximum_recent_files(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The non-negative number of recent files to keep in the list. |
set_maximum_number_of_threads
Set the maximum number of hardware threads to use.
Signature:
set_maximum_number_of_threads(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The thread count to use. Specify a value from 1 up to the number of available hardware threads. |
set_project_file_compression_level
Set the compression level used when saving project files. Use api.ProjectFileCompressionLevel.Balanced
Signature:
set_project_file_compression_level(level: ProjectFileCompressionLevel) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
level | ProjectFileCompressionLevel | The compression preset to use when saving project files. |
set_help_improve_user_experience
Allow or block anonymous usage data collection and encrypted crash reports that help improve the application. This change may take effect the next time the application starts.
Signature:
set_help_improve_user_experience(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to allow anonymous usage reporting. |
set_zoom_to_cursor_position
Turn zooming to the current cursor position on or off.
Signature:
set_zoom_to_cursor_position(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to zoom toward the cursor position. |
set_reset_camera_when_object_is_added
Turn resetting the 3D camera each time a new object is added to the scene on or off. The manual reset of the 3D view is not affected by this setting.
Signature:
set_reset_camera_when_object_is_added(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to reset the camera whenever a new object is added. |
set_use_accurate_surface_detection_for_each_label_in_the_multilabel_mask
Enable or disable subvoxel-accurate surface reconstruction for each label in a multilabel mask. Enabling this can significantly increase computation time for masks with many labels.
Signature:
set_use_accurate_surface_detection_for_each_label_in_the_multilabel_mask(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to use the more accurate surface reconstruction mode. |
set_surface_extraction_algorithm_for_each_label_in_the_multilabel_mask
Set the surface extraction method used for each label in a multilabel mask 3D preview. This setting applies only when accurate surface detection is disabled.
Signature:
set_surface_extraction_algorithm_for_each_label_in_the_multilabel_mask(algorithm: SurfaceExtractionAlgorithm) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
algorithm | SurfaceExtractionAlgorithm | The surface extraction method as api.SurfaceExtractionAlgorithm. |
set_enable_mask_outline_cache
Enable or disable cached mask outlines for all slices of visible masks.
Signature:
set_enable_mask_outline_cache(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to cache mask outlines for faster slice navigation. |
set_spacing_comparison_decimal_places
Set the number of decimal places used when comparing image spacing with the active volume.
Signature:
set_spacing_comparison_decimal_places(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The number of decimal places to use for spacing comparisons. Supported values are from 1 to 15. |
set_origin_comparison_decimal_places
Set the number of decimal places used when comparing image origin with the active volume.
Signature:
set_origin_comparison_decimal_places(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The number of decimal places to use for origin comparisons. Supported values are from 1 to 15. |
set_resample_mismatched_images_to_match_the_projects_active_volume
Automatically resample mismatched images to match the active volume dimensions, origin, and spacing.
Signature:
set_resample_mismatched_images_to_match_the_projects_active_volume(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to resample mismatched images automatically. |
set_volume_interpolation_method_for_mismatched_images
Sets the interpolation method for mismatched volume resampling.
Signature:
set_volume_interpolation_method_for_mismatched_images(method: ImageInterpolationMethod) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
method | ImageInterpolationMethod | The interpolation method to use for volumes. Use api.ImageInterpolationMethod.Linear |
set_mask_interpolation_method_for_mismatched_images
Sets the interpolation method for mismatched mask resampling.
Signature:
set_mask_interpolation_method_for_mismatched_images(method: ImageInterpolationMethod) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
method | ImageInterpolationMethod | The interpolation method to use for masks. Use api.ImageInterpolationMethod.Nearest |
File System
get_cad_file_import_options
Returns the current CAD file import preference values.
Signature:
get_cad_file_import_options() -> CadFileImportOptions
Returns: CadFileImportOptions — The current CAD file import preferences as api.CadFileImportOptions.
get_import_options
Returns the current Import preference values.
Signature:
get_import_options() -> ImportOptions
Returns: ImportOptions — The current Import preferences, including CAD file import options, as api.ImportOptions.
set_save_application_size_and_position_on_exit
Save the application size and location on exit and restore it on startup.
Signature:
set_save_application_size_and_position_on_exit(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to restore the saved window size and position on the next launch. |
set_default_working_directory
Set the default working directory path.
Signature:
set_default_working_directory(directoryPath: str) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
directoryPath | str | The directory to use for future file operations. The directory must already exist. |
set_auto_save_frequency_minutes
Set the auto-save frequency in minutes. Specify 0 to disable automatic saving.
Signature:
set_auto_save_frequency_minutes(value: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
value | int | The non-negative number of minutes between automatic saves. |
set_allow_import_of_images_with_mismatched_geometry
Allow or block importing images whose geometry does not match the active volume according to the precision settings.
Signature:
set_allow_import_of_images_with_mismatched_geometry(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to allow importing images with mismatched geometry. |
set_import_multi_part_files_as_single_surface_object
Merge all parts in multi-part file formats into a single surface object during import.
Signature:
set_import_multi_part_files_as_single_surface_object(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to merge multi-part files into a single surface object. |
set_cad_file_import_options
Set the CAD file import preference values. Linear deflection must stay between 0.000001 and 99999.99, and angular deflection must stay between 0.1 and 99999.99.
Signature:
set_cad_file_import_options(options: CadFileImportOptions) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
options | CadFileImportOptions | The CAD import settings to apply. Create using api.CadFileImportOptions(). |
UI
set_show_splash_screen
Display or hide the splash information screen at startup.
Signature:
set_show_splash_screen(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to show the splash screen when the application starts. |
Modification
set_high_dpi_scale_factor_rounding_mode
Set how non-integer high-DPI scale factors, such as 1.25 or 1.5, are handled. Changes take effect the next time the application starts.
Signature:
set_high_dpi_scale_factor_rounding_mode(mode: HighDpiScaleFactorRoundingMode) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
mode | HighDpiScaleFactorRoundingMode | The rounding mode to apply to high-DPI scale factors. Use api.HighDpiScaleFactorRoundingMode.Auto |
set_keep_only_whole_cells_when_clipping
Enables or disables keeping only whole cells when clipping.
Signature:
set_keep_only_whole_cells_when_clipping(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to keep only whole cells while clipping. |
set_3d_clipping_outline_color
Sets the clipping box outline color.
Signature:
set_3d_clipping_outline_color(color: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
color | list | RGB color values [r, g, b], each in range [0.0, 1.0]. |
set_3d_clipping_handle_color
Sets the clipping box handle color.
Signature:
set_3d_clipping_handle_color(color: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
color | list | RGB color values [r, g, b], each in range [0.0, 1.0]. |
Creation
set_automatically_regenerate_3d_preview_if_any_visible_mask_is_modified
Automatically regenerate 3D previews for visible masks after edits. When disabled, preview generation must be triggered manually after modifications.
Signature:
set_automatically_regenerate_3d_preview_if_any_visible_mask_is_modified(enabled: bool) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
enabled | bool | Set to true to regenerate previews automatically after edits. |