HEImagingDataset#
- class spora_io.datasets.he.HEImagingDataset(name, resolution, path=None, load_cell_metadata=False, verbose=True, mean_std_type='imagenet', tile_size=None, tile_strategy=None, split=None, **kwargs)[source]#
Bases:
BaseImagingDatasetClass for handling H&E stained imaging datasets.
- Parameters:
name (str)
resolution (float | str)
path (os.PathLike | str | None)
load_cell_metadata (bool)
verbose (bool)
mean_std_type (str)
tile_size (Optional[int])
tile_strategy (Optional[str])
split (Optional[str])
- IMAGENET_MEAN#
The mean values for ImageNet normalization.
- Type:
torch.Tensor
- IMAGENET_STD#
The standard deviation values for ImageNet normalization.
- Type:
torch.Tensor
- HIBOU_MEAN#
The mean values for HIBOU normalization.
- Type:
torch.Tensor
- HIBOU_STD#
The standard deviation values for HIBOU normalization.
- Type:
torch.Tensor
- IDENTITY_MEAN#
The mean values for identity normalization.
- Type:
torch.Tensor
- IDENTITY_STD#
The standard deviation values for identity normalization.
- Type:
torch.Tensor
- mean_std_type#
The type of mean and standard deviation to use for normalization. Valid options are “imagenet”, “hibou”, and “identity”.
- Type:
str
- get_tissue(tissue_id, kind='complete', preprocess=True, image_mode='CHW')[source]#
Get the normalized tissue image post filtering channels for a given tissue id.
- Parameters:
tissue_id (str) – The tissue ID to retrieve the image for.
kind (str) – The kind of tissue image to retrieve. Only “complete” is supported for H&E datasets since there is only one modality channel. Default is “complete”.
preprocess (bool) – If True, preprocess the image (normalize). Default is True.
- Returns:
HETissue: The normalized tissue image as an HETissue instance.
- get_tile_by_coordinates(tissue_id, row, col, kind='complete', image_mode='CHW', preprocess=True)[source]#
Get a specific tile based on the tissue id and tile id
- Parameters:
tissue_id (str) – The tissue ID to retrieve the tile for.
row (int) – The row coordinate of the tile.
col (int) – The column coordinate of the tile.
kind (str) – The kind of tile image to retrieve. Default is “complete”.
image_mode (str) – The image mode of the tile image. Valid options are “CHW” and “HWC”. Default is “CHW”.
preprocess (bool) – If True, preprocess the image (normalize). Default is True.
- Returns:
HETissue: The specific tile as an HETissue instance.
- get_tile(tissue_id, tile_id, kind='complete', image_mode='CHW', preprocess=True)[source]#
Get a specific tile based on the tissue id and tile id
- Parameters:
tissue_id (str) – The tissue ID to retrieve the tile for.
tile_id (int) – The tile ID to retrieve.
kind (str)
image_mode (str)
preprocess (bool)
- Returns:
HETissue: The specific tile as an HETissue instance.