segmenter_model_zoo.model_wrapper package¶
Submodules¶
segmenter_model_zoo.model_wrapper.DNA_MEM_instance_basic module¶
-
segmenter_model_zoo.model_wrapper.DNA_MEM_instance_basic.
SegModule
(img: numpy.ndarray = None, model_list: List = None, filename: Union[str, pathlib.Path] = None, index: List[int] = None, return_prediction: bool = False, mem_pre_cut_th: float = 0.2, seed_bw_th: float = 0.9, dna_mask_bw_th: float = 0.5, min_seed_size: float = 6000)[source]¶ Segmentation function for cells and nuclei segmentaiton without label-free and mitotic pair correction.
- img: np.ndarray
a 4D numpy array of size 2 x Z x Y x X, the first channel is DNA and the second channel is cell membrane.
- filename: Union[str, Path]
when img is None, use filename to load image
- index: List[int]
a list of 2 integers, the first indicating which channel is DNA, the second integer indicating which channel is cell membrane. Only valid when using filename to load image. Not used when img is not None
- model_list: List
the list of models to be applied on the image. Here, we assume 3 models are provided (in this specific order): dna mask model, membrane segmentation model and dna seed model.
- return_prediction: book
a flag indicating whether to return raw prediction
- mem_pre_cut_th: float
an emprically determined cutoff value to binarize the prediction from membrane segmentation model and the binary result is used to cut the seed. Usually, this value needs to be relatively small, just to be conservative, so that there won’t be falsely merged seeds. Default is 0.2.
- seed_bw_th: float
an empirically determined cutoff value to binarize the prediction from dna seed model. The binary result after cutted by binarized membrane will be used as the seed for running watershed. Usually, this value needs to be relatively large, just to be conservative, so that seeds are less likely to be falsely merged. Default is 0.90.
- dna_mask_bw_th: float
an empirically determined cutoff value to binarize the prediction from dna mask model. Default is 0.5.
- min_seed_size: float
an empirically determined size threshold to prune the seeds before running watershed. Any connected component (except those torching the image border) with less than min_seed_size voxels will not be removed from seeds. Default is 6000.
two numpy arrays: cell segmentatino and dna segmentation (labeled images) or together with raw prediction (if return_prediction is True)
segmenter_model_zoo.model_wrapper.DNA_MEM_instance_plus_LF module¶
segmenter_model_zoo.model_wrapper.DNA_MEM_instance_plus_LF_two_camera module¶
segmenter_model_zoo.model_wrapper.LMNB1_morphological_production_alpha module¶
-
segmenter_model_zoo.model_wrapper.LMNB1_morphological_production_alpha.
SegModule
(img: numpy.ndarray = None, model_list: List = None, filename: Union[str, pathlib.Path] = None, index: List[int] = None, return_prediction: bool = False, output_type: str = 'production')[source]¶ Segmentation function for lamin b1 morphological segmentation. The name “morphological segmentation” refers that the lamin shells are guaranteed to be a fully closed shell (i.e. topologically fillable in 3D)
- img: np.ndarray
a 4D numpy array of size 2 x Z x Y x X, the first channel is lamin b1 and the second channel is cell membrane.
- filename: Union[str, Path]
when img is None, use filename to load image
- index: List[int]
a list of 2 integers, the first indicating which channel is lamin b1, the second integer indicating which channel is cell membrane. Only valid when using filename to load image. Not used when img is not None
- model_list: List
the list of models to be applied on the image. Here, we assume 4 models are provided (in this specific order): lamin structure segmentation model, lamin fill model, lamin core model, and membrane segmentation model.
- return_prediction: book
a flag indicating whether to return raw prediction
- output_type: str
There are two ways to return the output: “production” (default) and “RnD”. “production” means only the final lamin b1 segmentation result will be returned. “RnD” means lamin fill and lamin shell will also be returned, which are intermediate results for generating the final lamin b1 segmentation. lamin fill is usefull particularly to represent nuclear segmentation and can be used to measured the nuclei shapes. lamin shell is just the boundary of lamin fill.
1 or 3 numpy array (depending on output_type) or together with raw prediction (if return_prediction is True)
segmenter_model_zoo.model_wrapper.LMNB1_morphological_with_labelfree module¶
-
segmenter_model_zoo.model_wrapper.LMNB1_morphological_with_labelfree.
SegModule
(img: numpy.ndarray = None, model_list: List = None, filename: Union[str, pathlib.Path] = None, index: List[int] = None, return_prediction: bool = False, output_type: str = 'production')[source]¶ Segmentation function for lamin b1 morphological segmentation with labelfree. The name “morphological segmentation” refers that the lamin shells are segmented to be a fully closed shell (i.e. topologically fillable in 3D)
- img: np.ndarray
a 4D numpy array of size 2 x Z x Y x X, the first channel is lamin b1 and the second channel is bright field image.
- filename: Union[str, Path]
when img is None, use filename to load image
- index: List[int]
a list of 2 integers, the first indicating which channel is lamin b1, the second integer indicating which channel is bright field. Only valid when using filename to load image. Not used when img is not None
- model_list: List
the list of models to be applied on the image. Here, we assume 4 models are provided (in this specific order): lamin structure segmentation model, lamin fill model, lamin core model, and membrane segmentation model.
- return_prediction: book
a flag indicating whether to return raw prediction
- output_type: str
There are two ways to return the output: “production” (default) and “RnD”. “production” means only the final lamin b1 segmentation result will be returned. “RnD” means lamin fill and lamin shell will also be returned, which are intermediate results for generating the final lamin b1 segmentation. lamin fill is usefull particularly to represent nuclear segmentation and can be used to measured the nuclei shapes. lamin shell is just the boundary of lamin fill.
1 or 3 numpy array (depending on output_type) or together with raw prediction (if return_prediction is True)
segmenter_model_zoo.model_wrapper.structure_AAVS1_100x_hipsc module¶
-
segmenter_model_zoo.model_wrapper.structure_AAVS1_100x_hipsc.
SegModule
(img: numpy.ndarray = None, model_list: List = None, filename: Union[str, pathlib.Path] = None, index: Union[int, List[int]] = None, return_prediction: bool = False, pred_cutoff: float = 0.5)[source]¶ Segmentation function for CAAX segmentation.
- img: np.ndarray
a 4D numpy array of size 1 x Z x Y x X of CAAX image
- filename: Union[str, Path]
when img is None, use filename to load image
- index: Union[int, List[int]]
an integers or a list of only one integer indicating which channel is CAAX. Only valid when using filename to load image. Not used when img is not None
- model_list: List
the list of models to be applied on the image. Here, we assume 1 model is provided, CAAX segmentation model.
- return_prediction: book
a flag indicating whether to return raw prediction
- pred_cutoff: float
an empirically determined cutoff value to binarize the prediction from the CAAX segmentation model. Default is 0.5.
one numpy array or together with raw prediction (if return_prediction is True)
segmenter_model_zoo.model_wrapper.structure_H2B_100x_hipsc module¶
-
segmenter_model_zoo.model_wrapper.structure_H2B_100x_hipsc.
SegModule
(img: numpy.ndarray = None, model_list: List = None, filename: Union[str, pathlib.Path] = None, index: Union[int, List[int]] = None, return_prediction: bool = False, pred_cutoff: float = 0.5, minsize: int = 100)[source]¶ Segmentation function for H2B coarse segmentation. NOTE: this is not the H2B segmentation provided in the Allen Cell Data Collection. This is a coarse version, which can be roughly considered as equivelant to nuclear segmentation
- img: np.ndarray
a 4D numpy array of size 1 x Z x Y x X of H2B image
- filename: Union[str, Path]
when img is None, use filename to load image
- index: Union[int, List[int]]
an integers or a list of only one integer indicating which channel is H2B. Only valid when using filename to load image. Not used when img is not None
- model_list: List
the list of models to be applied on the image. Here, we assume 1 model is provided, H2B coarse segmentation model.
- return_prediction: book
a flag indicating whether to return raw prediction
- pred_cutoff: float
an empirically determined cutoff value to binarize the prediction from the H2B coarse segmentation model. Default is 0.5.
- minsize: int
an empirically determined size threshold to prune the segmentation result
one numpy array or together with raw prediction (if return_prediction is True)
Module contents¶
Bin scripts package for segmenter_model_zoo.