metaspace.image_processing

metaspace.image_processing.clip_hotspots(img)[source]

Performs hotspot removal on an ion image to match the METASPACE website’s ion image rendering

metaspace.image_processing.colocalization(img_a, img_b)[source]

Calculates degree of colocalization between two ion images, using the same algorithm METASPACE uses. Returns a float between 0 (no colocalization) and 1 (full colocalization).

Citation: Ovchinnikova et al. (2020) ColocML. https://doi.org/10.1093/bioinformatics/btaa085

Requires additional packages to be installed: scipy, scikit-learn

metaspace.image_processing.colocalization_matrix(images: List[numpy.ndarray], labels: None = 'None') → numpy.ndarray[source]
metaspace.image_processing.colocalization_matrix(images: List[numpy.ndarray], labels: List[str]) → pandas.core.frame.DataFrame

Calculates level of colocalization between all pairs of images in a list of ion images. If many checks are needed, it is usually faster to generate the entire matrix than to do many separate calls to “colocalization”.

Citation: Ovchinnikova et al. (2020) ColocML. https://doi.org/10.1093/bioinformatics/btaa085

Requires additional packages to be installed: scipy, scikit-learn

Parameters:
  • images (List[ndarray]) – A list of ion images

  • labels – If supplied, output will be a pandas DataFrame where the labels are used to define the index and columns. It can be useful to pass ion formulas or (formula, adduct) pairs here, to facilitate easy lookup of colocalization values If not supplied, the output will be a numpy ndarray

Returns: