Preprocessing¶
read_ROIs¶
-
class
spatialtis.
read_ROIs
(entry, obs_names, var, mask_pattern=None, img_pattern=None)[source]¶ Extract single cell expression matrix and geometry information from stacked images and masks
- Parameters
entry (Union[pathlib.Path, str]) – The root folder to start with
obs_names (Sequence) – Array of names correspond to each level of your folders
var (pandas.core.frame.DataFrame) – Describe the order of layers in your stacked image
mask_pattern (Optional[str]) – Name pattern for all of your mask
img_pattern (Optional[str]) – Name pattern for all of your image
-
obs
¶ Will pass to AnnData.obs
-
var
¶ Will pass to AnnData.var
-
anndata
¶ The processed AnnData object
-
to_anndata
(bg=0, method='mean', polygonize='convex', alpha=None, mp=None)[source]¶ Get anndata object
You must explicitly call this method to trigger the computation.
- Parameters
bg (Optional[int]) – The background pixel value
method (str) – How to compute the expression level. (“mean”, “sum”, “median”)
polygonize (str) – How to compute the cell shape.(“convex”, “concave”)
alpha (Optional[float]) – The alpha value for polygonize=”concave”
mp (Optional[bool]) – {mp}
Note
“convex” or “concave” to determine cell shape?
The cell shape is represent by the border points to simplify the following analysis process.
convex: Convex hull, much faster but less accurate.
concave: Concave hull, very slow, a parameter “alpha” is needed.