trw.datasets.medical_decathlon

Module Contents

Classes

MedicalDecathlonDataset

Functions

load_nifti(path: str, dtype, base_name: str, remove_patient_transform: bool = False) → Dict[str, Union[str, torch.Tensor]]

Load a nifti file and metadata.

_load_case_adaptor(batch: trw.basic_typing.Batch, dataset: MedicalDecathlonDataset, transform_fn: Optional[trw.transforms.Transform])

create_decathlon_dataset(task_name: str, root: str = None, transform_train: trw.transforms.Transform = None, transform_valid: trw.transforms.Transform = None, nb_workers: int = 4, valid_ratio: float = 0.2, batch_size: int = 1, remove_patient_transform: bool = False) → trw.basic_typing.Datasets

Create a task of the medical decathlon dataset.

Attributes

nib

trw.datasets.medical_decathlon.nib
trw.datasets.medical_decathlon.load_nifti(path: str, dtype, base_name: str, remove_patient_transform: bool = False) Dict[str, Union[str, torch.Tensor]]

Load a nifti file and metadata.

Parameters
  • path – the path to the nifti file

  • base_name – the name of this data

  • dtype – the type of the nifti image to be converted to

  • remove_patient_transform – if True, remove the affine transformation attached to the voxels

Returns

a dict of attributes

class trw.datasets.medical_decathlon.MedicalDecathlonDataset(task_name: str, root: str, collection: str = 'training', remove_patient_transform: bool = False)
resource
dataset_name = decathlon
__call__(self, id: int) MutableMapping[str, Union[str, torch.Tensor]]
__len__(self)
trw.datasets.medical_decathlon._load_case_adaptor(batch: trw.basic_typing.Batch, dataset: MedicalDecathlonDataset, transform_fn: Optional[trw.transforms.Transform])
trw.datasets.medical_decathlon.create_decathlon_dataset(task_name: str, root: str = None, transform_train: trw.transforms.Transform = None, transform_valid: trw.transforms.Transform = None, nb_workers: int = 4, valid_ratio: float = 0.2, batch_size: int = 1, remove_patient_transform: bool = False) trw.basic_typing.Datasets

Create a task of the medical decathlon dataset.

The dataset is available here http://medicaldecathlon.com/ with accompanying publication: https://arxiv.org/abs/1902.09063

Parameters
  • task_name – the name of the task

  • root – the root folder where the data will be created and possibly downloaded

  • transform_train – a function that take a batch of training data and return a transformed batch

  • transform_valid – a function that take a batch of valid data and return a transformed batch

  • nb_workers – the number of workers used for the preprocessing

  • valid_ratio – the ratio of validation data

  • batch_size – the batch size

  • remove_patient_transform – if True, remove the affine transformation attached to the voxels

Returns

a dictionary of datasets