loki.preprocess.segment_patches
- loki.preprocess.segment_patches(img_array, coord, patch_dir, height=20, width=20)
Extracts small image patches centered at specified coordinates and saves them as individual PNG files.
- Parameters:
img_array (numpy.ndarray) – A NumPy array representing the full-resolution image. Shape is expected to be (H, W[, C]).
coord (pandas.DataFrame) – A pandas DataFrame containing patch center coordinates in columns “pixel_x” and “pixel_y”. The index corresponds to spot IDs. Example columns: [“pixel_x”, “pixel_y”].
patch_dir (str) – Directory path where the patch images will be saved.
height (int) – The patch’s height in pixels (distance in the y-direction).
width (int) – The patch’s width in pixels (distance in the x-direction).
- Returns:
None. The function saves image patches to patch_dir but does not return anything.