SingleIHCImagingDataset#
- class spora_io.datasets.ihc.SingleIHCImagingDataset(name, marker_name, resolution, tile_size, path=None, load_cell_metadata=False, verbose=True, mean_std_type='imagenet', tile_strategy=None, split=None, **kwargs)[source]#
Bases:
BaseImagingDatasetClass for handling IHC stained imaging datasets.
- Parameters:
name (str)
marker_name (str)
resolution (float | str)
tile_size (int)
path (os.PathLike | str | None)
load_cell_metadata (bool)
verbose (bool)
mean_std_type (str)
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” and “hibou”.
- 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. Default is “complete”. Valid options are “complete”, “qc_filtered”, and “filtered”.
datasets (For H&E)
channel. ("qc_filtered" and "filtered" will return the same image since there is only one modality)
preprocess (bool) – If True, preprocess the image (standardize). Default is True.
image_mode (str)
- Returns:
IHCTissue: The normalized tissue image as an IHCTissue 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 coordinates.
- 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. Only “complete” is supported for IHC datasets.
image_mode (str) – The image mode of the tile image. Valid options are “CHW” and “HWC”.
preprocess (bool) – Whether to preprocess the tile image before returning it.
- Returns:
IHCTissue: The specific tile as an IHCTissue 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.
kind (str) – The kind of tile image to retrieve. Only “complete” is supported for IHC datasets since there is only one modality channel. Default is “complete”.
image_mode (str) – The image mode of the tile image. Valid options are “CHW” and “HWC”. Default is “CHW”.
preprocess (bool) – Whether to preprocess the tile image (e.g. normalize) before returning it. Default is True.
tile_id (int) – The tile ID to retrieve.
- Returns:
IHCTissue: The specific tile as an IHCTissue instance.