-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path01_get_dicom.py
executable file
·24 lines (19 loc) · 980 Bytes
/
01_get_dicom.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
# Environment ------------------------------------------------------------------
import os
import click
# Main -------------------------------------------------------------------------
@click.command()
@click.option('-p', '--path', type=click.Path(exists=True), required=True,
help='a path to a project folder containing raw dicom files')
@click.option('-k1', '--keyword1', default='DICOM', required=True,
help='a path to a project folder containing raw dicom files')
@click.option('-k2', '--keyword2', default='A', required=True,
help='a path to a project folder containing raw dicom files')
def main(path, keyword1, keyword2):
'''find all the dicom sub-diretories under a project folder'''
cmd = f'find {path} \( -name {keyword1} -o -name {keyword2} \) > dicomlist.txt'
print(cmd)
os.system(cmd)
# Terminal Function ------------------------------------------------------------
if __name__ == '__main__':
main()