-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexplore.py
50 lines (39 loc) · 1.34 KB
/
explore.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
46
47
48
49
50
import numpy as np
import matplotlib.pyplot as plt
import os
import os.path
from PIL import Image
from read_data import process_image
# Data PATH
BASE_DIR = '/home/yasaman/Documents/Winter18/fluorescence/'
HEALTH_DIR ='healthy/'
SICK_DIR = 'sick/'
healthy = os.listdir(os.path.join(BASE_DIR, HEALTH_DIR))
sick = os.listdir(os.path.join(BASE_DIR, SICK_DIR))
healthy.sort()
sick.sort()
picked_healthy = 3
picked_sick = 3
healthy_im = Image.open(os.path.join(BASE_DIR, HEALTH_DIR, healthy[picked_healthy]))
sick_im = Image.open(os.path.join(BASE_DIR, SICK_DIR, sick[picked_sick]))
heal_arr = np.asarray(healthy_im, dtype='float32')
sic_arr = np.asarray(sick_im, dtype='float32')
heal_corr= process_image(healthy_im)
sic_corr = process_image(sick_im)
fig1 = plt.figure()
ax11 = fig1.add_subplot(121)
ax11.imshow(heal_arr[:,:,0], cmap='gray')
ax11.set_title("Red channel")
ax12 = fig1.add_subplot(122)
ax12.imshow(heal_arr[:,:,1], cmap='gray')
ax12.set_title("Green Channel")
fig1.suptitle("Healthy, "+ healthy[picked_healthy]+ ", Corr is" + str(heal_corr))
fig2 = plt.figure()
ax21 = fig2.add_subplot(121)
ax21.imshow(sic_arr[:,:,0], cmap='gray')
ax21.set_title("Red channel")
ax22 = fig2.add_subplot(122)
ax22.imshow(sic_arr[:,:,1], cmap='gray')
ax22.set_title("Green Channel")
fig2.suptitle("Sick, Corr is "+ sick[picked_sick]+ "Corr is" + str(sic_corr))
plt.show()