-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell_anonymize.py
45 lines (37 loc) · 1.03 KB
/
shell_anonymize.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
__author__ = 'bison'
import sys
import os
import shutil
import core
from LadenUndSpeichernWL import ladenWL2 as lW
sourceDir = ''
destDir = ''
if len(sys.argv) != 3:
print 'Arguments have to be: "source_path" "dest_path"'
exit(1)
#sourceDir = '/home/bison/Dokumente/test/001_Anatomie_UK_Patient_1/DVT UK Patient 1'
#destDir = '/home/bison/Dokumente/test/tmp'
else:
sourceDir = sys.argv[1]
destDir = sys.argv[2]
files = core.getFilesFromDir(sourceDir)
if not files:
print 'no DICOM files found!'
exit(1)
wl = lW.WhiteList()
categorys = wl.categoryListFiles('lists')
holdingTags = []
for whiteList in categorys['tags_to_hold']:
holdingTags.append(wl.mainReadWhiteList('lists/tags_to_hold/'+whiteList+'.txt'))
print holdingTags
for f in files:
baseName = os.path.basename(f)
dstFile = os.path.join(destDir, baseName)
print f
#print dstFile
#print 10*'*'
core.anonymize_byWhitelist(holdingTags, f, dstFile)
#print f
#baseName = os.path.basename(f)
#shutil.copy(f, os.path.join(destDir, baseName))
#core.anonymize_byWhitelist()