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