| | |
- estimate_cyto(image)
- filter_segmentation(masks, remove_edges=True, min_area=100, min_bbox=10, relabel=True)
- Filters a segmentation mask based on a set of thresholds typical for
cell segmentation.
remove_edges: if true masks on the edge of the image are removed
with skimage.segmentation.clear_border
min_area: removes any cells with an area less than this value
min_bbox: removes any cells that have a height or width less than this value
relabel: whether to relabel the segmentation mask to be sequential, done
with skimage segmentation.relabel_sequential
- image_log_scale(data, bottom_percentile=10, floor_threshold=50, ignore_zero=True)
- match_segmentations(cells, nuclei)
- Matches cellular and nuclear segmentation maps
The provided cells and nuclei segmentation masks are matched, and any
cell or nucleus that does not overlap with a corresponding cell/nucleus
is removed. Matching is done by nuclei, as this is typically the more
consistent segmentation mask. For each nucleus, all cells that are overlapping
are scored by the percent overlap of the nucleus inside the cell, and the highest
scoring cell is chosen as the match. Any unmatched cells or nuclei are discarded,
and both masks are relabeled to share the same indices between them.
- segment_cells(cyto, dapi, method='cellpose', gpu=False, **kwargs)
- Segments cells using a cytoplasm and nuclear channel.
Params:
cyto: the cytoplasmic channel, numpy array of shape (width, height)
dapi: the nuclear channel, numpy array of shape (width, height)
method: str, default 'cellpose'
The method to use for cell segmentation. The available methods are:
'cellpose': Uses the 'cyto' model of cellpose to segment cells. Expects the parameter 'diameter'
'stardist': Uses stardist with only the cyto channel to segment cells
**kwargs: arguments are passed to the specified method
Returns: numpy int array of shape (width, height), where 0 is background and nonzero integers are cell masks
- segment_cyto_cellpose(cyto, dapi, diameter, gpu=False, cyto_model='cyto', logscale=True)
- segment_nuclei(dapi, method='stardist', **kwargs)
- Segments nuclei from a single channel, typically stained with DAPI or another nuclear dye
Params:
dapi: numpy array of shape (width, height)
method: str, default 'stardist'
The method of nuclear segmentation that is used. Can be:
'otsu_threshold': uses a simple otsu threshold and segments connected regions
'stardist': uses stardist to segment nuclei
**kwargs: arguments are passed onto the specific method selected
Returns: numpy array of shape (width, height), dtype int, where 0 is background and nonzero integers are cell masks
- segment_nuclei_stardist(dapi)
- #stardist_model = None
|