neuralib.cellpose.core.CellposeSegmentation
- class neuralib.cellpose.core.CellposeSegmentation[source]
Bases:
objectCellpose segmentation results
Dimension parameters:
N = Number of segmented cells
W = Image width
H = Image height
See also
Methods
__init__(outlines, masks, chan_choose, ...)load(file)Load a cellpose segmentation result
to_roi(output_file)Covert segmented roi to point roi, and save it as
.roifor imageJ.Attributes
channels that you chose in GUI (0=gray/none, 1=red, 2=green, 3=blue)
cell body diameter
filepath of image
flows[0] is XY flow in RGB
image height
whether or not mask k was manually drawn or computed by the cellpose algorithm.
each pixel in the image is assigned to an ROI (0 = NO ROI; 1,2,… = ROI labels).
number of segmented cells
value 0 in
CellposeSegmentation.masksto nanvalue 0 in
CellposeSegmentation.outlinesto nanoutlines of ROIs (0 = NO outline; 1,2,… = outline labels).
Calculate center of each segmented area in XY pixel.
image width
- classmethod load(file)[source]
Load a cellpose segmentation result
- Parameters:
file (str | Path | PathLike[str]) – cellpose segmentation result
.npyfile- Returns:
- Return type:
Self
- property n_segmentation: int
number of segmented cells
- property width
image width
- property height
image height
- property filename: Path
filepath of image
- property outlines: ndarray
outlines of ROIs (0 = NO outline; 1,2,… = outline labels). Array[uint16, [H, W]]
- property masks: ndarray
each pixel in the image is assigned to an ROI (0 = NO ROI; 1,2,… = ROI labels). Array[uint16, [H, W]]
- property chan_choose: list[int]
channels that you chose in GUI (0=gray/none, 1=red, 2=green, 3=blue)
- property flows: list[ndarray]
flows[0] is XY flow in RGB
flows[1] is the cell probability in range 0-255 instead of -10.0 to 10.0
flows[2] is Z flow in range 0-255 (if it exists, otherwise zeros),
flows[3] is [dY, dX, cellprob] (or [dZ, dY, dX, cellprob] for 3D), flows[4] is pixel destinations (for internal use)
- property diameter: float
cell body diameter
- property is_manual: ndarray
whether or not mask k was manually drawn or computed by the cellpose algorithm. Array[bool, N]
- property nan_masks: ndarray
value 0 in
CellposeSegmentation.masksto nan
- property nan_outlines: ndarray
value 0 in
CellposeSegmentation.outlinesto nan
- property points: ndarray
Calculate center of each segmented area in XY pixel. Array[int, [N, 2]]