Skip to main content

VolumeOperations

Operations

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 a VolumeRenderPropertiesOperations object.

Signature:

get_render_properties_operations() -> VolumeRenderPropertiesOperations

Returns: VolumeRenderPropertiesOperations — A VolumeRenderPropertiesOperations object.


get_dimensions

Retrieves the dimensions of a specified volume.

Signature:

get_dimensions(volumeName: str) -> list

Parameters:

ParameterTypeDescription
volumeNameanyThe 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:

ParameterTypeDescription
volumeNameanyThe 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:

ParameterTypeDescription
volumeNameanyThe 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:

ParameterTypeDescription
volumeNameanyThe name of the volume to retrieve scalar range for.

Returns: list — The scalar range of the volume as [min, max].


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:

ParameterTypeDescription
volumeNameanyThe name of the volume from which to retrieve gray values.
voxelIndexanyThe [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:

ParameterTypeDescription
volumeNameanyThe name of the volume from which to retrieve gray values.
worldCoordinatesanyThe [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, timeStep: float, conductance: float) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
iterationsanyNumber of diffusion iterations to perform.
timeStepanyTime step for the diffusion equation (controls smoothing rate).
conductanceanyConductance 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, useImageSpacing: bool) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
sigmaanyStandard deviation of the Gaussian kernel in X, Y, Z directions.
useImageSpacinganyIf 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, timeStep: float, conductance: float) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
iterationsanyNumber of diffusion iterations to perform.
timeStepanyTime step for the diffusion equation (controls smoothing rate).
conductanceanyConductance 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, noiseModel: str, iterations: int, fidelityWeight: float) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
patchRadiusanyRadius of patches used for similarity comparison.
noiseModelanyType of noise model (e.g., "Gaussian", "Rician", "Poisson").
iterationsanyNumber of denoising iterations.
fidelityWeightanyWeight 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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process. Results will replace the original volume data.

File System

import_3d_images_from_disk

Imports volume image files from disk.

Signature:

import_3d_images_from_disk(fileNames: list) -> list

Parameters:

ParameterTypeDescription
fileNamesanyA list containing the full paths of the volume image files to import. Supported file extensions are: img.gz, hdr, img, mha, mhd, nii, nii.gz, nia, nia.gz, nrrd, nhdr, gipl, gipl.gz, lsm, his, hnc, edf, vti

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:

ParameterTypeDescription
fileNameanyThe full path of the volume image file to import. Supported file extensions are: img.gz, hdr, img, mha, mhd, nii, nii.gz, nia, nia.gz, nrrd, nhdr, gipl, gipl.gz, lsm, his, hnc, edf, vti

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) -> bool

Parameters:

ParameterTypeDescription
volumeNamesanyA list containing the names of the volume images to export.
directoryPathanyThe path to the directory where the volume image files will be saved.
fileExtensionanyThe file extension to use for the exported volume image files. Supported file extensions are: mha, mhd, hdr, 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:

ParameterTypeDescription
volumeNameanyThe name of the volume image to export.
fileNameanyThe path and name of the file to write the volume image data to. Supported file extensions are: mha, mhd, hdr, 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.


Creation

create_blank_volume

Creates a blank volume with specified dimensions, spacing, and voxel data type.

Signature:

create_blank_volume(volumeName: str, imageDimensions: list, imageSpacing: list, voxelType: VoxelDataType = api.VoxelDataType.Unsigned8Bit) -> str

Parameters:

ParameterTypeDescription
volumeNameanyThe desired name for the new volume.
imageDimensionsanyThe dimensions of the volume image [width, height, depth] in pixels.
imageSpacinganyThe spacing of the volume image [x, y, z] in millimeters.
voxelTypeanyThe 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.


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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to convert to masks.
lowerThresholdanyLower intensity threshold value for label extraction.
upperThresholdanyUpper intensity threshold value for label extraction.
createMultilabelMaskanyIf 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 - FDK filtering with optional truncation correction and Hann windowing - Back-projection with support for displaced detector geometries - Optional post-processing: auto-inversion, cropping, and sharpening

Signature:

reconstruct_volume_using_cone_beam_reconstruction(volumeName: str, fileNames: list, settings: ConeBeamReructionSettings) -> str

Parameters:

ParameterTypeDescription
volumeNameanyThe name of the active volume object containing projection data. Pass an empty string if using fileNames parameter instead.
fileNamesanyA 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.
settingsanyThe cone beam reconstruction settings containing all geometry, filter, and post-processing parameters. Use 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

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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to reorient.
angleanyRotation angle in degrees.
axisanyRotation axis as [x, y, z] unit vector.
volumeInterpolationanyInterpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic.
maskInterpolationanyInterpolation 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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to crop.
boundsanyCropping 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to crop.
boundsanyCropping 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to pad.
lowerBoundanyPadding in voxels for lower bounds [x, y, z].
upperBoundanyPadding 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to resample.
desiredDimensionsanyTarget dimensions [width, height, depth] in voxels.
desiredSpacinganyTarget spacing [x, y, z] in millimeters.
volumeInterpolationanyInterpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic.
maskInterpolationanyInterpolation 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to flip.
axisanyAxis to flip along. Use api.FlipAxis.X, api.FlipAxis.Y, or api.FlipAxis.Z.
aboutOriginanyIf 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
pairanyAxis pair to swap. Use api.SwapAxesPair.XY, api.SwapAxesPair.XZ, or api.SwapAxesPair.YZ.

pad

Pad the project's image data to ensure surfaces and masks remain within bounds after mirroring.

Signature:

pad(volumeName: str, surfaceNames: list, maskNames: list, planeOrigin: list, planeNormal: list) -> None

Parameters:

ParameterTypeDescription
volumeNameanyName of the volume object to calculate geometry for padding.
surfaceNamesanyNames of surfaces to consider for padding calculation. If not empty, padding will be calculated to keep the surfaces within bounds after padding.
maskNamesanyNames of masks to consider for padding calculation. If not empty, padding will be calculated to keep the mask preview surfaces within bounds after padding.
planeOriginanyOrigin point of the mirror plane [x, y, z].
planeNormalanyNormal 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, domainSigma: float, rangeSigma: float, kernelRadius: int) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to filter.
domainSigmaanySigma of the gaussian kernel.
rangeSigmaanySigma of the range mask kernel.
kernelRadiusanyKernel radius for bilateral filter (specify zero to auto compute).

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) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
iterationsanyNumber 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, timeStep: float) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
iterationsanyNumber of curvature flow iterations.
timeStepanyTime step for the flow equation (controls smoothing rate).

gaussian_filter

Applies Gaussian smoothing to the specified volumes.

Signature:

gaussian_filter(volumeNames: list, stdDev: float, radiusFactor: float, threeDimensional: bool = True) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to filter.
stdDevanyStandard deviation of the Gaussian kernel in pixel units.
radiusFactoranyRadius factor for kernel calculation.
threeDimensionalanyWhether 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) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
sigmaanyStandard 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) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to filter.
radiusanyNeighborhood radius in pixels in [x, y, z].

median_filter

Apply median filtering to the specified volumes.

Signature:

median_filter(volumeNames: list, radius: list) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to filter.
radiusanyNeighborhood 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, timeStep: float, stencilRadius: int) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
iterationsanyNumber of curvature flow iterations.
timeStepanyTime step for the flow equation (controls smoothing rate).
stencilRadiusanyRadius 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) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
operationanyThe morphological operation to execute. Use api.MorphologicalOperation.Erode, api.MorphologicalOperation.Dilate, etc.
ballRadiusanyKernel 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:

ParameterTypeDescription
inputVolume1NameanyName of the first input volume.
inputVolume2NameanyName of the second input volume.
targetVolumeNameanyName of the target volume for the result.
operationanyThe 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.
createNewObjectanyIf 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) -> None

Parameters:

ParameterTypeDescription
volumeNameanyName of the volume to mask.
maskNameanyName of the mask to apply.
voxelIntensityValueanyIntensity 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:

ParameterTypeDescription
volumeNamesanyNames 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, yCutOff: float) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
xCutOffanyCutoff frequency for the X-axis (in appropriate frequency units).
yCutOffanyCutoff 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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames 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, outputMax: float, alpha: float, beta: float) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
outputMinanyMinimum output value of the sigmoid function.
outputMaxanyMaximum output value of the sigmoid function.
alphaanyAlpha parameter controlling the sigmoid offset.
betaanyBeta 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:

ParameterTypeDescription
volumeNamesanyNames 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) -> None

Parameters:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
sigmaanyStandard deviation of the Gaussian kernel in millimeters.

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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.

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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.

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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to update.
spacinganyNew 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to translate.
translationanyTranslation 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to update.
originanyNew 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to transform.
matrixany16-element transformation matrix (4x4 row-major format).
volumeInterpolationanyInterpolation method for volumes. Use api.Interpolation.Nearest, api.Interpolation.Linear, or api.Interpolation.Cubic.
maskInterpolationanyInterpolation 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
fullyConnectedanyIf 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:

ParameterTypeDescription
volumeNamesanyNames 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:

ParameterTypeDescription
volumeNamesanyNames of the volumes to process.
minIntensityanyMinimum intensity value for the output range.
maxIntensityanyMaximum intensity value for the output range.

UI

surface_guided_padding

Pads volumes and all available masks based on surface-guided constraints. Automatically calculates required padding from surface objects to ensure the volume is sufficiently padded.

Signature:

surface_guided_padding(volumeName: str, surfaceNames: list) -> None

Parameters:

ParameterTypeDescription
volumeNameanyName of the target volume to determine padding calculations.
surfaceNamesanyNames of the surface objects that guide the padding calculations.

See Also