-
Notifications
You must be signed in to change notification settings - Fork 0
/
adjust_better.py
33 lines (25 loc) · 920 Bytes
/
adjust_better.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
import skimage
import skimage.io
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('C:/Users/woottenm/Documents/Code/zebrafish-analysis/')
from snippets.assorted import map_np
from crop_circle import *
def get_mean_image(image_stack):
return None
image_list = []
for i in range(2, 751):
image_list.append(skimage.io.imread('C:/Users/woottenm/Pictures/Zebrafish/f1_{:06d}.bmp'.format(i)))
I = np.array(image_list)
del image_list
mean_image = skimage.exposure.rescale_intensity(I.mean(axis=0))
within_dish_indices = get_circle_coords(mean_image, radius_adjust=-20)
mean_image[within_dish_indices] = mean_image[within_dish_indices].mean()
I_adjusted = I - mean_image
del I
del mean_image
I_adjusted_scaled = map_np(skimage.exposure.rescale_intensity, I_adjusted)
del I_adjusted
for i in range(2, 751):
skimage.io.imsave('no-ghost-{:03d}.png'.format(i), I_adjusted_scaled[i])