neuralib.segmentation.stardist.run_2d

final class neuralib.segmentation.stardist.run_2d.StarDistResult[source]

Stardist 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

filename: str

Source image file name

labels: ndarray

Image with label. Array[float, [H, W]]

cords: ndarray

Coordinates. Array[float, [N, 2, E]]

prob: ndarray

Detected probability. Array[float, N]

points: ndarray

Coordinates to points by simple XY average. Array[float, [N, 2]]

classmethod load(file)[source]
Parameters:

file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)

Return type:

Self

savez(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 | bytes | BinaryIO | BufferedIOBase | BufferedReader) – output

Return type:

None

save_roi(output_file)[source]

Save as imageJ .roi file

Parameters:

output_file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)

Return type:

None

get_index_value()[source]

Get labelled pixel index and its value.

Returns:

Array[int, [P, 2]] and Array[float, P]

Return type:

tuple[ndarray, ndarray]

with_probability(threshold)[source]
Parameters:

threshold (float)

Return type:

Self

__init__(filename, labels, cords, prob)

Method generated by attrs for class StarDistResult.

Parameters:
  • filename (str)

  • labels (ndarray)

  • cords (ndarray)

  • prob (ndarray)

Return type:

None

class neuralib.segmentation.stardist.run_2d.StarDist2DOptions[source]
DESCRIPTION: str = 'Run the Stardist model for segmentation'

parser description.

model: Literal['2D_versatile_fluo', '2D_versatile_he', '2D_paper_dsb2018', '2D_demo']

stardist pretrained model

prob_thresh: float

Consider only object candidates from pixels with predicted object probability above this threshold. Seealso: stardist.models.base._predict_instances_generator: prob_thresh

run()[source]

called when all argument attributes are set

seg_output(filepath)[source]

Get output save path

Parameters:

filepath (Path) – filepath for image

Returns:

output save path

Return type:

Path

eval(**kwargs)[source]

eval the model in single file or batch files, and save the results

Return type:

None

launch_napari(with_widget=False)[source]

Launch napari viewer for stardist results

Parameters:

with_widget (bool) – If True, launch also with the starDist widget (required package stardist-napari)