Datasets¶
Dataset classes are required by the WSIInference class to streamline the process of patch extraction based on
user-defined parameters. Two WSI dataset classes, available in dplabtools, integrate with patch location classes
introduced in Patch locations/sampling.
Note
Since WSI dataset classes are descendants of PyTorch Dataset class, correctly installed PyTorch is required to import them in Python code.
WSI dataset class¶
- class dplabtools.slides.processing.WSIDataset(...)¶
Class for patch extraction during inference.
Basic usage¶
Assuming that patches object represents one of the classes introduced in Patch locations/sampling:
from dplabtools.slides.processing import WSIDataset
dataset = WSIDataset(patches=patches)
See also
Full example of inference process using WSIDataset
Class details¶
WSIDataset has no class specific parameters.
WSI dataset class (MRP)¶
- class dplabtools.slides.processing.WSIMultiResDataset(...)¶
Class for multi resolution patch extraction during inference.
See also
Basic usage¶
Assuming that patches object represents one of the classes introduced in Patch locations/sampling:
from dplabtools.slides.processing import WSIMultiResDataset
dataset = WSIMultiResDataset(patches=patches, levels_or_mpps=[0.5, 0.7. 0.9])
Class details¶
Parameters specific to WSIMultiResDataset:
- class dplabtoolshiddenclass_35e0e776aad6467593b2bfe568e1db6e
- Parameters:
levels_or_mpps (list of level_or_mpp values) – Numbers representing WSI levels or MPP values for multi resolution patches.
See also
Parameters common in all WSI dataset classes¶
- class dplabtoolshiddenclass_84cbea39ef314baea74f83c892e9ccae
- Parameters:
patches (object) – Object representing one of the patch location classes.
transform_fn (callable, optional) – A user-defined image transformation that will be called on each patch extracted via
get_region, this transformation should run its own to-tensor conversion. If no transformation is provided, the image objects will be converted to tensors usingto_tensorfrom the torchvision package.resampling_mode (str, optional) – One of two supported down/up-sampling methods:
wsiortile.extra_mpps (list of float, optional) – List of MPP values for
wsiresampling mode.zero_workers (bool, default=False) – Set to
True, ifWSIInferenceclass will havenum_workersset to 0.save_patches_dir (str, optional) – Directory for saving the extracted patches, should only be used for troubleshooting inference problems. The type of saved image files can be changed using
save_patches_image_typeclass attribute, the default image type is PNG.
Methods and properties common to all WSI dataset classes¶
Common methods and properties are derived from the base class.