forked from justinbois/bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise5_1.py
35 lines (31 loc) · 1.05 KB
/
exercise5_1.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
import numpy as np
import pandas as pd
# Our image processing tools
import skimage.filters
import skimage.io
import skimage.measure
import skimage.morphology
import skimage.segmentation
import image_segmentation_function as sf
import matplotlib.pyplot as plt
import glob
import seaborn as sns
rc={'lines.linewidth': 2, 'axes.labelsize': 18, 'axes.titlesize': 18}
sns.set(rc=rc)
sns.set_style('dark')
image_names = glob.glob('data/bacterial_growth/*.tif')
images = []
for filename in image_names:
im = skimage.io.imread(filename)
images.append(im)
segmented_image = []
for im in images:
segmented_image.append(sf.image_segmentation(im, interpixel_dist=0.0645, microscopy='fluorescent'))
plt.imshow(images[1])
plt.imshow(segmented_image[1], cmap=plt.cm.BuGn, alpha=0.5)
im_rgb = np.dstack(3 * [images[1] / images[1].max()])
# im_copy = np.copy(images[1] / images[1].max())
# im_copy[segmented_image[1] > 0] = 1.0
# merge = np.dstack((images[1] / images[1].max(), im_copy, images[1]/images[1].max()))
# plt.imshow(merge)
im_rgb[segmented_image[1] > 0] = 1.0