harpy.im.instanseg_callable#
- harpy.im.instanseg_callable(img, device='cpu', instanseg_model='instanseg.pt', output=None, dtype=<class 'numpy.uint32'>, pixel_size=0.5, **kwargs)#
Perform segmentation using instanseg.
- Parameters:
img (
ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]) – The input image as anumpyarray on which instance segmentation will be performed (z,y,x,c).device (
str|None(default:'cpu')) – The device to run the model on. Can be “cpu”, “cuda”, or another supported device. Default is “cpu”.instanseg_model (
InstanSeg|Path|str(default:'instanseg.pt')) – TheInstanSegmodel used for segmentation. This can either be a pre-loaded model, or a file path to the model (typically a.ptfile).pixel_size (
float(default:0.5)) – pixel size in μm.output (
Optional[Literal['all_outputs','nuclei','cells']] (default:None)) – Specifies the type of segmentation to perform. Options are: “cells”: segment entire cells; “nuclei”: segment only nuclei; “all_outputs”: segment both cells and nuclei. IfNone,outputis set to “all_outputs”.dtype (
type(default:<class 'numpy.uint32'>)) – The data type for the output mask. Default is set by_SEG_DTYPE.
- Return type:
ndarray[tuple[Any,...],dtype[TypeVar(_ScalarT, bound=generic)]]- Returns:
: A
numpyarray containing the segmented regions as labeled masks (z,y,x,c).