tools._segmentation
def predict_cell_num(st_adata_path,
diameter,
save_png_result=False,
model_type='cyto3',
out_path='./',
cellprob_threshold=1,
save=True)
Predicts cell numbers from spatial transcriptomics data using Cellpose.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
st_adata
|
AnnData
|
Spatial transcriptomics AnnData object. |
required |
library_ids
|
string
|
Identifier for the library in the AnnData object. |
'library_ids'
|
diameter
|
int
|
Estimated diameter of the cells to be detected. |
None
|
save_png_result
|
bool
|
If True, saves the segmentation results as PNG files. |
False
|
model_type
|
string
|
Type of Cellpose model to use. Default is 'cyto3'. |
'cyto3'
|
out_path
|
string
|
Directory to save the output files. Default is './'. |
required |
cellprob_threshold
|
float
|
Cell probability threshold for Cellpose. Default is 1. |
0.4
|
save
|
bool
|
If True, saves the results to an h5ad file. Default is True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
st_adata |
AnnData
|
Updated AnnData object with predicted cell numbers. |
cell_pos |
DataFrame
|
DataFrame containing cell positions. |
Source code in cytobulk\tools\_segmentation.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|