bin2cell.scaled_he_image

bin2cell.scaled_he_image(adata, mpp=1, crop=True, buffer=150, spatial_cropped_key=None, store=True, img_key=None, save_path=None)

Create a custom microns per pixel render of the full scale H&E image for visualisation and downstream application. Store resulting image and its corresponding size factor in the object. If cropping to just the spatial grid, also store the cropped spatial coordinates. Optionally save to file.

Input

adataAnnData

2um bin VisiumHD object. Path to high resolution H&E image provided via source_image_path to b2c.read_visium().

mppfloat, optional (default: 1)

Microns per pixel of the desired H&E image to create.

cropbool, optional (default: True)

If True, will limit the image to the actual spatial coordinate area, with buffer added to each dimension.

bufferint, optional (default: 150)

Only used with crop=True. How many extra pixels (in original resolution) to include on each side of the captured spatial grid.

spatial_cropped_keystr or None, optional (default: None)

Only used with crop=True. .obsm key to store the adjusted spatial coordinates in. If None, defaults to "spatial_cropped_X_buffer", where X is the value of buffer.

storebool, optional (default: True)

Whether to store the generated image within the object.

img_keystr or None, optional (default: None)

Only used with store=True. The image key to store the image under in the object. If None, defaults to "X_mpp_Y_buffer", where X is the value of mpp and Y is the value of buffer in the instance of crop=True. If no cropping is to be done, defaults to "X_mpp".

save_pathfilepath or None, optional (default: None)

If specified, will save the generated image to this path (e.g. for StarDist use).