IMPORTANT: This is a mirror clone of https://github.com/izuane/BrainPrep_ISBI2015 with some tweaks that permit BrainPrep to work out of the box with the MSUCL dataset.
Note: This is a fork of BrainPrep (link: https://github.com/quqixun/BrainPrep) with the main difference being that I have tweaked this to handle the ISBI2015 dataset (link: https://smart-stats-tools.org/lesion-challenge-2015) instead of ADNI which the original BrainPrep handles.
Expected file structure for reorganize.py
- /data
-
/train
- /orig
- /patient_1
- [various .nii files]
- /patient_2
- [various .nii files]
- ...
- /patient_1
- /mask
- /patient_1
- [various .nii files]
- ...
- /patient_1
- /orig
-
/test
- /orig
- /patient_1
- [various .nii files]
- ...
- /patient_1
- /orig
-
Output file structure for reorganize.py
-
/data
-
/new_train
- /patient_1
- [various .nii files]
- ...
- /patient_1
-
/new_test
- /patient_1
- [various .nii files]
- ...
- /patient_1
-
This is a pipeline to do preprocessing on brain MR images of ADNI dataset
by using FMRIB Software Library (FSL) and Advanced Normalization Tools (ANTs).
Download and install FSL as instructions here.
Compile ANTs from source code in Linux and macOS, or in Windows 10.
All required libraries are listed as below:
- tqdm
- numpy
- scipy
- nipype
- nibabel
- matplotlib
- sciKit-fuzzy (optional)
- scikit-learn (optional)
Install dependencies by running $ pip install -r requirements.txt
The dataset used in this repo is AD and NC screening images of ADNI1 and ADNI2.
See README.md in data.
Here is one sample of original image.
Switch the working directory to src. Run reorgnize.py, which merge ADNI1 and ADNI2 into one folder.
python reorgnize.py
Run registraion.py to transform images into the coordinate system of template by FSL FLIRT.
python registraion.py
The output of the above image from this step looks like:
Run skull_stripping.py to remove skull from registrated images by FSL BET.
python skull_stripping.py
Output:
Run bias_correction.py to remove bias-field signal from images by ANTs.
python bias_correction.py
Output:
Based on outputs from step 7, run enhancement.py to enhance images by histogram equalization.
python enahncement.py
Based on outputs from step 7, run segment.py to segment brain into GM, WM and CSF
by KMeans or Fuzzy-CMeans (you should change settings in script).
python segment.py
Or run fast_segment.py to do segmentation by FSL FAST.
python fast_segment.py