Skip to content

Utilities to download and load an MRI brain tumor dataset with Python, providing 2D slices, tumor masks and tumor classes.

License

Notifications You must be signed in to change notification settings

guillaumefrd/brain-tumor-mri-dataset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brain-tumor-mri-dataset

Utilities to:

  • download (using a few command lines) an MRI brain tumor dataset providing 2D slices, tumor masks and tumor classes.
  • load the dataset in Python.

The dataset can be used for different tasks like image classification, object detection or semantic / instance segmentation.

It was originally published here in Matlab v7.3 format.

3064 T1-weighted contrast-inhanced images with three kinds of brain tumor are provided.

dataset-overview

Download the dataset

# create a directory
mkdir brain_tumor_dataset
cd brain_tumor_dataset

# download the dataset
wget https://ndownloader.figshare.com/articles/1512427/versions/5

# unzip the dataset and delete the zip
unzip 5 && rm 5

# concatenate the multiple zipped data in a single zip
cat brainTumorDataPublic_* > brainTumorDataPublic_temp.zip
zip -FF brainTumorDataPublic_temp.zip --out data.zip

# remove the temporary files
rm brainTumorDataPublic_*

# unzip the full archive and delete it 
unzip data.zip -d data && rm data.zip

# check that "data" contains 3064 files
ls data | wc -l

Load the dataset with Python

Requirements
- numpy
- cv2
- hdf5storage
Usage

Execute the script matlab_to_numpy.py with the dataset path as parameter.

python matlab_to_numpy.py ~/brain_tumor_dataset

Optional: set the image dimension with --image-dimension or -d (default is 512).

Visualization of the dataset

Notebook to visualize:

  • the repartition of classes
  • the 2D slices with the tumor mask
  • the tumors

References

@article{Cheng2017,
author = "Jun Cheng",
title = "{brain tumor dataset}",
year = "2017",
month = "4",
url = "https://figshare.com/articles/brain_tumor_dataset/1512427",
doi = "10.6084/m9.figshare.1512427.v5"
}

About

Utilities to download and load an MRI brain tumor dataset with Python, providing 2D slices, tumor masks and tumor classes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published