napari_prism.im.segment_tma#
- napari_prism.im.segment_tma(spatialdata, image_name, output_segmentation_label, segmentation_channel, tiling_shapes=None, model_type='nuclei', nuclei_diam_um=None, channel_merge_method='max', optional_nuclear_channel=None, tiling_shapes_annotation_column=None, normalize=True, cellprob_threshold=0.0, flow_threshold=0.4, custom_model=False, denoise_model=None, preview=False, reference_coordinate_system='global', scale='scale0', inplace=True)#
Performs cell segmentation using Cellpose to the given image.
- Parameters:
spatialdata (
SpatialData) – The spatialdata object to segment.image_name (
str) – The name of the image to segment.output_segmentation_label (
str) – The name of the output segmentation label.segmentation_channel (
str|list[str]) – The channel or channels to segment.tiling_shapes (
Union[GeoDataFrame,str,None] (default:None)) – Shapes to explicitly tile by. Usually this will be the shapes denoting TMA core regions.model_type (
Literal['cyto3','cyto2','cyto','nuclei','tissuenet_cp3','livecell_cp3','yeast_PhC_cp3','yeast_BF_cp3','bact_phase_cp3','bact_fluor_cp3','deepbacs_cp3','cyto2_cp3'] (default:'nuclei')) – The type of cellpose model to use.nuclei_diam_um (
Optional[float] (default:None)) – The diameter of the nuclei in microns. If this is negative, then the diameter is automatically estimated.channel_merge_method (
Literal['max','mean','sum','median'] (default:'max')) – The method to merge multiple channels. Options: “max”, “mean”, “sum”, “median”.optional_nuclear_channel (
Optional[str] (default:None)) – The optional nuclear channel (if supported).tiling_shapes_annotation_column (
Optional[str] (default:None)) – The column intiling_shapesto annotate distinct regions by. This is added as a label to each cell.normalize (
bool(default:True)) – If True, does image intensity normalization.cellprob_threshold (
float(default:0.0)) – The cell probability threshold.flow_threshold (
float(default:0.4)) – The flow threshold.custom_model (
Path|str|bool(default:False)) – The custom model to use, if supplied.denoise_model (
Optional[Literal['nan','denoise_cyto3','deblur_cyto3','upsample_cyto3','oneclick_cyto3','denoise_cyto2','deblur_cyto2','upsample_cyto2','oneclick_cyto2','denoise_nuclei','deblur_nuclei','upsample_nuclei','oneclick_nuclei']] (default:None)) – The denoiser model to use.preview (
bool(default:False)) – If True, only returns the input image (i.e. everything up to just before segmentation).reference_coordinate_system (
str(default:'global')) – The reference coordinate system to use.scale (default:
'scale0') – The scale to segment.inplace (
bool(default:True)) – If True, modifies the spatialdata object in place. If False, returns the segmentation mask and transformation sequence.
- Return type:
SpatialData|DataArray|tuple[DataArray,BaseTransformation]- Returns:
If inplace is True, returns the modified spatialdata object. If False, returns a tuple of the segmentation mask and transformation sequence.