h5sc#
Functions to work with scPortrait’s standardized single-cell data format.
- scportrait.tools.h5sc.get_image_with_cellid(adata, cell_id: list[int] | int, select_channel: int | list[int] | None = None) ndarray #
Get single cell images from the cells with the provided cell IDs. Images are returned in the order of the cell IDs.
- Parameters:
adata – An AnnData object with obsm[“single_cell_images”] containing a memory-backed array of the single-cell images.
cell_id – The cell ID of the cell to retrieve the image for.
select_channel – The channel to select from the image. If None, all channels are returned.
- Returns:
The image(s) of the cell with the passed Cell IDs.
- scportrait.tools.h5sc.get_image_index(adata, cell_id: int | list[int]) int | list[int] #
Retrieve the image index (row index) of a specific cell id in a H5SC object.
- Parameters:
adata – An AnnData object with obsm[“single_cell_images”] containing a memory-backed array of the single-cell images.
cell_id – A single cell ID or a list of cell IDs to retrieve indices for.
- Returns:
The corresponding index or list of indices from adata.obs.index.