sainsc.LazyKDE.filter_background
- sainsc.LazyKDE.filter_background(min_norm, min_cosine=None, min_assignment=None)
Define pixels as background.
If using multiple thresholds (e.g. on norm and cosine similarity) they will be combined and pixels are defined as background if they are lower than any of the thresholds.
- Parameters:
min_norm (float or dict[str, float]) – The threshold for defining background based on
sainsc.LazyKDE.total_mRNA_KDE. Either a float which is used as global threshold or a mapping from cell types to thresholds. Cell-type assignment is needed for cell type-specific thresholds.min_cosine (float or dict[str, float], optional) – The threshold for defining background based on
sainsc.LazyKDE.cosine_similarity. Cell type-specific thresholds can be defined as for min_norm.min_assignment (float or dict[str, float], optional) – The threshold for defining background based on
sainsc.LazyKDE.assignment_score. Cell type-specific thresholds can be defined as for min_norm.
- Raises:
ValueError – If cell type-specific thresholds do not include all cell types or if using cell type-specific thresholds before cell type assignment.