neuralib.stardist.core.StarDistSegmentation

class neuralib.stardist.core.StarDistSegmentation[source]

Bases: object

StarDist 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, value as a npz file.

to_roi(output_file)

Covert segmented roi to point roi, and save it as .roi for imageJ.

Attributes

cords

Coordinates.

filename

filepath of image

height

image height

labels

Image with label.

model

stardist model type

n_segmentation

number of segmented cells

points

Coordinates to points by simple XY average.

prob

Detected probability.

width

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 .npz file

Returns:

StarDistSegmentation

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, value as 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 *.npz file path

Return type:

None

to_roi(output_file)[source]

Covert segmented roi to point roi, and save it as .roi for imageJ.

Parameters:

output_file (str | Path | PathLike[str]) – *.roi output file path

Return type:

None