neuralib.segmentation.cellpose.core.AbstractCellPoseOption
- class neuralib.segmentation.cellpose.core.AbstractCellPoseOption[source]
Bases:
AbstractSegmentationOption- DESCRIPTION: str = 'ABC for GUI Cellpose'
parser description.
- model: Literal['cyto', 'cyto2', 'cyto3']
which pretrained model
- chan_seg: int
channel for segmentation default:{‘none’: -1, ‘gray’: 0, ‘red’: 1, ‘green’: 2, ‘blue’: 3}
- chan_nuclear: int
nuclear channel
- diameter: int
diameter for each neuron (number of each pixel)
- cellpose_view: bool
launch cellpose gui for the analyzed result
- seg_output(filepath)[source]
Get segmented output save path
- Parameters:
filepath (Path) – filepath for image
- Returns:
segmented output save path
- Return type:
Path
- launch_cellpose_gui()[source]
AttributeError: ‘MainW’ object has no attribute ‘load_3D’. Cellpose version 3.0.10.
TODO open issue in cellpose -> move
load_3Dinstance attribute to line aboveio._load_image()inMainW.__init__()
- 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
- abstract eval()
eval the model in single file or batch files, and save the results
- Return type:
None
- 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
- run()
called when all argument attributes are set
- save_ij_roi: bool
if save also the imageJ/Fiji compatible .roi file