VolumeOperations
Provides tools for creating, editing, and analyzing 3D volume images. Supports import/export, filtering, transformation, segmentation, and conversion between volume and mask data.
Import
import ScriptingApi as api
# Access via Application
app = api.Application()
ops = app.get_volume_operations()
Methods
Properties
get_render_properties_operations
Returns an api.VolumeRenderPropertiesOperations object.
Signature:
get_render_properties_operations() -> VolumeRenderPropertiesOperations
Returns: VolumeRenderPropertiesOperations — The api.VolumeRenderPropertiesOperations object.
get_voxel_data_type
Retrieves the voxel data (scalar) type of a specified volume.
Signature:
get_voxel_data_type(volumeName: str) -> VoxelDataType
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve the voxel data type for. |
Returns: VoxelDataType — The voxel data type of the volume as api.VoxelDataType.Unsigned8Bit, api.VoxelDataType.Signed16Bit, api.VoxelDataType.Unsigned16Bit, or api.VoxelDataType.Float32Bit.
get_volume_uint8
Retrieves the volume data as an 8-bit unsigned integer structure.
Signature:
get_volume_uint8(volumeName: str) -> VolumeUint8
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve. |
Returns: VolumeUint8 — The api.VolumeUint8 volume data as an 8-bit unsigned integer structure.
get_volume_int_16
Retrieves the volume data as a 16-bit signed integer structure.
Signature:
get_volume_int_16(volumeName: str) -> VolumeInt16
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve. |
Returns: VolumeInt16 — The api.VolumeInt16 volume data as a 16-bit signed integer structure.
get_volume_uint_16
Retrieves the volume data as a 16-bit unsigned integer structure.
Signature:
get_volume_uint_16(volumeName: str) -> VolumeUint16
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve. |
Returns: VolumeUint16 — The api.VolumeUint16 volume data as a 16-bit unsigned integer structure.
get_volume_float_32
Retrieves the volume data as a 32-bit floating-point structure.
Signature:
get_volume_float_32(volumeName: str) -> VolumeFloat32
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve. |
Returns: VolumeFloat32 — The api.VolumeFloat32 volume data as a 32-bit floating-point structure.
set_volume_uint8
Sets the volume data as an 8-bit unsigned integer structure. This method checks for dimension, spacing, and origin compatibility before setting the data. If the new data matches the existing data exactly, the update is skipped.
Signature:
set_volume_uint8(volumeName: str, volumeData: VolumeUint8) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to set. |
volumeData | any | The volume data to set. Create using api.VolumeUint8(). |
Returns: bool — True if the volume data was set successfully; False otherwise.
set_volume_int_16
Sets the volume data as a 16-bit signed integer structure. This method checks for dimension, spacing, and origin compatibility before setting the data. If the new data matches the existing data exactly, the update is skipped.
Signature:
set_volume_int_16(volumeName: str, volumeData: VolumeInt16) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to set. |
volumeData | any | The volume data to set. Create using api.VolumeInt16(). |
Returns: bool — True if the volume data was set successfully; False otherwise.
set_volume_uint_16
Sets the volume data as a 16-bit unsigned integer structure. This method checks for dimension, spacing, and origin compatibility before setting the data. If the new data matches the existing data exactly, the update is skipped.
Signature:
set_volume_uint_16(volumeName: str, volumeData: VolumeUint16) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to set. |
volumeData | any | The volume data to set. Create using api.VolumeUint16(). |
Returns: bool — True if the volume data was set successfully; False otherwise.
set_volume_float_32
Sets the volume data as a 32-bit floating-point structure. This method checks for dimension, spacing, and origin compatibility before setting the data. If the new data matches the existing data exactly, the update is skipped.
Signature:
set_volume_float_32(volumeName: str, volumeData: VolumeFloat32) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to set. |
volumeData | any | The volume data to set. Create using api.VolumeFloat32(). |
Returns: bool — True if the volume data was set successfully; False otherwise.
get_dimensions
Retrieves the dimensions of a specified volume.
Signature:
get_dimensions(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve dimensions for. |
Returns: list — The dimensions of the volume as [width, height, depth] in pixels.
get_spacing
Retrieves the spacing of a specified volume.
Signature:
get_spacing(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve spacing for. |
Returns: list — The spacing of the volume as [x, y, z] in millimeters.
get_origin
Retrieves the physical origin of a specified volume.
Signature:
get_origin(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve origin for. |
Returns: list — The origin of the volume as [x, y, z] in millimeters.
get_scalar_range
Retrieves the scalar value range of a specified volume.
Signature:
get_scalar_range(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to retrieve scalar range for. |
Returns: list — The scalar range of the volume as [min, max].
get_bounds
Retrieves the physical bounds of a specified volume.
Signature:
get_bounds(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: list — The bounds of the volume as [xMin, xMax, yMin, yMax, zMin, zMax] in millimeters.
get_physical_center
Retrieves the physical center of a specified volume.
Signature:
get_physical_center(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: list — The center of the volume as [x, y, z] in millimeters.
get_memory_size_in_m_bytes
Retrieves the current memory usage of a specified volume.
Signature:
get_memory_size_in_m_bytes(volumeName: str) -> float
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: float — Approximate memory size in megabytes.
get_current_slice_depth
Retrieves the stored slice indices for a specified volume.
Signature:
get_current_slice_depth(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: list — The current slice indices as [x, y, z].
set_active_frame_index
Activates a stored frame on a multi-frame volume. The requested index is clamped to the available frame range. The selected frame becomes the current image and metadata state of the volume. Throws a runtime exception if the volume has no stored frames.
Signature:
set_active_frame_index(volumeName: str, frameIndex: int) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the multi-frame volume. |
frameIndex | any | The requested frame index. |
get_active_frame_index
Retrieves the active stored frame index for a volume.
Signature:
get_active_frame_index(volumeName: str) -> int
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: int — The active frame index. Volumes without stored frames return 0.
get_number_of_frames
Retrieves the number of stored frames attached to a volume.
Signature:
get_number_of_frames(volumeName: str) -> int
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: int — The number of stored frames. Standard 3D volumes return 0.
is_meta_data_dictionary_empty
Checks whether the metadata dictionary of a volume is empty.
Signature:
is_meta_data_dictionary_empty(volumeName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: bool — True if the metadata dictionary is empty; otherwise, False.
get_meta_data_keys
Lists all metadata keys stored on a volume.
Signature:
get_meta_data_keys(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: list — A list of metadata keys.
has_meta_data_key
Checks whether a metadata key exists on a volume.
Signature:
has_meta_data_key(volumeName: str, key: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
key | any | The metadata key to look up. |
Returns: bool — True if the key exists; otherwise, False.
get_meta_data
Retrieves a metadata entry by key.
Signature:
get_meta_data(volumeName: str, key: str) -> DicomTag
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
key | any | The metadata key to look up. |
Returns: DicomTag — The stored metadata details as api.DicomTag. If the key is missing, empty fields are returned.
set_meta_data
Stores or replaces a metadata entry.
Signature:
set_meta_data(volumeName: str, key: str, value: DicomTag) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to update. |
key | any | The metadata key to store. |
value | any | The metadata details to store. Create using api.DicomTag(). |
set_meta_data_dictionary
Replaces the full metadata list stored on a volume.
Signature:
set_meta_data_dictionary(volumeName: str, dictionary: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to update. |
dictionary | any | Metadata entries to store. Create using api.MetaDataEntry(). |
get_meta_data_dictionary
Retrieves all metadata stored on a volume.
Signature:
get_meta_data_dictionary(volumeName: str) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to inspect. |
Returns: list — A list of metadata entries as api.MetaDataEntry. Each entry includes the lookup key and the stored details.
get_gray_value_at_voxel
Retrieves the gray value(s) at a specific voxel index within a volume. This function accesses the intensity value(s) stored at the given voxel index in the specified volume. For scalar volumes, a single gray value is returned; for multi-channel volumes, multiple values may be returned.
Signature:
get_gray_value_at_voxel(volumeName: str, voxelIndex: list) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume from which to retrieve gray values. |
voxelIndex | any | The [i, j, k] index of the voxel (in pixel coordinates) to query. |
Returns: list — A list containing the gray value(s) at the specified voxel index. Returns one value for scalar volumes, or multiple values for multi-channel volumes.
get_gray_value_at_world_coordinates
Retrieves the gray value(s) at specified world coordinates within a volume. This function computes the gray value(s) at the provided world coordinates by mapping them to the corresponding voxel location in the specified volume. For scalar volumes, a single gray value is returned; for multi-channel volumes, multiple values may be returned.
Signature:
get_gray_value_at_world_coordinates(volumeName: str, worldCoordinates: list) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume from which to retrieve gray values. |
worldCoordinates | any | The [x, y, z] position in world (physical) coordinates to query. |
Returns: list — A list containing the gray value(s) at the specified world coordinates. Returns one value for scalar volumes, or multiple values for multi-channel volumes.
curvature_anisotropic_diffusion_filter
Applies curvature anisotropic diffusion filtering to the specified volumes. Smooths images while preserving edges using anisotropic diffusion based on image curvature. Useful for edge-preserving denoising of medical images.
Signature:
curvature_anisotropic_diffusion_filter(volumeNames: list, iterations: int = 1, timeStep: float = 0.1, conductance: float = 3.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
iterations | any | Number of diffusion iterations to perform. |
timeStep | any | Time step for the diffusion equation (controls smoothing rate). |
conductance | any | Conductance parameter controlling edge sensitivity. |
discrete_gaussian_filter
Applies discrete Gaussian smoothing to the specified volumes. Performs Gaussian smoothing using a discrete Gaussian kernel. Sigma values can be specified in pixel or physical coordinates.
Signature:
discrete_gaussian_filter(volumeNames: list, sigma: list = [1.0, 1.0, 1.0], useImageSpacing: bool = False) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigma | any | Standard deviation of the Gaussian kernel in X, Y, Z directions. |
useImageSpacing | any | If true, sigma is in physical coordinates (millimeters); if False, sigma is in pixel units. |
gradient_anisotropic_diffusion_filter
Applies gradient anisotropic diffusion filtering to the specified volumes. Smooths images while preserving edges using anisotropic diffusion based on image gradients. Useful for edge-preserving denoising.
Signature:
gradient_anisotropic_diffusion_filter(volumeNames: list, iterations: int = 1, timeStep: float = 0.1, conductance: float = 3.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
iterations | any | Number of diffusion iterations to perform. |
timeStep | any | Time step for the diffusion equation (controls smoothing rate). |
conductance | any | Conductance parameter controlling edge sensitivity. |
patch_based_denoising_filter
Applies patch-based denoising filtering to the specified volumes. Denoises images using non-local means based on patch similarity. Effective for removing noise while preserving fine details.
Signature:
patch_based_denoising_filter(volumeNames: list, patchRadius: float = 2.0, noiseModel: str = "Gaussian", iterations: int = 1, fidelityWeight: float = 0.1) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
patchRadius | any | Radius of patches used for similarity comparison. |
noiseModel | any | Type of noise model (e.g., "Gaussian", "Rician", "Poisson"). |
iterations | any | Number of denoising iterations. |
fidelityWeight | any | Weight controlling fidelity to input data vs. denoising strength. |
danielsson_distance_map_filter
Computes unsigned distance maps using the Danielsson algorithm. Generates a distance map where each pixel value represents the distance from the nearest non-zero pixel in the volume image.
Signature:
danielsson_distance_map_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
signed_danielsson_distance_map_filter
Computes signed distance maps using the Danielsson algorithm. Calculates signed distance maps from the specified volumes using the Danielsson distance transform. Positive distances are inside, negative distances are outside. Results are stored back into the input volumes.
Signature:
signed_danielsson_distance_map_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. Results will replace the original volume data. |
signed_maurer_distance_map_filter
Computes signed distance maps using the Maurer algorithm. Calculates signed distance maps from the specified volumes using the Maurer distance transform. Positive distances are inside, negative distances are outside. Results are stored back into the input volumes.
Signature:
signed_maurer_distance_map_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. Results will replace the original volume data. |
slice_histogram_equalization_filter
Equalizes each slice independently along the selected axis.
Signature:
slice_histogram_equalization_filter(volumeNames: list, axis: FlipAxis = api.FlipAxis.Z) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
axis | any | Slice direction. Use api.FlipAxis.X, api.FlipAxis.Y, or api.FlipAxis.Z. |
cylindrical_histogram_equalization_filter
Equalizes intensities independently within cylindrical shells around the selected axis.
Signature:
cylindrical_histogram_equalization_filter(volumeNames: list, axis: FlipAxis = api.FlipAxis.Z) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
axis | any | Cylinder direction. Use api.FlipAxis.X, api.FlipAxis.Y, or api.FlipAxis.Z. |
adaptive_histogram_equalization_filter
Applies power-law adaptive histogram equalization using a local neighborhood window. Blends between classical local equalization (alpha=0) and unsharp masking (alpha=1), and between full equalization (beta=0) and pass-through (beta=1 with alpha=1).
Signature:
adaptive_histogram_equalization_filter(volumeNames: list, alpha: float = 0.3, beta: float = 0.3, radiusX: int = 5u, radiusY: int = 5u, radiusZ: int = 5u) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
alpha | any | Controls histogram equalization vs. unsharp masking; range [0, 1]. |
beta | any | Controls unsharp masking vs. pass-through; range [0, 1]. |
radiusX | any | Neighborhood radius along X for local statistics computation (>= 1). |
radiusY | any | Neighborhood radius along Y for local statistics computation (>= 1). |
radiusZ | any | Neighborhood radius along Z for local statistics computation (>= 1). |
File System
import_3d_images_from_disk
Imports volume image files from disk.
Signature:
import_3d_images_from_disk(fileNames: list) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
fileNames | any | A list containing the full paths of the volume image files to import. Supported file extensions are: mha, mhd, nii, nii.gz, nrrd, nhdr, hdr, img.gz, gipl, lsm, vti. Headerless files such as raw, vol, bin, and img are not accepted here because their layout cannot be read from the file. Use import_raw_volume_from_disk() for those. |
Returns: list — A list of strings containing the names of the imported volume objects. An empty list is returned if no files were imported successfully.
import_3d_image_from_disk
Imports a volume image file from disk.
Signature:
import_3d_image_from_disk(fileName: str) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
fileName | any | The full path of the volume image file to import. Supported file extensions are: mha, mhd, nii, nii.gz, nrrd, nhdr, hdr, img.gz, gipl, lsm, vti. Headerless files such as raw, vol, bin, and img are not accepted here because their layout cannot be read from the file. Use import_raw_volume_from_disk() for those. |
Returns: str — Returns the name of the imported volume object if successful; otherwise, returns an empty string.
get_dicom_series_in_directory
Scans a directory and its subdirectories for DICOM series.
Signature:
get_dicom_series_in_directory(directoryPath: str, options: DicomSeriesImportOptions = DicomSeriesImportOptions()) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
directoryPath | any | Directory containing DICOM files. |
options | any | Options that control DICOM metadata handling and series refinement. Create using api.DicomSeriesImportOptions(). |
Returns: list — Summary information as a list of api.DicomSeriesInfo for each detected series, including the Series Instance UID used for import selection.
import_dicom_series_from_directory
Imports one or more DICOM series from a directory.
Signature:
import_dicom_series_from_directory(directoryPath: str, seriesInstanceUids: list, options: DicomSeriesImportOptions = DicomSeriesImportOptions()) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
directoryPath | any | Directory containing DICOM files. |
seriesInstanceUids | any | Series Instance UID values to import. Provide one UID for a single 3D series, or multiple UIDs to create a multi-frame volume when compatible. The first UID selects the primary imported series used for the volume name, metadata, display window and level, and initial frame. |
options | any | Options that control DICOM metadata handling and series refinement. Create using api.DicomSeriesImportOptions(). |
Returns: str — Returns the name of the imported volume object if successful; otherwise, returns an empty string.
import_raw_volume_from_disk
Imports a headerless (raw) volume file from disk. A headerless file stores only the voxel values, so the layout has to be supplied by the caller. Typical file extensions are: raw, vol, bin, img.
Signature:
import_raw_volume_from_disk(fileName: str, options: RawVolumeImportOptions) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
fileName | any | The full path of the raw volume file to import. |
options | any | Voxel data type, dimensions, spacing, origin, header size, byte order, and the inversions applied after reading. Create using api.RawVolumeImportOptions(). The dimensions have no default and must be set. |
Returns: str — Returns the name of the imported volume object if successful; otherwise, returns an empty string.
import_image_stack_from_files
Imports an image stack from an ordered list of 2D image files.
Signature:
import_image_stack_from_files(fileNames: list, options: ImageStackImportOptions = ImageStackImportOptions()) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
fileNames | any | Ordered file paths that define the slice order. Supported file extensions are: bmp, jpg, jpeg, png, tif, tiff. |
options | any | Spacing, origin, and inversion settings applied after stacking. Create using api.ImageStackImportOptions(). |
Returns: str — Returns the name of the imported volume object if successful; otherwise, returns an empty string.
export_volume_images_to_disk
Exports volume images specified by their names to disk files in a given directory with a specified file extension.
Signature:
export_volume_images_to_disk(volumeNames: list, directoryPath: str, fileExtension: str = "mha") -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | A list containing the names of the volume images to export. |
directoryPath | any | The path to the directory where the volume image files will be saved. |
fileExtension | any | The file extension to use for the exported volume image files. Supported file extensions are: mha, mhd, hdr, img.gz, gipl, lsm, nrrd, nhdr, nii, nii.gz, vti. |
Returns: bool — Returns true if all volume images were successfully exported; otherwise, returns False.
export_volume_image_to_disk
Exports a volume image to a file on disk.
Signature:
export_volume_image_to_disk(volumeName: str, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume image to export. |
fileName | any | The path and name of the file to write the volume image data to. Supported file extensions are: mha, mhd, hdr, img.gz, gipl, lsm, nrrd, nhdr, nii, nii.gz, vti. File name should include the file extension, e.g., 'C:/temp/volume.mha'. |
Returns: bool — True if the export was successful; False otherwise.
export_volume_image_as_dicom_series
Exports a volume image as a DICOM series.
Signature:
export_volume_image_as_dicom_series(volumeName: str, directoryPath: str, fileNamePrefix: str = "IMG") -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume image to export. |
directoryPath | any | The directory where the DICOM files will be written. |
fileNamePrefix | any | The file name prefix used for the exported DICOM slices. |
Returns: bool — True if the export was successful; otherwise, False.
export_volume_image_as_image_stack
Exports all slices from a volume to an image stack.
Signature:
export_volume_image_as_image_stack(volumeName: str, directoryPath: str, fileNamePrefix: str = "IMG", fileExtension: str = "jpg", slicePlane: SlicePlane = api.SlicePlane.XY) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume image to export. |
directoryPath | any | The directory where the slice images will be written. |
fileNamePrefix | any | The file name prefix used for the exported slice images. |
fileExtension | any | Output image format. Supported values are: bmp, jpg, jpeg, png, ppm, tif, tiff. |
slicePlane | any | Slice plane to export. Use api.SlicePlane.XY, api.SlicePlane.XZ, or api.SlicePlane.YZ. |
Returns: bool — True if the export was successful; otherwise, False.
export_volume_image_slice_range_as_image_stack
Exports a selected slice range from a volume to an image stack.
Signature:
export_volume_image_slice_range_as_image_stack(volumeName: str, directoryPath: str, fileNamePrefix: str, fileExtension: str, slicePlane: SlicePlane, rangeFrom: int, rangeUntil: int, skipImages: int = 1) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume image to export. |
directoryPath | any | The directory where the slice images will be written. |
fileNamePrefix | any | The file name prefix used for the exported slice images. |
fileExtension | any | Output image format. Supported values are: bmp, jpg, jpeg, png, ppm, tif, tiff. |
slicePlane | any | Slice plane to export. Use api.SlicePlane.XY, api.SlicePlane.XZ, or api.SlicePlane.YZ. |
rangeFrom | any | First slice index to export. Must be non-negative and not greater than rangeUntil. |
rangeUntil | any | Last slice index to export. Must be non-negative. |
skipImages | any | Export every n-th slice. Must be at least 1; use 1 to export every slice. |
Returns: bool — True if the export was successful; otherwise, False.
export_current_slice_to_disk
Exports the current slice of a volume to a single image file.
Signature:
export_current_slice_to_disk(volumeName: str, fileName: str, slicePlane: SlicePlane = api.SlicePlane.XY) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume image to export. |
fileName | any | Output image file path including the file extension. Supported file extensions are: bmp, jpg, jpeg, png, ppm, tif, tiff. |
slicePlane | any | Slice plane to export. Use api.SlicePlane.XY, api.SlicePlane.XZ, or api.SlicePlane.YZ. |
Returns: bool — True if the export was successful; otherwise, False.
export_volume_image_as_video
Exports a volume image as a video generated from slice images.
Signature:
export_volume_image_as_video(volumeName: str, fileName: str, slicePlane: SlicePlane = api.SlicePlane.XY, overlaySlicePosition: bool = False, fps: int = 20, codec: str = "H264") -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume image to export. |
fileName | any | Output video file path. |
slicePlane | any | Slice plane to export. Use api.SlicePlane.XY, api.SlicePlane.XZ, or api.SlicePlane.YZ. |
overlaySlicePosition | any | If True, overlays the slice position on each frame. Defaults to False. |
fps | any | Frames per second. Must be at least 1. Defaults to 20. |
codec | any | Four-character video codec code such as H264 or MJPG. Must be exactly four characters. Defaults to "H264". |
Returns: bool — True if the export was successful; otherwise, False.
Creation
create_blank_volume
Creates a blank volume with specified dimensions, spacing, and voxel data type.
Signature:
create_blank_volume(volumeName: str, imageDimensions: list = [50, 50, 50], imageSpacing: list = [1.0, 1.0, 1.0], voxelType: VoxelDataType = api.VoxelDataType.Unsigned8Bit) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The desired name for the new volume. |
imageDimensions | any | The dimensions of the volume image [width, height, depth] in pixels. |
imageSpacing | any | The spacing of the volume image [x, y, z] in millimeters. |
voxelType | any | The data type of the volume voxels. Use api.VoxelDataType.Unsigned8Bit. |
Returns: str — The name of the created volume if successful; otherwise, returns an empty string.
opening_by_reconstruction_filter
Removes bright details smaller than the given radii while preserving larger structures.
Signature:
opening_by_reconstruction_filter(volumeNames: list, radius: list = [1, 1, 1]) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
radius | any | Kernel radius [x, y, z] in voxels. The X and Y radius values must be greater than zero. |
closing_by_reconstruction_filter
Removes dark details smaller than the given radii while preserving larger structures.
Signature:
closing_by_reconstruction_filter(volumeNames: list, radius: list = [1, 1, 1]) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
radius | any | Kernel radius [x, y, z] in voxels. The X and Y radius values must be greater than zero. |
create_mask_by_direct_copying
Creates mask objects by directly copying volume data. Generates new mask objects from the specified volumes by direct copying. Non-8-bit data types are rescaled to 0-255 before copying to masks.
Signature:
create_mask_by_direct_copying(volumeNames: list) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to convert to masks. |
Returns: list — List of names for the created mask objects.
create_masks_by_segmentation
Creates mask objects from pre-segmented volumes using thresholding. Generates mask objects from volumes assumed to be pre-segmented. Labels are extracted by thresholding within the specified range. Can create either a single multi-label mask or individual masks for each label.
Signature:
create_masks_by_segmentation(volumeNames: list, lowerThreshold: float, upperThreshold: float, createMultilabelMask: bool = True) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to convert to masks. |
lowerThreshold | any | Lower intensity threshold value for label extraction. |
upperThreshold | any | Upper intensity threshold value for label extraction. |
createMultilabelMask | any | If True, creates a single multi-label mask; otherwise creates individual masks per label. |
Returns: list — List of names for the created mask objects.
reconstruct_volume_using_cone_beam_reconstruction
Reconstructs a 3D volume from cone beam CT projection images using the FDK algorithm. This function performs cone beam CT reconstruction from a set of 2D projection images acquired during a circular scan trajectory. It uses the Feldkamp-Davis-Kress (FDK) filtered back-projection algorithm to reconstruct the 3D volume. The function supports both full 360° scans and short scans, with options for geometry correction, filtering, and post-processing. The reconstruction pipeline includes: - Geometry setup based on source-detector-object configuration, with optional automatic detector offset (center-of-rotation) estimation from opposing projections - Projection preprocessing: intensity offset correction, normalization, speckle removal, smoothing, scatter correction, flat-field correction, ring artifact reduction, logarithm conversion, and beam hardening correction - FDK filtering with truncation correction and a selectable ramp apodization filter (Ram-Lak, Shepp-Logan, Hann, or Hamming), then back-projection with Parker short-scan weighting and support for displaced detector geometries - Optional post-processing: intensity clamping, auto-inversion, noise reduction (median, Gaussian, or edge-preserving), sharpening, histogram contrast windowing, and auto-cropping
Signature:
reconstruct_volume_using_cone_beam_reconstruction(volumeName: str, fileNames: list, settings: ConeBeamReructionSettings) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the active volume object containing projection data. Pass an empty string if using fileNames parameter instead. |
fileNames | any | A list of file paths to the projection image files. Used when volumeName is empty. Files should be ordered sequentially by acquisition angle. Supported formats: PNG, TIFF, JPEG, and other standard image formats. |
settings | any | The cone beam reconstruction settings containing all geometry, filter, and post-processing parameters. Create using api.ConeBeamReconstructionSettings. Note: The quality of reconstruction depends heavily on accurate geometry parameters. For best results, ensure source_to_detector_distance, source_to_isocenter_distance, detector_pixel_size_x, and detector_pixel_size_y values match your actual scanning system. |
Returns: str — The name of the reconstructed volume object if successful; otherwise, returns an empty string.
General
convert_voxel_index_to_physical_point
Converts a voxel index to physical coordinates.
Signature:
convert_voxel_index_to_physical_point(volumeName: str, voxelIndex: list) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to use for the conversion. |
voxelIndex | any | The voxel index [i, j, k]. |
Returns: list — The physical point [x, y, z] in millimeters.
convert_physical_point_to_voxel_index
Converts a physical point to the nearest voxel index.
Signature:
convert_physical_point_to_voxel_index(volumeName: str, physicalPoint: list) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to use for the conversion. |
physicalPoint | any | The physical point [x, y, z] in millimeters. |
Returns: list — The nearest voxel index [i, j, k].
erase_meta_data
Removes a metadata entry from a volume.
Signature:
erase_meta_data(volumeName: str, key: str) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to update. |
key | any | The metadata key to remove. |
clear_meta_data_dictionary
Clears all metadata stored on a volume.
Signature:
clear_meta_data_dictionary(volumeName: str) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | The name of the volume to update. |
reorient
Reorients specified volumes and all available masks by rotating them around a given axis.
Signature:
reorient(volumeNames: list, angle: float, axis: list, volumeInterpolation: Interpolation = api.Interpolation.Linear, maskInterpolation: Interpolation = api.Interpolation.Nearest) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to reorient. |
angle | any | Rotation angle in degrees. |
axis | any | Rotation axis as [x, y, z] unit vector. |
volumeInterpolation | any | Interpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
maskInterpolation | any | Interpolation method for masks. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
center_at_origin
Centers specified volumes and all available masks at the origin. Adjusts the position of the specified volumes and all available masks so their geometric center aligns with the scene origin.
Signature:
center_at_origin(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to center. |
crop
Crops volumes and all available masks to the specified bounds. Removes regions outside the specified bounding box. Only cropping the region inside the bounds. If bounds are partially outside the image, only the overlapping region is retained.
Signature:
crop(volumeNames: list, bounds: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to crop. |
bounds | any | Cropping bounds [xMin, xMax, yMin, yMax, zMin, zMax] in millimeters. |
shrink
Crops volumes and all available masks to the specified bounds with shrinking. Shrinks the specified volumes and all available masks to the given bounds with output size exactly matching the bounds. Bounds can extend outside the original image. If bounds are completely outside the image, no cropping occurs.
Signature:
shrink(volumeNames: list, bounds: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to crop. |
bounds | any | Cropping bounds [xMin, xMax, yMin, yMax, zMin, zMax] in millimeters. |
pad
Adds padding to volumes and all available masks. Pads the specified volumes and all available masks by the given amount on all sides.
Signature:
pad(volumeNames: list, lowerBound: list, upperBound: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to pad. |
lowerBound | any | Padding in voxels for lower bounds [x, y, z]. |
upperBound | any | Padding in voxels for upper bounds [x, y, z]. |
resample
Resamples volumes and all available masks to new dimensions and spacing. Resamples the specified volumes and all available masks to the provided target dimensions and spacing.
Signature:
resample(volumeNames: list, desiredDimensions: list, desiredSpacing: list, volumeInterpolation: Interpolation = api.Interpolation.Linear, maskInterpolation: Interpolation = api.Interpolation.Nearest) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to resample. |
desiredDimensions | any | Target dimensions [width, height, depth] in voxels. |
desiredSpacing | any | Target spacing [x, y, z] in millimeters. |
volumeInterpolation | any | Interpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
maskInterpolation | any | Interpolation method for masks. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
flip
Flips volumes and all available masks along the specified axis. Flips the specified volumes and all available masks along the given axis. Can flip about the object's origin or center.
Signature:
flip(volumeNames: list, axis: FlipAxis, aboutOrigin: bool = False) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to flip. |
axis | any | Axis to flip along. Use api.FlipAxis.X, api.FlipAxis.Y, or api.FlipAxis.Z. |
aboutOrigin | any | If True, flip about origin; otherwise flip about center. |
swap_axes
Swaps (permutes) two spatial axes of the volumes and all available masks. Reorders the axes of the specified volumes and all available masks.
Signature:
swap_axes(volumeNames: list, pair: SwapAxesPair) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
pair | any | Axis pair to swap. Use api.SwapAxesPair.XY, api.SwapAxesPair.XZ, or api.SwapAxesPair.YZ. |
reslice
Reslices the volumes and all available masks along an arbitrary plane. The reslice plane is defined by an origin point and a unit normal vector. The output volume is resampled along the new axis system defined by the plane.
Signature:
reslice(volumeNames: list, planeOrigin: list, planeNormal: list, volumeInterpolation: Interpolation = api.Interpolation.Linear, maskInterpolation: Interpolation = api.Interpolation.Nearest) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to reslice. |
planeOrigin | any | Origin point [x, y, z] of the reslice plane in world coordinates. |
planeNormal | any | Unit normal [nx, ny, nz] of the reslice plane. |
volumeInterpolation | any | Interpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
maskInterpolation | any | Interpolation method for masks. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
pad_for_mirroring
Pads the target volume and selected masks so mirrored surfaces remain within bounds. At least one valid surface or mask object must be provided.
Signature:
pad_for_mirroring(volumeName: str, surfaceNames: list, maskNames: list, planeOrigin: list, planeNormal: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the target volume used to calculate padding. |
surfaceNames | any | Surface objects used to calculate the required padding after mirroring. |
maskNames | any | Mask objects to pad together with the volume. Pass an empty list if no masks need to be included. |
planeOrigin | any | Origin point of the mirror plane [x, y, z]. |
planeNormal | any | Normal vector of the mirror plane [x, y, z]. |
bilateral_filter
Apply bilateral filter to the specified volumes. It blurs images while preserving edges.
Signature:
bilateral_filter(volumeNames: list, domainSigmaX: float = 1.0, domainSigmaY: float = 1.0, domainSigmaZ: float = 1.0, rangeSigma: float = 1000.0, kernelRadius: int = 0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to filter. |
domainSigmaX | any | Sigma of the gaussian kernel along X in pixels. |
domainSigmaY | any | Sigma of the gaussian kernel along Y in pixels. |
domainSigmaZ | any | Sigma of the gaussian kernel along Z in pixels. |
rangeSigma | any | Sigma of the range (intensity) kernel. |
kernelRadius | any | Kernel radius in pixels for the bilateral filter. Specify zero to auto-compute the radius from the domain sigma values. |
binomial_blur_filter
Applies binomial blur filtering to the specified volumes. Computes a nearest neighbor average along each dimension repeatedly. After multiple iterations, the result approaches convolution with a Gaussian kernel.
Signature:
binomial_blur_filter(volumeNames: list, iterations: int = 1) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
iterations | any | Number of iterations that the filter will execute (higher values = more smoothing). |
curvature_flow_filter
Applies curvature flow filtering to the specified volumes. Smooths images by flowing along image curvature without explicit edge detection. Provides robust edge-preserving smoothing.
Signature:
curvature_flow_filter(volumeNames: list, iterations: int = 1, timeStep: float = 0.125) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
iterations | any | Number of curvature flow iterations. |
timeStep | any | Time step for the flow equation (controls smoothing rate). |
gaussian_filter
Applies Gaussian smoothing to the specified volumes.
Signature:
gaussian_filter(volumeNames: list, stdDev: float = 1.75, radiusFactor: float = 2.0, threeDimensional: bool = True) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to filter. |
stdDev | any | Standard deviation of the Gaussian kernel in pixel units. |
radiusFactor | any | Radius factor for kernel calculation. |
threeDimensional | any | Whether to convolve in 3D (True) or 2D (False). |
recursive_gaussian_filter
Applies recursive Gaussian smoothing to the specified volumes. Performs efficient Gaussian smoothing using recursive filtering algorithm. Provides fast computation while maintaining quality similar to standard Gaussian filtering.
Signature:
recursive_gaussian_filter(volumeNames: list, sigma: list = [1.0, 1.0, 1.0]) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigma | any | Standard deviation of the Gaussian kernel in [x, y, z] directions (in pixel units). |
mean_filter
Apply mean filtering to the specified volumes.
Signature:
mean_filter(volumeNames: list, radius: list = [1, 1, 1]) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to filter. |
radius | any | Neighborhood radius in pixels in [x, y, z]. |
median_filter
Apply median filtering to the specified volumes.
Signature:
median_filter(volumeNames: list, radius: list = [1, 1, 1]) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to filter. |
radius | any | Neighborhood radius in pixels in [x, y, z]. |
min_max_curvature_flow_filter
Applies min/max curvature flow filtering to the specified volumes. Smooths images by flowing along minimum and maximum image curvature. Provides robust smoothing with curvature-based constraints.
Signature:
min_max_curvature_flow_filter(volumeNames: list, iterations: int = 1, timeStep: float = 0.125, stencilRadius: int = 1) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
iterations | any | Number of curvature flow iterations. |
timeStep | any | Time step for the flow equation (controls smoothing rate). |
stencilRadius | any | Radius of the stencil used in curvature calculations. |
morphological_operation
Perform a morphological operation on specified volumes.
Signature:
morphological_operation(volumeNames: list, operation: MorphologicalOperation, ballRadius: list = [1, 1, 1]) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
operation | any | The morphological operation to execute. Use api.MorphologicalOperation.Erode, api.MorphologicalOperation.Dilate, etc. |
ballRadius | any | Kernel radius [x, y, z] in pixels for morphological operation. |
combine
Combines two volume images using the specified operation. Performs arithmetic or logical combine operations on two input volumes and stores the result in a target volume or creates a new volume. Supported operations include Addition, Subtraction, Multiplication, Division, Mean, Minimum, and Maximum.
Signature:
combine(inputVolume1Name: str, inputVolume2Name: str, targetVolumeName: str, operation: CombineOperation, createNewObject: bool = True) -> str
Parameters:
| Parameter | Type | Description |
|---|---|---|
inputVolume1Name | any | Name of the first input volume. |
inputVolume2Name | any | Name of the second input volume. |
targetVolumeName | any | Name of the target volume for the result. Must name an existing volume; it is required even when createNewObject is True. |
operation | any | The combine operation type. Use api.CombineOperation.Addition, api.CombineOperation.Subtraction, api.CombineOperation.Multiplication, api.CombineOperation.Division, api.CombineOperation.Mean, api.CombineOperation.Minimum, or api.CombineOperation.Maximum. |
createNewObject | any | If True, creates a new volume object; otherwise assigns result to target volume. |
Returns: str — Name of the created volume if createNewObject is True; otherwise returns an empty string.
apply_mask_to_volume
Masks a volume image using a mask object. Applies a mask to a volume by setting voxels outside the mask to a specified intensity value. Voxels within the mask region retain their original values.
Signature:
apply_mask_to_volume(volumeName: str, maskName: str, voxelIntensityValue: float = 0.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the volume to mask. |
maskName | any | Name of the mask to apply. |
voxelIntensityValue | any | Intensity value to assign to voxels outside the mask. |
invert_intensity
Invert intensity values of the specified volumes, effectively reversing their contrast.
Signature:
invert_intensity(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to update. |
butterworth_high_pass_filter
Applies Butterworth high-pass filter to the specified volumes. Performs frequency-domain high-pass filtering to enhance high-frequency components while attenuating low-frequency components. Useful for sharpening and detail enhancement.
Signature:
butterworth_high_pass_filter(volumeNames: list, xCutOff: float = 0.1, yCutOff: float = 0.1) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
xCutOff | any | Cutoff frequency for the X-axis (in appropriate frequency units). |
yCutOff | any | Cutoff frequency for the Y-axis (in appropriate frequency units). |
laplacian_edge_sharpening
Applies Laplacian-based edge sharpening to the specified volumes. Enhances edges and details in volumes using a Laplacian sharpening filter. This filter is effective for detecting and emphasizing rapid intensity changes.
Signature:
laplacian_edge_sharpening(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
convolution_based_edge_sharpening
Applies convolution-based edge sharpening to the specified volumes. Enhances edges and details in volumes using a convolution-based sharpening algorithm. This filter is useful for emphasizing transitions and improving edge definition.
Signature:
convolution_based_edge_sharpening(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigmoid_filter
Applies sigmoid transformation to the specified volumes. Performs sigmoid function operation on the target volumes. The filter's output pixel values are determined by a function of the input pixel values and the specified sigmoid parameters.
Signature:
sigmoid_filter(volumeNames: list, outputMin: float = 1.0, outputMax: float = 255.0, alpha: float = 1.0, beta: float = 1.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
outputMin | any | Minimum output value of the sigmoid function. |
outputMax | any | Maximum output value of the sigmoid function. |
alpha | any | Alpha parameter controlling the sigmoid offset. |
beta | any | Beta parameter controlling the sigmoid steepness. |
gradient_magnitude_filter
Computes the gradient magnitude for the specified volumes. Calculates the magnitude of the intensity gradient at each voxel, useful for edge detection and feature enhancement.
Signature:
gradient_magnitude_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
gradient_magnitude_recursive_gaussian_filter
Computes the gradient magnitude using recursive Gaussian filtering. Calculates the magnitude of the gradient using convolution with the first derivative of a Gaussian kernel. More efficient than standard gradient for large kernels.
Signature:
gradient_magnitude_recursive_gaussian_filter(volumeNames: list, sigma: float = 1.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigma | any | Standard deviation of the Gaussian kernel in millimeters. Must be greater than zero. |
laplacian_of_gaussian_filter
Computes the Laplacian of Gaussian response for the specified volumes. Highlights rapidly changing structures after Gaussian smoothing and is useful for feature emphasis.
Signature:
laplacian_of_gaussian_filter(volumeNames: list, sigma: float = 1.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigma | any | Standard deviation of the Gaussian kernel in millimeters. Must be greater than zero. |
regional_minima_filter
Extracts regional minima from the specified volumes. Identifies and isolates local minima regions in the image. Regional minima are connected components of pixels where all pixels have the same value.
Signature:
regional_minima_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
regional_maxima_filter
Extracts regional maxima from the specified volumes. Identifies and isolates local maxima regions in the image. Regional maxima are connected components of pixels where all pixels have the same value.
Signature:
regional_maxima_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
clamp_intensity_filter
Clamps intensity values to a requested interval. Values below the lower bound are raised to the lower bound, and values above the upper bound are reduced to the upper bound.
Signature:
clamp_intensity_filter(volumeNames: list, lowerBound: float, upperBound: float) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
lowerBound | any | Minimum allowed intensity value. Must be less than upperBound. |
upperBound | any | Maximum allowed intensity value. |
intensity_windowing_filter
Remaps a selected input intensity window to a selected output range. Intensities outside the input window are saturated to the output limits.
Signature:
intensity_windowing_filter(volumeNames: list, windowMinimum: float, windowMaximum: float, outputMinimum: float, outputMaximum: float) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
windowMinimum | any | Lower bound of the input intensity window. Must be less than windowMaximum. |
windowMaximum | any | Upper bound of the input intensity window. |
outputMinimum | any | Lower bound of the output range. Must be less than outputMaximum. |
outputMaximum | any | Upper bound of the output range. |
normalize_filter
Normalizes the intensity values of the specified volumes. Normalizes each volume by setting its mean to zero and variance to one, resulting in zero-centered, unit-variance images.
Signature:
normalize_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
unsharp_mask_filter
Enhances local contrast using 3D unsharp masking. A blurred version of the image is subtracted and the residual is added back to emphasize detail.
Signature:
unsharp_mask_filter(volumeNames: list, sigma: float = 1.0, amount: float = 0.5) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigma | any | Standard deviation of the Gaussian kernel in millimeters. Must be greater than zero. |
amount | any | Sharpening strength. Must be greater than zero. |
metal_artifact_reduction_filter
Reduces metal streaking by thresholding bright metal voxels and in-painting them from nearby tissue.
Signature:
metal_artifact_reduction_filter(volumeNames: list, metalThreshold: float, inpaintSigma: float = 1.5, maskName: str = str()) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
metalThreshold | any | Minimum intensity considered metal. |
inpaintSigma | any | Gaussian sigma used for in-painting. Must be greater than zero. |
maskName | any | Name of a binary mask that restricts the correction to the masked region; empty = no restriction. |
bad_pixel_correction_filter
Removes isolated bad voxels using a conditional median estimate.
Signature:
bad_pixel_correction_filter(volumeNames: list, mode: CBR_SpeckleRemovalMode = api.CBR_SpeckleRemovalMode.SinglePixel, thresholdMultiplier: float = 3.0) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
mode | any | Use api.CBR_SpeckleRemovalMode.SinglePixel or api.CBR_SpeckleRemovalMode.MultiPixel. Passing api.CBR_SpeckleRemovalMode.Off performs no correction. |
thresholdMultiplier | any | Outlier threshold relative to the local deviation. Must be greater than zero. Defaults to 3.0. |
scatter_correction_filter
Estimates and subtracts low-frequency scatter using a blurred copy of the image.
Signature:
scatter_correction_filter(volumeNames: list, sigma: float = 1.0, amplitude: float = 0.1) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
sigma | any | Gaussian sigma in spacing units. Must be greater than zero. |
amplitude | any | Fraction of the blurred image to subtract, in [0, 1). |
Modification
change_spacing
Changes the spacing of specified volumes and all available masks. Updates the spatial spacing of the specified volumes and all available masks. This operation does not resample the image data.
Signature:
change_spacing(volumeNames: list, spacing: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to update. |
spacing | any | New spacing [x, y, z] in millimeters. |
translate_origin
Translates the origin of specified volumes and all available masks. Moves the origin of the specified volumes and all available masks by the given vector.
Signature:
translate_origin(volumeNames: list, translation: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to translate. |
translation | any | Translation vector [x, y, z] in millimeters. |
change_origin
Changes the origin of specified volumes and all available masks. Updates the origin (starting position) of the specified volumes and all available masks. This operation does not resample or relocate the image data.
Signature:
change_origin(volumeNames: list, origin: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to update. |
origin | any | New origin [x, y, z] in millimeters. |
transform
Applies a geometric transformation to the specified volumes and all available masks. Transforms volumes and all available masks using the provided 4x4 transformation matrix. Supports different interpolation methods for volumes and masks separately.
Signature:
transform(volumeNames: list, matrix: list, volumeInterpolation: Interpolation = api.Interpolation.Linear, maskInterpolation: Interpolation = api.Interpolation.Nearest) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to transform. |
matrix | any | 16-element transformation matrix (4x4 row-major format). |
volumeInterpolation | any | Interpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
maskInterpolation | any | Interpolation method for masks. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic. |
grayscale_fill_hole_filter
Fills holes in grayscale images using morphological operations. Removes interior holes and cavities from grayscale images while preserving the outer boundary. Useful for cleaning segmentation results.
Signature:
grayscale_fill_hole_filter(volumeNames: list, fullyConnected: bool = False) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
fullyConnected | any | If True, uses 26-connectivity; otherwise uses 6-connectivity. |
grayscale_grind_peak_filter
Removes local maxima (peaks) from grayscale images. Performs a morphological operation to suppress local maxima peaks while preserving overall image structure. Complementary to hole filling.
Signature:
grayscale_grind_peak_filter(volumeNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
rescale_intensity_filter
Rescales intensity values to a specified range for the specified volumes. Applies linear transformation to remap intensity values from the current range to the specified min/max range.
Signature:
rescale_intensity_filter(volumeNames: list, minIntensity: float, maxIntensity: float) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeNames | any | Names of the volumes to process. |
minIntensity | any | Minimum intensity value for the output range. Must be less than maxIntensity. |
maxIntensity | any | Maximum intensity value for the output range. |
UI
surface_guided_padding
Pads all volumes and all masks in the scene based on surface-guided constraints. Automatically calculates the required padding from the provided surface objects using the named target volume, then applies that padding (plus a one-voxel margin on every side) to all volumes and all masks in the scene.
Signature:
surface_guided_padding(volumeName: str, surfaceNames: list) -> None
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the target volume used only to calculate the required padding. |
surfaceNames | any | Surface objects used to calculate the required padding. |