neuralib.stardist.base.AbstractSegmentationOptions

class neuralib.stardist.base.AbstractSegmentationOptions[source]

Bases: AbstractParser

__init__()

Methods

__init__()

eval()

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

foreach_process_image([to_gray])

Iterates over image files in the specified directory, processes each image, and yields the file path along with the processed image.

ij_roi_output(filepath)

Get imageJ/Fiji .roi output save path

launch_napari(**kwargs)

run napari GUI viewer

main([args, parse_only, system_exit])

parsing the commandline input args and call run().

new_parser(**kwargs)

create an ArgumentParser.

process_image([to_gray])

Process the image for segmentation.

run()

called after main().

seg_output(filepath)

Get segmented output save path

Attributes

DESCRIPTION

parser description.

EPILOG

parser epilog.

EX_GROUP_SOURCE

GROUP_IO

USAGE

parser usage.

batch_mode

flag batch mode

directory

directory for batch imaging processing

directory_suffix

suffix in the directory for batch mode (default: '.tif')

file

image file path

file_mode

flag file mode

invalid_existed_result

force re-evaluate the result (default: False)

model

which pretrained model for evaluation

napari_view

view result by napari GUI, only available in single file mode (default: False)

no_normalize

not do percentile-based image normalization (default: False)

save_ij_roi

if save also the imageJ/Fiji compatible .roi file (default: False)

with_norm

flag normalize image

DESCRIPTION: str | None = 'Base Cellular Segmentation Option'

parser description. Could be override as a method if its content is dynamic-generated.

GROUP_IO = 'Data I/O Options'
EX_GROUP_SOURCE = 'EX_GROUP_SOURCE'
file: Path

image file path

directory: Path

directory for batch imaging processing

directory_suffix: Literal['.tif', '.tiff', '.png']

suffix in the directory for batch mode (default: ‘.tif’)

save_ij_roi: bool

if save also the imageJ/Fiji compatible .roi file (default: False)

model: str

which pretrained model for evaluation

invalid_existed_result: bool

force re-evaluate the result (default: False)

no_normalize: bool

not do percentile-based image normalization (default: False)

napari_view: bool

view result by napari GUI, only available in single file mode (default: False)

property file_mode: bool

flag file mode

property batch_mode: bool

flag batch mode

property with_norm: bool

flag normalize image

process_image(to_gray=True)[source]

Process the image for segmentation.

Returns:

Array[Any, [H, W]] or Array[Any, [H, W, C]]

Parameters:

to_gray (bool)

Return type:

ndarray

foreach_process_image(to_gray=True)[source]

Iterates over image files in the specified directory, processes each image, and yields the file path along with the processed image. The processing can include grayscale conversion and normalization based on the provided parameters.

Parameters:

to_gray (bool) – Flag indicating whether the images should be converted to grayscale.

Returns:

An iterable of tuples where each tuple includes the file path as a Path object and the processed image as a numpy array.

Return type:

Tuple of filepath, image_array (Array[Any, [H, W]] or Array[Any, [H, W, C]]) generator

abstractmethod seg_output(filepath)[source]

Get segmented output save path

Parameters:

filepath (Path) – filepath for image

Returns:

segmented output save path

Return type:

Path

ij_roi_output(filepath)[source]

Get imageJ/Fiji .roi output save path

Parameters:

filepath (Path) – filepath for image

Returns:

ij roi output save path

Return type:

Path

abstractmethod eval()[source]

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

Return type:

None

abstractmethod launch_napari(**kwargs)[source]

run napari GUI viewer