COSIE.image_preprocessing.PatchDataset
- class PatchDataset(image, location)[source]
Bases:
DatasetA PyTorch-compatible dataset for extracting 224×224 image patches centered at specified cell coordinates from a high-resolution RGB image.
Each patch is centered on a given pixel coordinate, padded if it falls near the edge of the image, and normalized using standard ImageNet statistics.
Parameters
- imagenp.ndarray
Full-resolution RGB H&E image of shape (H, W, 3).
- locationnp.ndarray
Array of shape (N, 2) containing N pixel coordinates for cell centers.
Returns
- datasetPatchDataset
A PyTorch dataset object. Each item is a tuple (transformed_patch, coordinate), where transformed_patch is a normalized 3×224×224 tensor.
Methods