|
a |
|
b/main.py |
|
|
1 |
import numpy as np |
|
|
2 |
import nibabel as nib |
|
|
3 |
from utils import * |
|
|
4 |
from segment_lung import segment_lung |
|
|
5 |
from segment_airway import segment_airway |
|
|
6 |
|
|
|
7 |
params = define_parameter() |
|
|
8 |
|
|
|
9 |
##################################################### |
|
|
10 |
# Load image |
|
|
11 |
##################################################### |
|
|
12 |
|
|
|
13 |
I = nib.load('./data/sample_ct.nii.gz') |
|
|
14 |
I_affine = I.affine |
|
|
15 |
I = I.get_data() |
|
|
16 |
|
|
|
17 |
##################################################### |
|
|
18 |
# Coarse segmentation of lung & airway |
|
|
19 |
##################################################### |
|
|
20 |
|
|
|
21 |
Mlung = segment_lung(params, I, I_affine) |
|
|
22 |
|
|
|
23 |
##################################################### |
|
|
24 |
# Romove airway from lung mask |
|
|
25 |
##################################################### |
|
|
26 |
|
|
|
27 |
Mlung, Maw = segment_airway(params, I, I_affine, Mlung) |