BraTS#

Format specification#

The original BraTS dataset is available here. The BraTS data provided since BraTS’17 differs significantly from the data provided during the previous BraTS challenges (i.e., 2016 and backwards). Datumaro supports BraTS’17-20.

Supported annotation types:

  • Mask

Convert BraTS dataset#

A Datumaro dataset can be converted in the following way:

datum convert -if brats -i <path/to/dataset> -o <output/dir>

It is also possible to convert the dataset using Python API:

from datumaro.components.dataset import Dataset

brats_dataset = Dataset.import_from('<path/to/dataset>', 'brats')

BraTS dataset directory should have the following structure:

dataset/
├── imagesTr
│   │── <img1>.nii.gz
│   │── <img2>.nii.gz
│   └── ...
├── imagesTs
│   │── <img3>.nii.gz
│   │── <img4>.nii.gz
│   └── ...
├── labels
└── labelsTr
    │── <img1>.nii.gz
    │── <img2>.nii.gz
    └── ...

The data in Datumaro is stored as multi-frame images (set of 2D images). Annotated images are stored as masks for each 2d image separately with an image_id attribute.

Export to other formats#

Datumaro can convert a BraTS dataset into any other format Datumaro supports. To get the expected result, convert the dataset to a format that supports segmentation masks.

You can convert a BraTS dataset to other dataset formats using CLI:

datum convert -if brats -i <path/to/dataset> \
    -f voc -o <output/dir> -- --save-media

Or, using Python API:

from datumaro.components.dataset import Dataset

dataset = Dataset.import_from('<path/to/dataset>', 'brats')
dataset.export('save_dir', 'voc')

Examples#

Examples of using this format from the code can be found in the format tests