celldetective 1.3.2__py3-none-any.whl → 1.3.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- celldetective/__main__.py +30 -4
- celldetective/_version.py +1 -1
- celldetective/extra_properties.py +21 -0
- celldetective/filters.py +15 -2
- celldetective/gui/InitWindow.py +28 -34
- celldetective/gui/analyze_block.py +3 -498
- celldetective/gui/classifier_widget.py +1 -1
- celldetective/gui/control_panel.py +100 -29
- celldetective/gui/generic_signal_plot.py +35 -18
- celldetective/gui/gui_utils.py +143 -2
- celldetective/gui/layouts.py +7 -6
- celldetective/gui/measurement_options.py +38 -43
- celldetective/gui/plot_measurements.py +5 -13
- celldetective/gui/plot_signals_ui.py +30 -30
- celldetective/gui/process_block.py +66 -197
- celldetective/gui/retrain_segmentation_model_options.py +3 -1
- celldetective/gui/signal_annotator.py +50 -32
- celldetective/gui/signal_annotator2.py +7 -4
- celldetective/gui/styles.py +13 -0
- celldetective/gui/survival_ui.py +8 -21
- celldetective/gui/tableUI.py +1 -2
- celldetective/gui/thresholds_gui.py +195 -205
- celldetective/gui/viewers.py +262 -12
- celldetective/io.py +85 -11
- celldetective/measure.py +128 -88
- celldetective/models/segmentation_effectors/ricm_bf_all_last/config_input.json +79 -0
- celldetective/models/segmentation_effectors/ricm_bf_all_last/ricm_bf_all_last +0 -0
- celldetective/models/segmentation_effectors/ricm_bf_all_last/training_instructions.json +37 -0
- celldetective/models/segmentation_effectors/test-transfer/config_input.json +39 -0
- celldetective/models/segmentation_effectors/test-transfer/test-transfer +0 -0
- celldetective/neighborhood.py +0 -2
- celldetective/scripts/measure_cells.py +21 -9
- celldetective/signals.py +77 -66
- celldetective/tracking.py +19 -13
- {celldetective-1.3.2.dist-info → celldetective-1.3.4.dist-info}/METADATA +12 -10
- {celldetective-1.3.2.dist-info → celldetective-1.3.4.dist-info}/RECORD +41 -36
- {celldetective-1.3.2.dist-info → celldetective-1.3.4.dist-info}/WHEEL +1 -1
- tests/test_qt.py +5 -3
- {celldetective-1.3.2.dist-info → celldetective-1.3.4.dist-info}/LICENSE +0 -0
- {celldetective-1.3.2.dist-info → celldetective-1.3.4.dist-info}/entry_points.txt +0 -0
- {celldetective-1.3.2.dist-info → celldetective-1.3.4.dist-info}/top_level.txt +0 -0
|
@@ -2213,10 +2213,13 @@ class SignalAnnotator2(QMainWindow,Styles):
|
|
|
2213
2213
|
self.index = ind[0]
|
|
2214
2214
|
elif len(ind)>1:
|
|
2215
2215
|
# More than one point in vicinity
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2216
|
+
try:
|
|
2217
|
+
datax,datay = [positions[self.framedata][i,0] for i in ind],[positions[self.framedata][i,1] for i in ind]
|
|
2218
|
+
msx, msy = event.mouseevent.xdata, event.mouseevent.ydata
|
|
2219
|
+
dist = np.sqrt((np.array(datax)-msx)**2+(np.array(datay)-msy)**2)
|
|
2220
|
+
self.index = ind[np.argmin(dist)]
|
|
2221
|
+
except Exception as e:
|
|
2222
|
+
print(f"{e=}")
|
|
2220
2223
|
else:
|
|
2221
2224
|
self.index = None
|
|
2222
2225
|
|
celldetective/gui/styles.py
CHANGED
|
@@ -23,6 +23,7 @@ class Styles(object):
|
|
|
23
23
|
|
|
24
24
|
def init_button_styles(self):
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
self.button_style_sheet = '''
|
|
27
28
|
QPushButton {
|
|
28
29
|
background-color: #1565c0;
|
|
@@ -147,6 +148,18 @@ class Styles(object):
|
|
|
147
148
|
}
|
|
148
149
|
'''
|
|
149
150
|
|
|
151
|
+
self.menu_check_style = '''
|
|
152
|
+
QCheckBox {
|
|
153
|
+
font-size: 10px;
|
|
154
|
+
padding-left: 10px;
|
|
155
|
+
padding-top: 5px;
|
|
156
|
+
}
|
|
157
|
+
QCheckBox::indicator:unchecked:hover {
|
|
158
|
+
background-color : rgba(189, 189, 189, 1);
|
|
159
|
+
opacity : 0.3;
|
|
160
|
+
}
|
|
161
|
+
'''
|
|
162
|
+
|
|
150
163
|
self.button_add = '''
|
|
151
164
|
QPushButton {
|
|
152
165
|
background-color: transparent;
|
celldetective/gui/survival_ui.py
CHANGED
|
@@ -39,8 +39,8 @@ class ConfigSurvival(QWidget, Styles):
|
|
|
39
39
|
self.float_validator = QDoubleValidator()
|
|
40
40
|
self.auto_close = False
|
|
41
41
|
|
|
42
|
-
self.well_option = self.parent_window.parent_window.well_list.
|
|
43
|
-
self.position_option = self.parent_window.parent_window.position_list.
|
|
42
|
+
self.well_option = self.parent_window.parent_window.well_list.getSelectedIndices()
|
|
43
|
+
self.position_option = self.parent_window.parent_window.position_list.getSelectedIndices()
|
|
44
44
|
self.interpret_pos_location()
|
|
45
45
|
#self.config_path = self.exp_dir + self.config_name
|
|
46
46
|
|
|
@@ -62,15 +62,10 @@ class ConfigSurvival(QWidget, Styles):
|
|
|
62
62
|
|
|
63
63
|
"""
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
self.well_indices = np.array([self.well_option],dtype=int)
|
|
69
|
-
|
|
70
|
-
if self.position_option==0:
|
|
65
|
+
self.well_indices = self.parent_window.parent_window.well_list.getSelectedIndices()
|
|
66
|
+
self.position_indices = self.parent_window.parent_window.position_list.getSelectedIndices()
|
|
67
|
+
if self.position_indices==[]:
|
|
71
68
|
self.position_indices = None
|
|
72
|
-
else:
|
|
73
|
-
self.position_indices = np.array([self.position_option],dtype=int)
|
|
74
69
|
|
|
75
70
|
|
|
76
71
|
def populate_widget(self):
|
|
@@ -243,18 +238,10 @@ class ConfigSurvival(QWidget, Styles):
|
|
|
243
238
|
|
|
244
239
|
"""
|
|
245
240
|
|
|
246
|
-
self.well_option = self.parent_window.parent_window.well_list.
|
|
247
|
-
|
|
248
|
-
wo = '*'
|
|
249
|
-
else:
|
|
250
|
-
wo = self.well_option
|
|
251
|
-
self.position_option = self.parent_window.parent_window.position_list.currentIndex()
|
|
252
|
-
if self.position_option==0:
|
|
253
|
-
po = '*'
|
|
254
|
-
else:
|
|
255
|
-
po = self.position_option - 1
|
|
241
|
+
self.well_option = self.parent_window.parent_window.well_list.getSelectedIndices()
|
|
242
|
+
self.position_option = self.parent_window.parent_window.position_list.getSelectedIndices()
|
|
256
243
|
|
|
257
|
-
self.df, self.df_pos_info = load_experiment_tables(self.exp_dir, well_option=
|
|
244
|
+
self.df, self.df_pos_info = load_experiment_tables(self.exp_dir, well_option=self.well_option, position_option=self.position_option, population=self.cbs[0].currentText(), return_pos_info=True)
|
|
258
245
|
if self.df is None:
|
|
259
246
|
msgBox = QMessageBox()
|
|
260
247
|
msgBox.setIcon(QMessageBox.Warning)
|
celldetective/gui/tableUI.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from PyQt5.QtWidgets import QRadioButton, QButtonGroup, QMainWindow, QTableView, QAction, QMenu,QFileDialog, QLineEdit, QHBoxLayout, QWidget, QPushButton, QVBoxLayout, QComboBox, QLabel, QCheckBox, QMessageBox
|
|
2
|
-
from PyQt5.QtCore import Qt
|
|
2
|
+
from PyQt5.QtCore import Qt
|
|
3
3
|
from PyQt5.QtGui import QBrush, QColor, QDoubleValidator
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import matplotlib.pyplot as plt
|
|
@@ -17,7 +17,6 @@ from superqt import QColormapComboBox, QLabeledSlider, QSearchableComboBox
|
|
|
17
17
|
from superqt.fonticon import icon
|
|
18
18
|
from fonticon_mdi6 import MDI6
|
|
19
19
|
from math import floor
|
|
20
|
-
import re
|
|
21
20
|
|
|
22
21
|
from matplotlib import colormaps
|
|
23
22
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import math
|
|
2
|
-
|
|
3
|
-
import skimage
|
|
4
1
|
from PyQt5.QtWidgets import QAction, QMenu, QMainWindow, QMessageBox, QLabel, QWidget, QFileDialog, QHBoxLayout, \
|
|
5
2
|
QGridLayout, QLineEdit, QScrollArea, QVBoxLayout, QComboBox, QPushButton, QApplication, QPushButton, QRadioButton, QButtonGroup
|
|
6
3
|
from PyQt5.QtGui import QDoubleValidator, QIntValidator
|
|
7
|
-
from matplotlib.patches import Circle
|
|
8
|
-
from scipy import ndimage
|
|
9
|
-
from skimage.morphology import disk
|
|
10
4
|
|
|
11
5
|
from celldetective.filters import std_filter, gauss_filter
|
|
12
6
|
from celldetective.gui.gui_utils import center_window, FigureCanvas, ListWidget, FilterChoice, color_from_class, help_generic
|
|
@@ -1169,202 +1163,198 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
1169
1163
|
self.close()
|
|
1170
1164
|
|
|
1171
1165
|
|
|
1172
|
-
class ThresholdSpot(ThresholdConfigWizard):
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1166
|
+
# class ThresholdSpot(ThresholdConfigWizard):
|
|
1167
|
+
# def __init__(self, current_channel, img, mask, parent_window=None):
|
|
1168
|
+
# QMainWindow.__init__(self)
|
|
1169
|
+
# self.parent_window = parent_window
|
|
1170
|
+
# self.screen_height = self.parent_window.parent_window.parent_window.parent_window.screen_height
|
|
1171
|
+
# self.screen_width = self.parent_window.parent_window.parent_window.parent_window.screen_width
|
|
1172
|
+
# self.setMinimumHeight(int(0.8 * self.screen_height))
|
|
1173
|
+
# self.setWindowTitle("Spot threshold preview")
|
|
1174
|
+
# center_window(self)
|
|
1175
|
+
# self.img = img
|
|
1176
|
+
# self.current_channel = current_channel
|
|
1177
|
+
# self.mode = self.parent_window.mode
|
|
1178
|
+
# self.pos = self.parent_window.parent_window.parent_window.pos
|
|
1179
|
+
# self.exp_dir = self.parent_window.parent_window.exp_dir
|
|
1180
|
+
# self.onlyFloat = QDoubleValidator()
|
|
1181
|
+
# self.onlyInt = QIntValidator()
|
|
1182
|
+
# self.soft_path = get_software_location()
|
|
1183
|
+
# self.auto_close = False
|
|
1184
|
+
|
|
1185
|
+
# if self.img is not None:
|
|
1186
|
+
# print(self.img.shape)
|
|
1187
|
+
# #self.test_frame = self.img
|
|
1188
|
+
# self.frame = self.img
|
|
1189
|
+
# self.test_mask = mask
|
|
1190
|
+
# self.populate_all()
|
|
1191
|
+
# self.setAttribute(Qt.WA_DeleteOnClose)
|
|
1192
|
+
# if self.auto_close:
|
|
1193
|
+
# self.close()
|
|
1194
|
+
|
|
1195
|
+
# def populate_left_panel(self):
|
|
1196
|
+
|
|
1197
|
+
# self.left_layout = QVBoxLayout()
|
|
1198
|
+
# diameter_layout=QHBoxLayout()
|
|
1199
|
+
# self.diameter_lbl = QLabel('Spot diameter: ')
|
|
1200
|
+
# self.diameter_value = QLineEdit()
|
|
1201
|
+
# self.diameter_value.setText(self.parent_window.diameter_value.text())
|
|
1202
|
+
# self.diameter_value.setValidator(self.onlyFloat)
|
|
1203
|
+
# diameter_layout.addWidget(self.diameter_lbl, alignment=Qt.AlignCenter)
|
|
1204
|
+
# diameter_layout.addWidget(self.diameter_value, alignment=Qt.AlignCenter)
|
|
1205
|
+
# self.left_layout.addLayout(diameter_layout)
|
|
1206
|
+
# threshold_layout=QHBoxLayout()
|
|
1207
|
+
# self.threshold_lbl = QLabel('Spot threshold: ')
|
|
1208
|
+
# self.threshold_value = QLineEdit()
|
|
1209
|
+
# self.threshold_value.setValidator(self.onlyFloat)
|
|
1210
|
+
# self.threshold_value.setText(self.parent_window.threshold_value.text())
|
|
1211
|
+
# threshold_layout.addWidget(self.threshold_lbl, alignment=Qt.AlignCenter)
|
|
1212
|
+
# threshold_layout.addWidget(self.threshold_value, alignment=Qt.AlignCenter)
|
|
1213
|
+
# self.left_layout.addLayout(threshold_layout)
|
|
1214
|
+
# self.left_panel.addLayout(self.left_layout)
|
|
1215
|
+
|
|
1216
|
+
# def enable_preview(self):
|
|
1217
|
+
|
|
1218
|
+
# diam = self.diameter_value.text().replace(',','').replace('.','')
|
|
1219
|
+
# thresh = self.threshold_value.text().replace(',','').replace('.','')
|
|
1220
|
+
# if diam.isnumeric() and thresh.isnumeric():
|
|
1221
|
+
# self.preview_button.setEnabled(True)
|
|
1222
|
+
# else:
|
|
1223
|
+
# self.preview_button.setEnabled(False)
|
|
1224
|
+
|
|
1225
|
+
# def draw_spot_preview(self):
|
|
1226
|
+
|
|
1227
|
+
# try:
|
|
1228
|
+
# diameter_value = float(self.parent_window.diameter_value.text().replace(',','.'))
|
|
1229
|
+
# except:
|
|
1230
|
+
# print('Diameter could not be converted to float... Abort.')
|
|
1231
|
+
# self.auto_close = True
|
|
1232
|
+
# return None
|
|
1233
|
+
|
|
1234
|
+
# try:
|
|
1235
|
+
# threshold_value = float(self.parent_window.threshold_value.text().replace(',','.'))
|
|
1236
|
+
# except:
|
|
1237
|
+
# print('Threshold could not be converted to float... Abort.')
|
|
1238
|
+
# self.auto_close = True
|
|
1239
|
+
# return None
|
|
1240
|
+
|
|
1241
|
+
# lbl = self.test_mask
|
|
1242
|
+
# blobs = self.blob_preview(image=self.img[:, :, self.current_channel], label=lbl, threshold=threshold_value,
|
|
1243
|
+
# diameter=diameter_value)
|
|
1244
|
+
# mask = np.array([lbl[int(y), int(x)] != 0 for y, x, r in blobs])
|
|
1245
|
+
# if np.any(mask):
|
|
1246
|
+
# blobs_filtered = blobs[mask]
|
|
1247
|
+
# else:
|
|
1248
|
+
# blobs_filtered=[]
|
|
1249
|
+
|
|
1250
|
+
# self.fig_contour, self.ax_contour = plt.subplots(figsize=(4, 6))
|
|
1251
|
+
# self.fcanvas = FigureCanvas(self.fig_contour, title="Blob measurement", interactive=True)
|
|
1252
|
+
# self.ax_contour.clear()
|
|
1253
|
+
# self.im = self.ax_contour.imshow(self.img[:, :, self.current_channel], cmap='gray')
|
|
1254
|
+
# self.circles = [Circle((x, y), r, color='red', fill=False, alpha=0.3) for y, x, r in blobs_filtered]
|
|
1255
|
+
# for circle in self.circles:
|
|
1256
|
+
# self.ax_contour.add_artist(circle)
|
|
1257
|
+
# self.ax_contour.set_xticks([])
|
|
1258
|
+
# self.ax_contour.set_yticks([])
|
|
1259
|
+
# self.fig_contour.set_facecolor('none') # or 'None'
|
|
1260
|
+
# self.fig_contour.canvas.setStyleSheet("background-color: transparent;")
|
|
1261
|
+
# self.fcanvas.canvas.draw()
|
|
1262
|
+
|
|
1263
|
+
# def populate_all(self):
|
|
1264
|
+
# self.button_widget = QWidget()
|
|
1265
|
+
# main_layout = QVBoxLayout()
|
|
1266
|
+
# self.button_widget.setLayout(main_layout)
|
|
1267
|
+
# self.right_panel = QVBoxLayout()
|
|
1268
|
+
# self.left_panel = QVBoxLayout()
|
|
1269
|
+
# self.left_panel.setContentsMargins(30, 30, 30, 30)
|
|
1270
|
+
# self.populate_left_panel()
|
|
1271
|
+
# self.draw_spot_preview()
|
|
1272
|
+
# self.setCentralWidget(self.button_widget)
|
|
1273
|
+
# contrast_slider_layout = QHBoxLayout()
|
|
1274
|
+
# self.contrast_slider = QLabeledDoubleRangeSlider()
|
|
1275
|
+
# self.contrast_slider.setSingleStep(0.00001)
|
|
1276
|
+
# self.contrast_slider.setTickInterval(0.00001)
|
|
1277
|
+
# self.contrast_slider.setOrientation(1)
|
|
1278
|
+
# selection = self.frame[:, :, self.current_channel]
|
|
1279
|
+
# self.contrast_slider.setRange(np.amin(selection[selection==selection]), np.amax(selection[selection==selection]))
|
|
1280
|
+
# self.contrast_slider.setValue(
|
|
1281
|
+
# [np.percentile(self.frame[:, :, self.current_channel].flatten(), 1), np.percentile(self.frame[:, :, self.current_channel].flatten(), 99.99)])
|
|
1282
|
+
# self.contrast_slider.valueChanged.connect(self.contrast_slider_action)
|
|
1283
|
+
# contrast_label = QLabel("Contrast: ")
|
|
1284
|
+
# contrast_slider_layout.addWidget(contrast_label)
|
|
1285
|
+
# contrast_slider_layout.addWidget(self.contrast_slider)
|
|
1286
|
+
# self.preview_button=QPushButton("Preview")
|
|
1287
|
+
# self.preview_button.clicked.connect(self.update_spots)
|
|
1288
|
+
# self.preview_button.setStyleSheet(self.button_style_sheet_2)
|
|
1289
|
+
# self.apply_changes=QPushButton("Apply")
|
|
1290
|
+
# self.apply_changes.setStyleSheet(self.button_style_sheet)
|
|
1291
|
+
# self.apply_changes.clicked.connect(self.apply)
|
|
1292
|
+
|
|
1293
|
+
# self.diameter_value.textChanged.connect(self.enable_preview)
|
|
1294
|
+
# self.threshold_value.textChanged.connect(self.enable_preview)
|
|
1295
|
+
|
|
1296
|
+
# self.right_panel.addWidget(self.fcanvas.canvas)
|
|
1297
|
+
# self.right_panel.addWidget(self.fcanvas.toolbar)
|
|
1298
|
+
|
|
1299
|
+
# main_layout.addLayout(self.right_panel)
|
|
1300
|
+
# main_layout.addLayout(self.left_panel)
|
|
1301
|
+
# main_layout.addLayout(contrast_slider_layout)
|
|
1302
|
+
# main_layout.addWidget(self.preview_button)
|
|
1303
|
+
# main_layout.addWidget(self.apply_changes)
|
|
1304
|
+
# self.show()
|
|
1305
|
+
|
|
1306
|
+
# def blob_preview(self, image, label, threshold, diameter):
|
|
1307
|
+
# removed_background = image.copy()
|
|
1308
|
+
# dilated_image = ndimage.grey_dilation(label, footprint=disk(10))
|
|
1309
|
+
# removed_background[np.where(dilated_image == 0)] = 0
|
|
1310
|
+
# min_sigma = (1 / (1 + math.sqrt(2))) * diameter
|
|
1311
|
+
# max_sigma = math.sqrt(2) * min_sigma
|
|
1312
|
+
# blobs = skimage.feature.blob_dog(removed_background, threshold=threshold, min_sigma=min_sigma,
|
|
1313
|
+
# max_sigma=max_sigma, overlap=0.75)
|
|
1314
|
+
# return blobs
|
|
1315
|
+
|
|
1316
|
+
# def update_spots(self):
|
|
1317
|
+
|
|
1318
|
+
# try:
|
|
1319
|
+
# diameter_value = float(self.diameter_value.text().replace(',','.'))
|
|
1320
|
+
# except:
|
|
1321
|
+
# print('Diameter could not be converted to float... Abort.')
|
|
1322
|
+
# return None
|
|
1323
|
+
|
|
1324
|
+
# try:
|
|
1325
|
+
# threshold_value = float(self.threshold_value.text().replace(',','.'))
|
|
1326
|
+
# except:
|
|
1327
|
+
# print('Threshold could not be converted to float... Abort.')
|
|
1328
|
+
# return None
|
|
1329
|
+
# xlim = self.ax_contour.get_xlim()
|
|
1330
|
+
# ylim = self.ax_contour.get_ylim()
|
|
1331
|
+
# contrast_levels = self.contrast_slider.value()
|
|
1332
|
+
# blobs = self.blob_preview(image=self.frame[:, :, self.current_channel], label=self.test_mask,
|
|
1333
|
+
# threshold=threshold_value,
|
|
1334
|
+
# diameter=diameter_value)
|
|
1335
|
+
# mask = np.array([self.test_mask[int(y), int(x)] != 0 for y, x, r in blobs])
|
|
1336
|
+
# if np.any(mask):
|
|
1337
|
+
# blobs_filtered = blobs[mask]
|
|
1338
|
+
# else:
|
|
1339
|
+
# blobs_filtered = []
|
|
1340
|
+
# self.ax_contour.clear()
|
|
1341
|
+
# self.im = self.ax_contour.imshow(self.frame[:, :, self.current_channel], cmap='gray')
|
|
1342
|
+
# self.ax_contour.set_xticks([])
|
|
1343
|
+
# self.ax_contour.set_yticks([])
|
|
1344
|
+
# self.circles = [Circle((x, y), r, color='red', fill=False, alpha=0.3) for y, x, r in blobs_filtered]
|
|
1345
|
+
# for circle in self.circles:
|
|
1346
|
+
# self.ax_contour.add_artist(circle)
|
|
1347
|
+
# self.ax_contour.set_xlim(xlim)
|
|
1348
|
+
# self.ax_contour.set_ylim(ylim)
|
|
1349
|
+
|
|
1350
|
+
# self.im.set_data(self.frame[:, :, self.current_channel])
|
|
1351
|
+
# self.fig_contour.canvas.draw()
|
|
1352
|
+
# self.contrast_slider.setValue(contrast_levels)
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
# def apply(self):
|
|
1358
|
+
# self.parent_window.threshold_value.setText(self.threshold_value.text())
|
|
1359
|
+
# self.parent_window.diameter_value.setText(self.diameter_value.text())
|
|
1360
|
+
# self.close()
|