-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmove.py
37 lines (22 loc) · 831 Bytes
/
move.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
import cv2 as cv
import os
import shutil
path = r"D:\Documents\School\2020-21\CT\LIDC-IDRI"
def crawl_move_singlevolume(path, num):
start = r"Data\Out"
for file in os.listdir(path):
subpath = os.path.join(path, file)
subsubpath = os.listdir(subpath)[0]
num_dicoms = len(os.listdir(os.path.join(subpath, subsubpath)))
if (num_dicoms > 100):
source = os.path.join(subpath, subsubpath)
destination = os.path.join(start, num)
dest = shutil.move(source, destination)
print(dest)
def crawl(root):
patch = r"Data\In\0"
for file in os.listdir(root):
marker = ((file[-4:]) + '.png')
if (marker in os.listdir(patch)):
crawl_move_singlevolume(os.path.join(root, file), file[-4:])
crawl(path)