-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLPODAnalysis.py
More file actions
106 lines (56 loc) · 2.06 KB
/
LPODAnalysis.py
File metadata and controls
106 lines (56 loc) · 2.06 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from os import listdir
from os.path import isfile, join
import Eclipse as ec
from numpy import ones
import matplotlib.pyplot as plt
import misc
# pth = '/Users/jlesage/Dropbox/Eclipse/POD-FBHS1-T-Images/'
pth = '/Users/jlesage/Dropbox/Eclipse/POD-FBHS-T-5MHz/'
dirs = listdir(pth)
prfl=[f.strip('.png').split('-')[-1] for f in listdir(pth) if f.endswith('.png')]
if len(prfl)>0:
dirs = [d for d in dirs if (not(d.endswith('.png')))&(not(d.split('/')[-1] in prfl))&(d.split('/')[-1]!='.DS_Store')&(not(d.endswith('.csv')))]
else:
dirs = [d for d in dirs if (d.split('/')[-1]!='.DS_Store')&(not(d.endswith('.csv')))]
for d in dirs:
# fl = ec.FMCImage(pth+d+'/',[[5.,45.],[30.,70.]])
fl = ec.FMCImage(pth+d+'/',[[3.,55.],[5.,40.]])
flname = (pth+d).split('/')
flname = flname[-1]
#
# fl.HorizontalStack()
#
# fl.RemoveSlices()
#
# fl.AxialStack()
#
# fl.RectangularCropImages()
fl.AxialStack()
fl.RectangularCropImages()
fl.GetBinaryImages()
#
# S = fl.GetMetric(s)
# B = fl.GetMetric(b)
fl.HorizontalStack()
fig,ax = plt.subplots(3,sharex=True)
# ax[0].axis('off')
ax[0].set_title('Side View')
# ax[1].axis('off')
ax[1].set_title('Binary Side View')
ax[2].set_title('Bimodality Coefficient')
ax[0].imshow(fl.HStack,extent=[fl.Region[2,0],fl.Region[2,1],fl.Region[1,1],fl.Region[1,0]])
ax[1].imshow(fl.BinaryHStack,cmap='gray',extent=[fl.Region[2,0],fl.Region[2,1],fl.Region[1,1],fl.Region[1,0]])
# ax[1].plot(S)
# ax[1].plot(1.5*ones(S.shape))
# ax[1].plot(2*ones(S.shape))
# ax[1].plot(2.5*ones(S.shape))
ax[2].plot(fl.BimodalityCoefficient)
ax[2].plot((5/9)*ones(fl.BimodalityCoefficient.shape))
plt.ion()
plt.show()
# ans = input('Enter Weld Classifcation - 0 for None, 1 for Minor, 2 for Major, 3 for Poor Data: ')
# fig.xlabel(flname+' - '+anskey[ans])
fig.savefig(pth+flname+'.png',format='png')
plt.close(fig)
del(fl)
# open(resultsfl,'a').write(flname+','+anskey[int(ans)]+'\n')