bin2cell.stardist
- bin2cell.stardist(image_path, labels_npz_path, stardist_model='2D_versatile_he', block_size=4096, min_overlap=128, context=128, model=None, model_axes=None, **kwargs)
Segment an image with StarDist. Supports both the fluorescence and H&E models. The identified object labels will be converted to a sparse matrix and written to drive in
.npz.Input
- image_path
filepath Path to image to be segmented.
- labels_npz_path
filepath Path to write object labels output. Can be easily loaded via
scipy.sparse.load_npz().- stardist_model
str, optional (default:"2D_versatile_he") Use
"2D_versatile_he"for segmenting H&E images or"2D_versatile_fluo"for segmenting single-channel images (GEX-derived or IF)- block_size
int, optional (default: 4096) StarDist
predict_instances_big()input. Length of square edge of the image to process as a single tile.- min_overlap
int, optional (default: 128) StarDist
predict_instances_big()input. Minimum overlap between adjacent tiles, in each dimension.- context
int, optional (default: 128) StarDist
predict_instances_big()input. Amount of image context on all sides of a block, which is discarded.- model
StarDist2DorNone, optional (default:None) A custom loaded
StarDist2Dto use for the segmentation. Will ignorestardist_modelif provided.- model_axes
strorNone, optional (default:None) If using a custom model, specify its axes, matching information from the input image. For context, for
"2D_versatile_he"the axes are YXC, for"2D_versatile_fluo"the axes are YX.- kwargs
Any additional arguments to pass to StarDist. Practically most likely to be
prob_threshfor controlling the stringency of calling objects.
- image_path