[c6d664]: / main.py

Download this file

28 lines (20 with data), 778 Bytes

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