-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet_Max_Projection.py
50 lines (39 loc) · 1.29 KB
/
Get_Max_Projection.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 h5py
import tables
from scipy import signal, ndimage, stats
from sklearn.linear_model import LinearRegression
from skimage.morphology import white_tophat
from sklearn.preprocessing import StandardScaler
from skimage.transform import rescale
from PIL import Image
import os
import cv2
from datetime import datetime
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from time import sleep
import sys
def get_blue_file(base_directory):
file_list = os.listdir(base_directory)
for file in file_list:
if "Blue" in file:
return base_directory + "/" + file
def check_max_projection(home_directory, output_directory):
print("Getting Max Projection")
# Load Data
blue_file = get_blue_file(home_directory)
blue_data_container = h5py.File(blue_file, 'r')
blue_data = blue_data_container["Data"]
sample = blue_data[:, 0:1000]
max_projection = np.max(sample, axis=1)
max_projection = np.reshape(max_projection, (600, 608))
save_location = os.path.join(output_directory, "max_projection.npy")
print("MAsk save location: ", save_location)
np.save(save_location, max_projection)
plt.imshow(max_projection)
plt.show(block=False)
plt.pause(5)
plt.close()