-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetUID.py
More file actions
37 lines (26 loc) · 1010 Bytes
/
getUID.py
File metadata and controls
37 lines (26 loc) · 1010 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
28
29
30
31
32
33
34
35
36
37
from utils import *
# path = 'Data/02-06-2020/DICOM/Lung_Dx-G0011'
# path = '/home/wangshuo/Desktop/test_data/Lung-PET-CT-Dx/G0011'
# path = 'Data/02-06-2020/DICOM/Lung_Dx-G0011/04-29-2009-LUNGC-51228/2.000000-A phase 5mm Stnd SS50-53792/2-017.dcm'
def getUID_path(path):
dict = {}
list = os.listdir(path)
for date in list:
date_path = os.path.join(path, date)
series_list = os.listdir(date_path)
series_list.sort()
for series in series_list:
series_path = os.path.join(date_path, series)
dicom_list = os.listdir(series_path)
dicom_list.sort()
for dicom in dicom_list:
dicom_path = os.path.join(series_path, dicom)
info = loadFileInformation(dicom_path)
dict[info['dicom_num']] = (dicom_path, dicom)
return dict
def getUID_file(path):
info = loadFileInformation(path)
UID = info['dicom_num']
return UID
# dict = getUID_file(path)
# print(dict)