Nii-Data

Since delira aims to provide dataloading tools for medical data (which is often stored in Nii-Files), the following classes and functions provide a basic way to load data from nii-files:

BaseLabelGenerator

class BaseLabelGenerator[source]

Base Class to load labels from json files

_load()[source]

Private Helper function to load the file

Returns

loaded values from file

Return type

Any

get_labels()[source]

Abstractmethod to get labels from class

Raises

NotImplementedError – if not overwritten in subclass

load_sample_nii

load_sample_nii(files, label_load_cls)[source]

Load sample from multiple ITK files

Parameters
  • files (dict with keys img and label) – filenames of nifti files and label file

  • label_load_cls (class) – function to be used for label parsing

Returns

sample: dict with keys data and label containing images and label

Return type

dict

Raises

AssertionError – if img.max() is greater than 511 or smaller than 1