Dataset¶
This module holds all of the pytorch dataset classes
niftidataset.dataset
the actual dataset classes of niftidataset
Author: Jacob Reinhold (jacob.reinhold@jhu.edu)
Created on: Oct 24, 2018
-
niftidataset.dataset.
train_val_split
(source_dir: str, target_dir: str, valid_pct: float = 0.2, transform: Optional[Callable] = None, preload: bool = False)¶ create two separate NiftiDatasets in PyTorch for working with NifTi files. If a directory contains source files and the other one contains target files and also you dont have a specific directory for validation set, this function splits data to two NiftiDatasets randomly with given percentage.
Parameters: - source_dir (str) – path to source images.
- target_dir (str) – path to target images.
- valid_pct (float) – percent of validation set from data.
- transform (Callable) – transform to apply to both source and target images.
- preload – load all data when initializing the dataset
Returns: (train_dataset, validation_dataset).
Return type: Tuple