tirank.Imageprocessing.crop_images

tirank.Imageprocessing.crop_images(data, crop_size=25)[source]

Crops image tiles (patches) from the H&E slide for each spot.

Uses the ‘imagecol’ and ‘imagerow’ coordinates from data.obs to crop square patches of (2*crop_size) x (2*crop_size) from the high-resolution image.

Parameters:
  • data (anndata.AnnData) – The AnnData object, after running scale_coordinate.

  • crop_size (int, optional) – The “radius” for cropping. A size of 25 creates 50x50 pixel tiles. Defaults to 25.

Returns:

A NumPy array stack of image tiles of shape

(n_spots, 2*crop_size, 2*crop_size, 3).

Return type:

np.ndarray