Skip to main content

CellposeParams

Other

Configuration parameters for Cellpose-SAM AI model.

Import

import ScriptingApi as api

# Create parameter instance
params = api.CellposeParams()

Properties

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. 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. 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. The default is 8.

Type: int


anisotropy

Z-axis anisotropy ratio for 3D segmentation (ratio of Z-spacing to XY-spacing). 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


See Also