CellposeParams
Configuration parameters for Cellpose-SAM AI model.
Import
import ScriptingApi as api
# Create parameter instance
params = api.CellposeParams()
Properties
model
Built-in Cellpose model used for segmentation. Use 'cpsam_v2' for the latest CellposeSAM model with improved low-contrast results, or 'cpsam' for the original CellposeSAM model. The default is 'cpsam_v2'.
Type: str
mode
Segmentation mode ('2D' for single-slice or '3D' for volumetric). The default is '3D'.
Type: str
device
Processing device ('cpu' or 'gpu'). The default is 'cpu'.
Type: str
flow_threshold
Flow error threshold for mask acceptance. Lower values are more strict (0.1-0.3); higher values (0.5-1.0) find more objects including uncertain ones. Valid range is 0.0 to 5.0. The default is 0.4.
Type: float
cellprob_threshold
Object probability threshold. Lower values (negative) detect larger and more objects; higher values detect smaller and fewer objects. Valid range is -6.0 to 6.0. The default is 0.0.
Type: float
diameter
Expected object diameter in pixels. Set to 0 for automatic detection. The default is 0.
Type: float
min_size
Minimum object size in pixels. Objects smaller than this are removed. Set to -1 to disable. The default is 15.
Type: int
exclude_on_edges
Discard masks that touch the edges of the image. The default is False.
Type: bool
batch_size
Number of 256x256 image tiles processed simultaneously on GPU. Valid range is 1 to 256. The default is 8.
Type: int
anisotropy
Z-axis anisotropy ratio for 3D segmentation (ratio of Z-spacing to XY-spacing). Must be greater than zero. Only used in 3D mode. The default is 1.0.
Type: float
stitch_threshold
IoU threshold for stitching 2D masks across Z-slices into 3D objects. Set to 0 to use native 3D segmentation. Values around 0.9 work well. Only used in 3D mode. The default is 0.0.
Type: float
slice_index
Slice index for 2D mode (-1 uses the currently active slice). The default is -1.
Type: int