|
a |
|
b/README.md |
|
|
1 |
# Preprocessing on Brain MRI Sequence |
|
|
2 |
|
|
|
3 |
This is a pipeline to do preprocessing on brain MR images of **ADNI** dataset |
|
|
4 |
by using FMRIB Software Library (**FSL**) and Advanced Normalization Tools (**ANTs**). |
|
|
5 |
|
|
|
6 |
## 1. Install FSL & ANTs |
|
|
7 |
|
|
|
8 |
Download and install **FSL** as instructions [here](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation). |
|
|
9 |
Compile **ANTs** from source code in [Linux and macOS](https://github.com/ANTsX/ANTs/wiki/Compiling-ANTs-on-Linux-and-Mac-OS), or in [Windows 10](https://github.com/ANTsX/ANTs/wiki/Compiling-ANTs-on-Windows-10). |
|
|
10 |
|
|
|
11 |
## 2. Install Python Packages |
|
|
12 |
|
|
|
13 |
All required libraries are listed as below: |
|
|
14 |
|
|
|
15 |
- tqdm |
|
|
16 |
- numpy |
|
|
17 |
- scipy |
|
|
18 |
- nipype |
|
|
19 |
- nibabel |
|
|
20 |
- matplotlib |
|
|
21 |
- sciKit-fuzzy (optional) |
|
|
22 |
- scikit-learn (optional) |
|
|
23 |
|
|
|
24 |
## 3. Download Dataset |
|
|
25 |
|
|
|
26 |
The dataset used in this repo is AD and NC screening images of ADNI1 and ADNI2. |
|
|
27 |
See [README.md in *data*](https://github.com/quqixun/BrainPrep/tree/master/data). |
|
|
28 |
|
|
|
29 |
Here is one sample of original image. |
|
|
30 |
|
|
|
31 |
<img src="https://github.com/quqixun/BrainPrep/blob/master/imgs/original.png" alt="original image" width="250"> |
|
|
32 |
|
|
|
33 |
## 4. Reorgnization Files |
|
|
34 |
|
|
|
35 |
Switch the working directory to *src*. |
|
|
36 |
Run reorgnize.py, which merge ADNI1 and ADNI2 into one folder. |
|
|
37 |
``` |
|
|
38 |
python reorgnize.py |
|
|
39 |
``` |
|
|
40 |
|
|
|
41 |
## 5. Registration |
|
|
42 |
|
|
|
43 |
Run registraion.py to transform images into the coordinate system of template by **FSL FLIRT**. |
|
|
44 |
``` |
|
|
45 |
python registraion.py |
|
|
46 |
``` |
|
|
47 |
|
|
|
48 |
The output of the above image from this step looks like: |
|
|
49 |
|
|
|
50 |
<img src="https://github.com/quqixun/BrainPrep/blob/master/imgs/registration.png" alt="registration" width="250"> |
|
|
51 |
|
|
|
52 |
## 6. Skull-Strpping |
|
|
53 |
|
|
|
54 |
Run skull_stripping.py to remove skull from registrated images by **FSL BET**. |
|
|
55 |
``` |
|
|
56 |
python skull_stripping.py |
|
|
57 |
``` |
|
|
58 |
|
|
|
59 |
Output: |
|
|
60 |
|
|
|
61 |
<img src="https://github.com/quqixun/BrainPrep/blob/master/imgs/skull_stripping.png" alt="skull stripping" width="250"> |
|
|
62 |
|
|
|
63 |
## 7. Bias Field Correction |
|
|
64 |
|
|
|
65 |
Run bias_correction.py to remove bias-field signal from images by **ANTs**. |
|
|
66 |
``` |
|
|
67 |
python bias_correction.py |
|
|
68 |
``` |
|
|
69 |
|
|
|
70 |
Output: |
|
|
71 |
|
|
|
72 |
<img src="https://github.com/quqixun/BrainPrep/blob/master/imgs/bias_correction.png" alt="bias field correction" width="250"> |
|
|
73 |
|
|
|
74 |
## 8. Enhancement (optional) |
|
|
75 |
|
|
|
76 |
Based on outputs from step 7, run enhancement.py to enhance images by **histogram equalization**. |
|
|
77 |
``` |
|
|
78 |
python enahncement.py |
|
|
79 |
``` |
|
|
80 |
|
|
|
81 |
## 9. Tissue Segmentation (optional) |
|
|
82 |
|
|
|
83 |
Based on outputs from step 7, run segment.py to segment brain into GM, WM and CSF |
|
|
84 |
by **KMeans** or **Fuzzy-CMeans** (you should change settings in script). |
|
|
85 |
``` |
|
|
86 |
python segment.py |
|
|
87 |
``` |
|
|
88 |
Or run fast_segment.py to do segmentation by **FSL FAST**. |
|
|
89 |
``` |
|
|
90 |
python fast_segment.py |
|
|
91 |
``` |