neuralib.stardist.core.StarDistSegmentation
- class neuralib.stardist.core.StarDistSegmentation[source]
Bases:
objectStarDist segmentation results
Dimension parameters:
N = Number of segmented cell
E = Number of polygons edge
W = Image width
H = Image height
P = Number of image pixel with label
- __init__(labels, cords, prob, filename, model)[source]
- Parameters:
labels (ndarray) – Image with label. Array[float, [H, W]]
cords (ndarray) – Coordinates. Array[float, [N, 2, E]]
prob (ndarray) – Detected probability. Array[float, N]
filename (str) – filepath of image
model (Literal['2D_versatile_fluo', '2D_versatile_he', '2D_paper_dsb2018', '2D_demo']) –
STARDIST_MODEL
Methods
__init__(labels, cords, prob, filename, model)load(file)Load a stardist segmentation result
mask_probability(threshold)masking probability for the results
to_npz(output_file)Save
filename,cord,prob,point,shape,index,index,valueas a npz file.to_roi(output_file)Covert segmented roi to point roi, and save it as
.roifor imageJ.Attributes
Coordinates.
filepath of image
image height
Image with label.
stardist model type
number of segmented cells
Coordinates to points by simple XY average.
Detected probability.
image width
- __init__(labels, cords, prob, filename, model)[source]
- Parameters:
labels (ndarray) – Image with label. Array[float, [H, W]]
cords (ndarray) – Coordinates. Array[float, [N, 2, E]]
prob (ndarray) – Detected probability. Array[float, N]
filename (str) – filepath of image
model (Literal['2D_versatile_fluo', '2D_versatile_he', '2D_paper_dsb2018', '2D_demo']) –
STARDIST_MODEL
- classmethod load(file)[source]
Load a stardist segmentation result
- Parameters:
file (str | Path | PathLike[str]) – stardist segmentation result
.npzfile- Returns:
- Return type:
Self
- property n_segmentation: int
number of segmented cells
- property width: int
image width
- property height: int
image height
- property filename: Path
filepath of image
- property labels: ndarray
Image with label. Array[float, [H, W]]
- property cords: ndarray
Coordinates. Array[float, [N, 2, E]]
- property prob: ndarray
Detected probability. Array[float, N]
- property points: ndarray
Coordinates to points by simple XY average. Array[float, [N, 2]]
- property model: Literal['2D_versatile_fluo', '2D_versatile_he', '2D_paper_dsb2018', '2D_demo']
stardist model type
- mask_probability(threshold)[source]
masking probability for the results
- Parameters:
threshold (float) – probability threshold
- to_npz(output_file)[source]
Save
filename,cord,prob,point,shape,index,index,valueas a npz file.shape: Array[int, 2] in H,W
index: index with labels. Array[int, [P, 2]]
value: label value in its index Array[int, P]
- Parameters:
output_file (str | Path | PathLike[str]) – output
*.npzfile path- Return type:
None