neuralib.segmentation.stardist.run_2d.StarDist2DOptions
- class neuralib.segmentation.stardist.run_2d.StarDist2DOptions[source]
Bases:
AbstractSegmentationOption- 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
- EPILOG: str = None
parser epilog. Could be override as a method if its content is dynamic-generated.
- EX_GROUP_SOURCE = 'EX_GROUP_SOURCE'
- USAGE: str = None
parser usage.
- static __new__(cls, *args, **kwargs)
- property batch_mode: bool
Flag batch mode
- directory: Path
images directory for batch processing
- directory_suffix: str
suffix in batch mode
- file: Path
image file path
- property file_mode: bool
Flag file mode
- force_re_eval: bool
force re-evaluate the result
- foreach_normalize_image()
Normalize the image in batch mode
- Returns:
Tuple of filepath and image Array[float, [H, W]]
- Return type:
Iterable[tuple[Path, ndarray]]
- foreach_raw_image()
Load image from a directory and convert to grayscale
- Returns:
Tuple of filepath and image Array[float, [H, W]]
- Return type:
Iterable[tuple[Path, ndarray]]
- ij_roi_output(filepath)
Get imageJ/Fiji
.roioutput save path- Parameters:
filepath (Path) – filepath for image
- Returns:
ij roi output save path
- Return type:
Path
- main(args=None, *, exit_on_error=True)
parsing the commandline input args and set the argument attributes, then call
run().Example
if overwrite with the argument default, use args
>>> AbstractParser().main((['--source=allen_mouse_25um', '--region=VISal,VISam,...'], []))
- Parameters:
args (list[str] | tuple[list[str]] | None) – commandline arguments, or a tuple of (prepend, append) arguments
exit_on_error (bool) – exit when commandline parsed fail. Otherwise, raise a
RuntimeError.
- napari_view: bool
view in napari
- classmethod new_parser(**kwargs)
create an
argparse.ArgumentParser.class variable:
USAGE,DESCRIPTIONandEPILOGare used when creation.>>> class A(AbstractParser): ... @classmethod ... def new_parser(cls, **kwargs) -> argparse.ArgumentParser: ... return super().new_parser(**kwargs)
- Parameters:
kwargs – keyword parameters to ArgumentParser
- Returns:
an ArgumentParser.
- Return type:
ArgumentParser
- no_normalize: bool
NOT DO Percentile-based image normalization for eval
- normalize_image()
Normalize the image
- Returns:
Array[float, [H, W]]
- Return type:
ndarray
- post_parsing()
check args is valid
- raw_image()
Load image from file and convert to grayscale
- Returns:
Array[float, [H, W]]
- Return type:
ndarray
- save_ij_roi: bool
if save also the imageJ/Fiji compatible .roi file
- seg_output(filepath)[source]
Get output save path
- Parameters:
filepath (Path) – filepath for image
- Returns:
output save path
- Return type:
Path