-
Notifications
You must be signed in to change notification settings - Fork 3
/
csv_whole.py
40 lines (36 loc) · 910 Bytes
/
csv_whole.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
import os
pat = "/storage/research/Intern19_v2/AutomatedDetectionWSI/LiverImages/"
#pat_1 = "/storage/research/Intern19_v2/AutomatedDetectionWSI/level_1/"
#pat_2 = "/storage/research/Intern19_v2/AutomatedDetectionWSI/level_2/"
a= os.walk(pat)
a = list(a)
l = []
for i in a[0][2]:
if '.xml' in i or 'svs' in i or 'SVS' in i:
continue
else:
l.append(i)
print(len(l))
#from pyslide import pyramid
from skimage import io
whole = {}
viable = {}
for i in l:
p = os.path.join(pat,i)
print(p)
l_1 = io.imread(p)
#print("l_1 loaded")
d = i[:-4] # 01_01_0083_l_0
print(d, l_1.shape)
if 'whole' in d:
whole[d] = l_1.shape
print("whole")
else:
viable[d] = l_1.shape
print("viable")
import pandas as pd
df = pd.DataFrame(whole)
#print(df.head)
df.to_csv("whole.csv")
df = pd.DataFrame(viable)
df.to_csv("viable.csv")