-
Notifications
You must be signed in to change notification settings - Fork 41
/
run_full_cascade_deploy.py
executable file
·46 lines (40 loc) · 1.23 KB
/
run_full_cascade_deploy.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""
Created on 2016
@author: rothhr
"""
## Input output
img_dir = '/media/CTimages'
img_search = '.nii.gz'
label_dir = None
label_search = ''
output_root = '/media/auto3DUNET_abdomen_TEST--3dUnet'
######################## FUNCTIONS ###############################
import os
import sys
from deploy_cascade import deploy_cascade
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from data import recursive_glob, recursive_glob2
images_with_no_labels = []
images = recursive_glob(img_dir,img_search)
#DEVICE=None # CPU only mode
DEVICE=0
for image in images:
basename = os.path.splitext(os.path.basename(image))[0]
basename = basename.replace('series','')
if label_dir is not None:
label = recursive_glob2(label_dir,basename,'.raw')
else:
label = []
if len(label) != 1:
print('[WARNING] No unique label found for {}'.format(image))
images_with_no_labels.append(image)
label = None
else:
label = label[0]
print('image: {}'.format(image))
print('label: {}'.format(label))
deploy_cascade(image,label,output_root,DEVICE)
print('{} images_with_no_labels:'.format(len(images_with_no_labels)))
for i in images_with_no_labels:
print(i)