LidcIdriSliceDataset#
- class deepinv.datasets.LidcIdriSliceDataset(root=None, transform=None, hounsfield_units=False, use_dict_output=False)#
Bases:
ImageDatasetDataset for LIDC-IDRI that provides access to CT image slices.
Published in Armato III et al.[1].
The Lung Image Database Consortium image collection (LIDC-IDRI) consistsof diagnostic and lung cancer screening thoracic computed tomography (CT)scans with marked-up annotated lesions.Warning
To download the raw dataset, you will need to install the NBIA Data Retriever, then download the manifest file (.tcia file) here, and open it by double clicking.
Raw data file structure:
self.root --- LIDC-IDRI --- LICENCE | -- LIDC-IDRI-0001 --- `STUDY_UID` --- `SERIES_UID` --- xxx.xml | | -- 1-001.dcm | -- LIDC-IDRI-1010 | | -- 1-xxx.dcm -- metadata.csv0) There are 1010 patients and a total of 1018 CT scans.1) Each CT scan is composed of 2d slices.2) Each slice is stored as a .dcm file3) This class gives access to one slice of a CT scan per data sample.4) Each slice is represented as an (512, 512) array.- Parameters:
root (str) – Root directory of dataset. Directory path from where we load and save the dataset.
transform: (Callable) – (optional) A function/transform that takes in a data sample and returns a transformed version.
hounsfield_units (bool) – If
True, convert pixel values to Hounsfield Units (HU). Default isFalse.use_dict_output (bool) – whether to return output as dict with keys “x”, “y”, “params” instead of tuple (default
False).
- Examples:
Instantiate dataset
import torch from deepinv.datasets import LidcIdriSliceDataset root = "/path/to/dataset/LIDC-IDRI" dataset = LidcIdriSliceDataset(root=root) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2, shuffle=True) batch = next(iter(dataloader)) print(batch.shape)
Note
This class requires the
pandasandpydicompackages to be installed. Install them withpip install pandasandpip install pydicom.
- References:
- class SliceSampleIdentifier(slice_fname, scan_folder, patient_id)#
Bases:
NamedTupleData structure for identifying slices.
In LIDC-IDRI, there are 1010 patients. Among them, 8 patients have each 2 CT scans.
- Parameters: