|
a |
|
b/README.md |
|
|
1 |
# MRI Segmentation Tool |
|
|
2 |
|
|
|
3 |
An MRI segmentation tool for lung and heart segmentation using PlatyPy library. |
|
|
4 |
|
|
|
5 |
## Environment |
|
|
6 |
|
|
|
7 |
- Ubuntu 20.04 |
|
|
8 |
- Python 3.8.10 |
|
|
9 |
|
|
|
10 |
## Installation |
|
|
11 |
|
|
|
12 |
1. Clone this repository: |
|
|
13 |
```bash |
|
|
14 |
git clone https://github.com/XiaoKChenEdu/MRI-Segmentation |
|
|
15 |
cd MRI-Segmentation |
|
|
16 |
``` |
|
|
17 |
|
|
|
18 |
2. Install dependencies: |
|
|
19 |
```bash |
|
|
20 |
pip install -r requirements.txt |
|
|
21 |
``` |
|
|
22 |
|
|
|
23 |
3. Install the custom lung segmentation module: |
|
|
24 |
```bash |
|
|
25 |
chmod +x install_lung.sh |
|
|
26 |
./install_lung.sh |
|
|
27 |
``` |
|
|
28 |
|
|
|
29 |
## Dependencies |
|
|
30 |
|
|
|
31 |
The following Python packages are required: |
|
|
32 |
|
|
|
33 |
- platipy==0.5.1 |
|
|
34 |
- platipy[cardiac] |
|
|
35 |
- SimpleITK==2.2.1 |
|
|
36 |
- matplotlib==3.7.1 |
|
|
37 |
- numpy==1.24.3 |
|
|
38 |
|
|
|
39 |
## Project Structure |
|
|
40 |
|
|
|
41 |
``` |
|
|
42 |
MRI-Segmentation/ |
|
|
43 |
├── requirements.txt |
|
|
44 |
├── lung_segmentation.py |
|
|
45 |
├── lung_segmentation_gui.py |
|
|
46 |
├── heart_segmentation.py |
|
|
47 |
├── heart_segmentation_gui.py |
|
|
48 |
├── input/ |
|
|
49 |
│ └── volumes/ |
|
|
50 |
└── output/ |
|
|
51 |
``` |
|
|
52 |
|
|
|
53 |
## Usage |
|
|
54 |
|
|
|
55 |
### GUI Tools |
|
|
56 |
|
|
|
57 |
1. For lung segmentation: |
|
|
58 |
```bash |
|
|
59 |
python lung_segmentation_gui.py |
|
|
60 |
``` |
|
|
61 |
|
|
|
62 |
2. For heart segmentation: |
|
|
63 |
```bash |
|
|
64 |
python heart_segmentation_gui.py |
|
|
65 |
``` |
|
|
66 |
|
|
|
67 |
### Command Line Tools |
|
|
68 |
|
|
|
69 |
1. For lung segmentation: |
|
|
70 |
```bash |
|
|
71 |
python lung_segmentation.py |
|
|
72 |
``` |
|
|
73 |
|
|
|
74 |
2. For heart segmentation: |
|
|
75 |
```bash |
|
|
76 |
python heart_segmentation.py |
|
|
77 |
``` |
|
|
78 |
|
|
|
79 |
## Input Format |
|
|
80 |
|
|
|
81 |
The tool accepts NIFTI files (*.nii.gz) as input. Place your input files in the `input/volumes/` directory. |
|
|
82 |
|
|
|
83 |
## Output |
|
|
84 |
|
|
|
85 |
The segmentation results will be saved in the `output/` directory, organized in subdirectories named after the input file. Each output directory contains: |
|
|
86 |
- Segmentation masks in NIFTI format (*.nii.gz) |
|
|
87 |
- Visualization of the segmentation (PNG format) |