celldetective 1.0.2__py3-none-any.whl → 1.1.0__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 +2 -2
- celldetective/events.py +2 -44
- celldetective/filters.py +4 -5
- celldetective/gui/__init__.py +1 -1
- celldetective/gui/analyze_block.py +37 -10
- celldetective/gui/btrack_options.py +24 -23
- celldetective/gui/classifier_widget.py +62 -19
- celldetective/gui/configure_new_exp.py +32 -35
- celldetective/gui/control_panel.py +115 -81
- celldetective/gui/gui_utils.py +674 -396
- celldetective/gui/json_readers.py +7 -6
- celldetective/gui/layouts.py +755 -0
- celldetective/gui/measurement_options.py +168 -487
- celldetective/gui/neighborhood_options.py +322 -270
- celldetective/gui/plot_measurements.py +1114 -0
- celldetective/gui/plot_signals_ui.py +20 -20
- celldetective/gui/process_block.py +449 -169
- celldetective/gui/retrain_segmentation_model_options.py +27 -26
- celldetective/gui/retrain_signal_model_options.py +25 -24
- celldetective/gui/seg_model_loader.py +31 -27
- celldetective/gui/signal_annotator.py +2326 -2295
- celldetective/gui/signal_annotator_options.py +18 -16
- celldetective/gui/styles.py +16 -1
- celldetective/gui/survival_ui.py +61 -39
- celldetective/gui/tableUI.py +60 -23
- celldetective/gui/thresholds_gui.py +68 -66
- celldetective/gui/viewers.py +596 -0
- celldetective/io.py +234 -23
- celldetective/measure.py +37 -32
- celldetective/neighborhood.py +495 -27
- celldetective/preprocessing.py +683 -0
- celldetective/scripts/analyze_signals.py +7 -0
- celldetective/scripts/measure_cells.py +12 -0
- celldetective/scripts/segment_cells.py +5 -0
- celldetective/scripts/track_cells.py +11 -0
- celldetective/signals.py +221 -98
- celldetective/tracking.py +0 -1
- celldetective/utils.py +178 -36
- celldetective-1.1.0.dist-info/METADATA +305 -0
- celldetective-1.1.0.dist-info/RECORD +80 -0
- {celldetective-1.0.2.dist-info → celldetective-1.1.0.dist-info}/top_level.txt +1 -0
- tests/__init__.py +0 -0
- tests/test_events.py +28 -0
- tests/test_filters.py +24 -0
- tests/test_io.py +70 -0
- tests/test_measure.py +141 -0
- tests/test_neighborhood.py +70 -0
- tests/test_segmentation.py +93 -0
- tests/test_signals.py +135 -0
- tests/test_tracking.py +164 -0
- tests/test_utils.py +71 -0
- celldetective-1.0.2.dist-info/METADATA +0 -192
- celldetective-1.0.2.dist-info/RECORD +0 -66
- {celldetective-1.0.2.dist-info → celldetective-1.1.0.dist-info}/LICENSE +0 -0
- {celldetective-1.0.2.dist-info → celldetective-1.1.0.dist-info}/WHEEL +0 -0
- {celldetective-1.0.2.dist-info → celldetective-1.1.0.dist-info}/entry_points.txt +0 -0
|
@@ -30,19 +30,21 @@ from skimage.measure import regionprops_table
|
|
|
30
30
|
import json
|
|
31
31
|
import os
|
|
32
32
|
|
|
33
|
+
from celldetective.gui.viewers import StackVisualizer
|
|
34
|
+
from celldetective.gui import Styles
|
|
33
35
|
|
|
34
|
-
class ThresholdConfigWizard(QMainWindow):
|
|
36
|
+
class ThresholdConfigWizard(QMainWindow, Styles):
|
|
35
37
|
"""
|
|
36
38
|
UI to create a threshold pipeline for segmentation.
|
|
37
39
|
|
|
38
40
|
"""
|
|
39
41
|
|
|
40
|
-
def __init__(self,
|
|
42
|
+
def __init__(self, parent_window=None):
|
|
41
43
|
|
|
42
44
|
super().__init__()
|
|
43
|
-
self.
|
|
44
|
-
self.screen_height = self.
|
|
45
|
-
self.screen_width = self.
|
|
45
|
+
self.parent_window = parent_window
|
|
46
|
+
self.screen_height = self.parent_window.parent_window.parent_window.parent_window.screen_height
|
|
47
|
+
self.screen_width = self.parent_window.parent_window.parent_window.parent_window.screen_width
|
|
46
48
|
self.setMinimumWidth(int(0.8 * self.screen_width))
|
|
47
49
|
self.setMinimumHeight(int(0.8 * self.screen_height))
|
|
48
50
|
self.setWindowTitle("Threshold configuration wizard")
|
|
@@ -50,9 +52,9 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
50
52
|
self._createActions()
|
|
51
53
|
self._createMenuBar()
|
|
52
54
|
|
|
53
|
-
self.mode = self.
|
|
54
|
-
self.pos = self.
|
|
55
|
-
self.exp_dir = self.
|
|
55
|
+
self.mode = self.parent_window.mode
|
|
56
|
+
self.pos = self.parent_window.parent_window.parent_window.pos
|
|
57
|
+
self.exp_dir = self.parent_window.parent_window.exp_dir
|
|
56
58
|
self.soft_path = get_software_location()
|
|
57
59
|
self.footprint = 30
|
|
58
60
|
self.min_dist = 30
|
|
@@ -157,14 +159,14 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
157
159
|
filter_list_option_grid.addWidget(section_preprocess, 90, alignment=Qt.AlignLeft)
|
|
158
160
|
|
|
159
161
|
self.delete_filter = QPushButton("")
|
|
160
|
-
self.delete_filter.setStyleSheet(self.
|
|
162
|
+
self.delete_filter.setStyleSheet(self.button_select_all)
|
|
161
163
|
self.delete_filter.setIcon(icon(MDI6.trash_can, color="black"))
|
|
162
164
|
self.delete_filter.setToolTip("Remove filter")
|
|
163
165
|
self.delete_filter.setIconSize(QSize(20, 20))
|
|
164
166
|
self.delete_filter.clicked.connect(self.filters_qlist.removeSel)
|
|
165
167
|
|
|
166
168
|
self.add_filter = QPushButton("")
|
|
167
|
-
self.add_filter.setStyleSheet(self.
|
|
169
|
+
self.add_filter.setStyleSheet(self.button_select_all)
|
|
168
170
|
self.add_filter.setIcon(icon(MDI6.filter_plus, color="black"))
|
|
169
171
|
self.add_filter.setToolTip("Add filter")
|
|
170
172
|
self.add_filter.setIconSize(QSize(20, 20))
|
|
@@ -180,7 +182,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
180
182
|
self.apply_filters_btn = QPushButton("Apply")
|
|
181
183
|
self.apply_filters_btn.setIcon(icon(MDI6.filter_cog_outline, color="white"))
|
|
182
184
|
self.apply_filters_btn.setIconSize(QSize(20, 20))
|
|
183
|
-
self.apply_filters_btn.setStyleSheet(self.
|
|
185
|
+
self.apply_filters_btn.setStyleSheet(self.button_style_sheet)
|
|
184
186
|
self.apply_filters_btn.clicked.connect(self.preprocess_image)
|
|
185
187
|
grid_preprocess.addWidget(self.apply_filters_btn, 2, 0, 1, 3)
|
|
186
188
|
|
|
@@ -201,14 +203,14 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
201
203
|
|
|
202
204
|
self.ylog_check = QPushButton("")
|
|
203
205
|
self.ylog_check.setIcon(icon(MDI6.math_log, color="black"))
|
|
204
|
-
self.ylog_check.setStyleSheet(self.
|
|
206
|
+
self.ylog_check.setStyleSheet(self.button_select_all)
|
|
205
207
|
self.ylog_check.clicked.connect(self.switch_to_log)
|
|
206
208
|
threshold_title_grid.addWidget(self.ylog_check, 5)
|
|
207
209
|
|
|
208
210
|
self.equalize_option_btn = QPushButton("")
|
|
209
211
|
self.equalize_option_btn.setIcon(icon(MDI6.equalizer, color="black"))
|
|
210
212
|
self.equalize_option_btn.setIconSize(QSize(20, 20))
|
|
211
|
-
self.equalize_option_btn.setStyleSheet(self.
|
|
213
|
+
self.equalize_option_btn.setStyleSheet(self.button_select_all)
|
|
212
214
|
self.equalize_option_btn.setToolTip("Enable histogram matching")
|
|
213
215
|
self.equalize_option_btn.clicked.connect(self.activate_histogram_equalizer)
|
|
214
216
|
self.equalize_option = False
|
|
@@ -223,7 +225,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
223
225
|
self.threshold_slider.setTickInterval(0.00001)
|
|
224
226
|
self.threshold_slider.setOrientation(1)
|
|
225
227
|
self.threshold_slider.setDecimals(3)
|
|
226
|
-
self.threshold_slider.setRange(np.amin(self.img), np.amax(self.img))
|
|
228
|
+
self.threshold_slider.setRange(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
227
229
|
self.threshold_slider.setValue([np.percentile(self.img.flatten(), 90), np.amax(self.img)])
|
|
228
230
|
self.threshold_slider.valueChanged.connect(self.threshold_changed)
|
|
229
231
|
|
|
@@ -246,7 +248,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
246
248
|
#################
|
|
247
249
|
|
|
248
250
|
self.save_btn = QPushButton('Save')
|
|
249
|
-
self.save_btn.setStyleSheet(self.
|
|
251
|
+
self.save_btn.setStyleSheet(self.button_style_sheet)
|
|
250
252
|
self.save_btn.clicked.connect(self.write_instructions)
|
|
251
253
|
self.left_panel.addWidget(self.save_btn)
|
|
252
254
|
|
|
@@ -290,14 +292,14 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
290
292
|
|
|
291
293
|
self.markers_btn = QPushButton("Run")
|
|
292
294
|
self.markers_btn.clicked.connect(self.detect_markers)
|
|
293
|
-
self.markers_btn.setStyleSheet(self.
|
|
295
|
+
self.markers_btn.setStyleSheet(self.button_style_sheet)
|
|
294
296
|
hbox_marker_btns.addWidget(self.markers_btn)
|
|
295
297
|
|
|
296
298
|
self.watershed_btn = QPushButton("Watershed")
|
|
297
299
|
self.watershed_btn.setIcon(icon(MDI6.waves_arrow_up, color="white"))
|
|
298
300
|
self.watershed_btn.setIconSize(QSize(20, 20))
|
|
299
301
|
self.watershed_btn.clicked.connect(self.apply_watershed_to_selection)
|
|
300
|
-
self.watershed_btn.setStyleSheet(self.
|
|
302
|
+
self.watershed_btn.setStyleSheet(self.button_style_sheet)
|
|
301
303
|
self.watershed_btn.setEnabled(False)
|
|
302
304
|
hbox_marker_btns.addWidget(self.watershed_btn)
|
|
303
305
|
marker_box.addLayout(hbox_marker_btns)
|
|
@@ -329,7 +331,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
329
331
|
'eliminate points using a query such as: area > 100 or eccentricity > 0.95')
|
|
330
332
|
hbox_classify.addWidget(self.property_query_le, 70)
|
|
331
333
|
self.submit_query_btn = QPushButton('Submit...')
|
|
332
|
-
self.submit_query_btn.setStyleSheet(self.
|
|
334
|
+
self.submit_query_btn.setStyleSheet(self.button_style_sheet)
|
|
333
335
|
self.submit_query_btn.clicked.connect(self.apply_property_query)
|
|
334
336
|
hbox_classify.addWidget(self.submit_query_btn, 20)
|
|
335
337
|
properties_box.addLayout(hbox_classify)
|
|
@@ -367,7 +369,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
367
369
|
self.contrast_slider.setSingleStep(0.00001)
|
|
368
370
|
self.contrast_slider.setTickInterval(0.00001)
|
|
369
371
|
self.contrast_slider.setOrientation(1)
|
|
370
|
-
self.contrast_slider.setRange(np.amin(self.img), np.amax(self.img))
|
|
372
|
+
self.contrast_slider.setRange(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
371
373
|
self.contrast_slider.setValue([np.percentile(self.img.flatten(), 1), np.percentile(self.img.flatten(), 99.99)])
|
|
372
374
|
self.contrast_slider.valueChanged.connect(self.contrast_slider_action)
|
|
373
375
|
contrast_hbox.addWidget(QLabel('contrast: '))
|
|
@@ -383,7 +385,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
383
385
|
|
|
384
386
|
print("this is the loaded position: ", self.pos)
|
|
385
387
|
if isinstance(self.pos, str):
|
|
386
|
-
movies = glob(self.pos + f"movie/{self.
|
|
388
|
+
movies = glob(self.pos + f"movie/{self.parent_window.parent_window.parent_window.movie_prefix}*.tif")
|
|
387
389
|
|
|
388
390
|
else:
|
|
389
391
|
msgBox = QMessageBox()
|
|
@@ -392,10 +394,9 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
392
394
|
msgBox.setWindowTitle("Warning")
|
|
393
395
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
|
394
396
|
returnValue = msgBox.exec()
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return None
|
|
397
|
+
self.img = None
|
|
398
|
+
self.close()
|
|
399
|
+
return None
|
|
399
400
|
|
|
400
401
|
if len(movies) == 0:
|
|
401
402
|
msgBox = QMessageBox()
|
|
@@ -404,11 +405,11 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
404
405
|
msgBox.setWindowTitle("Warning")
|
|
405
406
|
msgBox.setStandardButtons(QMessageBox.Ok)
|
|
406
407
|
returnValue = msgBox.exec()
|
|
407
|
-
|
|
408
|
-
|
|
408
|
+
self.img = None
|
|
409
|
+
self.close()
|
|
409
410
|
else:
|
|
410
411
|
self.stack_path = movies[0]
|
|
411
|
-
self.len_movie = self.
|
|
412
|
+
self.len_movie = self.parent_window.parent_window.parent_window.len_movie
|
|
412
413
|
len_movie_auto = auto_load_number_of_frames(self.stack_path)
|
|
413
414
|
if len_movie_auto is not None:
|
|
414
415
|
self.len_movie = len_movie_auto
|
|
@@ -480,10 +481,10 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
480
481
|
self.ax_hist.spines['top'].set_visible(False)
|
|
481
482
|
self.ax_hist.spines['right'].set_visible(False)
|
|
482
483
|
# self.ax_hist.set_yticks([])
|
|
483
|
-
self.ax_hist.set_xlim(np.amin(self.img), np.amax(self.img))
|
|
484
|
+
self.ax_hist.set_xlim(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
484
485
|
self.ax_hist.set_ylim(0, self.hist_y.max())
|
|
485
486
|
|
|
486
|
-
self.threshold_slider.setRange(np.amin(self.img), np.amax(self.img))
|
|
487
|
+
self.threshold_slider.setRange(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
487
488
|
self.threshold_slider.setValue([np.nanpercentile(self.img.flatten(), 90), np.amax(self.img)])
|
|
488
489
|
self.add_hist_threshold()
|
|
489
490
|
|
|
@@ -505,12 +506,12 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
505
506
|
self.ax_hist.spines['top'].set_visible(False)
|
|
506
507
|
self.ax_hist.spines['right'].set_visible(False)
|
|
507
508
|
# self.ax_hist.set_yticks([])
|
|
508
|
-
self.ax_hist.set_xlim(np.amin(self.img), np.amax(self.img))
|
|
509
|
+
self.ax_hist.set_xlim(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
509
510
|
self.ax_hist.set_ylim(0, self.hist_y.max())
|
|
510
511
|
self.add_hist_threshold()
|
|
511
512
|
self.canvas_hist.canvas.draw()
|
|
512
513
|
|
|
513
|
-
self.threshold_slider.setRange(np.amin(self.img), np.amax(self.img))
|
|
514
|
+
self.threshold_slider.setRange(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
514
515
|
self.threshold_slider.setValue([np.nanpercentile(self.img.flatten(), 90), np.amax(self.img)])
|
|
515
516
|
self.threshold_changed(self.threshold_slider.value())
|
|
516
517
|
|
|
@@ -571,7 +572,7 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
571
572
|
self.vmax = np.nanpercentile(self.img.flatten(), 99.)
|
|
572
573
|
|
|
573
574
|
self.contrast_slider.disconnect()
|
|
574
|
-
self.contrast_slider.setRange(np.amin(self.img), np.amax(self.img))
|
|
575
|
+
self.contrast_slider.setRange(np.amin(self.img[self.img==self.img]), np.amax(self.img[self.img==self.img]))
|
|
575
576
|
self.contrast_slider.setValue([self.vmin, self.vmax])
|
|
576
577
|
self.contrast_slider.valueChanged.connect(self.contrast_slider_action)
|
|
577
578
|
|
|
@@ -815,9 +816,9 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
815
816
|
outfile.write(json_object)
|
|
816
817
|
print("Configuration successfully written in ", self.instruction_file)
|
|
817
818
|
|
|
818
|
-
self.
|
|
819
|
-
self.
|
|
820
|
-
self.
|
|
819
|
+
self.parent_window.filename = self.instruction_file
|
|
820
|
+
self.parent_window.file_label.setText(self.instruction_file[:16] + '...')
|
|
821
|
+
self.parent_window.file_label.setToolTip(self.instruction_file)
|
|
821
822
|
|
|
822
823
|
self.close()
|
|
823
824
|
else:
|
|
@@ -872,11 +873,11 @@ class ThresholdConfigWizard(QMainWindow):
|
|
|
872
873
|
|
|
873
874
|
|
|
874
875
|
class ThresholdNormalisation(ThresholdConfigWizard):
|
|
875
|
-
def __init__(self, min_threshold, current_channel,
|
|
876
|
+
def __init__(self, min_threshold, current_channel, parent_window=None):
|
|
876
877
|
QMainWindow.__init__(self)
|
|
877
|
-
self.
|
|
878
|
-
self.screen_height = self.
|
|
879
|
-
self.screen_width = self.
|
|
878
|
+
self.parent_window = parent_window
|
|
879
|
+
self.screen_height = self.parent_window.parent_window.parent_window.parent_window.screen_height
|
|
880
|
+
self.screen_width = self.parent_window.parent_window.parent_window.parent_window.screen_width
|
|
880
881
|
self.setMaximumWidth(int(self.screen_width // 3))
|
|
881
882
|
self.setMinimumHeight(int(0.8 * self.screen_height))
|
|
882
883
|
self.setWindowTitle("Normalisation threshold preview")
|
|
@@ -884,9 +885,9 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
884
885
|
self.img = None
|
|
885
886
|
self.min_threshold = min_threshold
|
|
886
887
|
self.current_channel = current_channel
|
|
887
|
-
self.mode = self.
|
|
888
|
-
self.pos = self.
|
|
889
|
-
self.exp_dir = self.
|
|
888
|
+
self.mode = self.parent_window.mode
|
|
889
|
+
self.pos = self.parent_window.parent_window.parent_window.pos
|
|
890
|
+
self.exp_dir = self.parent_window.parent_window.exp_dir
|
|
890
891
|
self.soft_path = get_software_location()
|
|
891
892
|
self.auto_close = False
|
|
892
893
|
|
|
@@ -945,7 +946,7 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
945
946
|
self.contrast_slider.setSingleStep(0.00001)
|
|
946
947
|
self.contrast_slider.setTickInterval(0.00001)
|
|
947
948
|
self.contrast_slider.setOrientation(1)
|
|
948
|
-
self.contrast_slider.setRange(np.amin(self.frame), np.amax(self.frame))
|
|
949
|
+
self.contrast_slider.setRange(np.amin(self.frame[self.frame==self.frame]), np.amax(self.frame[self.frame==self.frame]))
|
|
949
950
|
self.contrast_slider.setValue(
|
|
950
951
|
[np.percentile(self.frame.flatten(), 1), np.percentile(self.frame.flatten(), 99.99)])
|
|
951
952
|
self.contrast_slider.valueChanged.connect(self.contrast_slider_action)
|
|
@@ -954,11 +955,11 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
954
955
|
contrast_slider_layout.addWidget(self.contrast_slider)
|
|
955
956
|
|
|
956
957
|
self.submit_threshold_btn = QPushButton('Submit')
|
|
957
|
-
self.submit_threshold_btn.setStyleSheet(self.
|
|
958
|
+
self.submit_threshold_btn.setStyleSheet(self.button_style_sheet_2)
|
|
958
959
|
self.submit_threshold_btn.clicked.connect(self.get_threshold)
|
|
959
960
|
self.ylog_check = QPushButton("")
|
|
960
961
|
self.ylog_check.setIcon(icon(MDI6.math_log, color="black"))
|
|
961
|
-
self.ylog_check.setStyleSheet(self.
|
|
962
|
+
self.ylog_check.setStyleSheet(self.button_select_all)
|
|
962
963
|
self.ylog_check.clicked.connect(self.switch_to_log)
|
|
963
964
|
self.ylog_check.setMaximumWidth(30)
|
|
964
965
|
log_button = QHBoxLayout()
|
|
@@ -989,11 +990,11 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
989
990
|
self.ax_hist.set_xlabel('intensity [a.u.]')
|
|
990
991
|
self.ax_hist.spines['top'].set_visible(False)
|
|
991
992
|
self.ax_hist.spines['right'].set_visible(False)
|
|
992
|
-
self.ax_hist.set_xlim(np.amin(self.frame), np.amax(self.frame))
|
|
993
|
+
self.ax_hist.set_xlim(np.amin(self.frame[self.frame==self.frame]), np.amax(self.frame[self.frame==self.frame]))
|
|
993
994
|
self.ax_hist.set_ylim(0, self.hist_y.max())
|
|
994
995
|
self.threshold_slider.setSingleStep(0.001)
|
|
995
996
|
self.threshold_slider.setTickInterval(0.001)
|
|
996
|
-
self.threshold_slider.setRange(np.amin(self.frame), np.amax(self.frame))
|
|
997
|
+
self.threshold_slider.setRange(np.amin(self.frame[self.frame==self.frame]), np.amax(self.frame[self.frame==self.frame]))
|
|
997
998
|
self.threshold_slider.setValue(np.percentile(self.frame,90))
|
|
998
999
|
self.add_hist_threshold()
|
|
999
1000
|
|
|
@@ -1054,7 +1055,7 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
1054
1055
|
"""
|
|
1055
1056
|
|
|
1056
1057
|
if isinstance(self.pos, str):
|
|
1057
|
-
movies = glob(self.pos + f"movie/{self.
|
|
1058
|
+
movies = glob(self.pos + f"movie/{self.parent_window.parent_window.parent_window.movie_prefix}*.tif")
|
|
1058
1059
|
else:
|
|
1059
1060
|
msgBox = QMessageBox()
|
|
1060
1061
|
msgBox.setIcon(QMessageBox.Warning)
|
|
@@ -1080,7 +1081,7 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
1080
1081
|
return None
|
|
1081
1082
|
else:
|
|
1082
1083
|
self.stack_path = movies[0]
|
|
1083
|
-
self.len_movie = self.
|
|
1084
|
+
self.len_movie = self.parent_window.parent_window.parent_window.len_movie
|
|
1084
1085
|
len_movie_auto = auto_load_number_of_frames(self.stack_path)
|
|
1085
1086
|
if len_movie_auto is not None:
|
|
1086
1087
|
self.len_movie = len_movie_auto
|
|
@@ -1096,24 +1097,24 @@ class ThresholdNormalisation(ThresholdConfigWizard):
|
|
|
1096
1097
|
print(f'{self.stack_path} successfully located.')
|
|
1097
1098
|
|
|
1098
1099
|
def get_threshold(self):
|
|
1099
|
-
self.
|
|
1100
|
+
self.parent_window.tab2_txt_threshold.setText(str(self.threshold_slider.value()))
|
|
1100
1101
|
self.close()
|
|
1101
1102
|
|
|
1102
1103
|
|
|
1103
1104
|
class ThresholdSpot(ThresholdConfigWizard):
|
|
1104
|
-
def __init__(self, current_channel, img, mask,
|
|
1105
|
+
def __init__(self, current_channel, img, mask, parent_window=None):
|
|
1105
1106
|
QMainWindow.__init__(self)
|
|
1106
|
-
self.
|
|
1107
|
-
self.screen_height = self.
|
|
1108
|
-
self.screen_width = self.
|
|
1107
|
+
self.parent_window = parent_window
|
|
1108
|
+
self.screen_height = self.parent_window.parent_window.parent_window.parent_window.screen_height
|
|
1109
|
+
self.screen_width = self.parent_window.parent_window.parent_window.parent_window.screen_width
|
|
1109
1110
|
self.setMinimumHeight(int(0.8 * self.screen_height))
|
|
1110
1111
|
self.setWindowTitle("Spot threshold preview")
|
|
1111
1112
|
center_window(self)
|
|
1112
1113
|
self.img = img
|
|
1113
1114
|
self.current_channel = current_channel
|
|
1114
|
-
self.mode = self.
|
|
1115
|
-
self.pos = self.
|
|
1116
|
-
self.exp_dir = self.
|
|
1115
|
+
self.mode = self.parent_window.mode
|
|
1116
|
+
self.pos = self.parent_window.parent_window.parent_window.pos
|
|
1117
|
+
self.exp_dir = self.parent_window.parent_window.exp_dir
|
|
1117
1118
|
self.onlyFloat = QDoubleValidator()
|
|
1118
1119
|
self.onlyInt = QIntValidator()
|
|
1119
1120
|
self.soft_path = get_software_location()
|
|
@@ -1135,7 +1136,7 @@ class ThresholdSpot(ThresholdConfigWizard):
|
|
|
1135
1136
|
diameter_layout=QHBoxLayout()
|
|
1136
1137
|
self.diameter_lbl = QLabel('Spot diameter: ')
|
|
1137
1138
|
self.diameter_value = QLineEdit()
|
|
1138
|
-
self.diameter_value.setText(self.
|
|
1139
|
+
self.diameter_value.setText(self.parent_window.diameter_value.text())
|
|
1139
1140
|
self.diameter_value.setValidator(self.onlyFloat)
|
|
1140
1141
|
diameter_layout.addWidget(self.diameter_lbl, alignment=Qt.AlignCenter)
|
|
1141
1142
|
diameter_layout.addWidget(self.diameter_value, alignment=Qt.AlignCenter)
|
|
@@ -1144,7 +1145,7 @@ class ThresholdSpot(ThresholdConfigWizard):
|
|
|
1144
1145
|
self.threshold_lbl = QLabel('Spot threshold: ')
|
|
1145
1146
|
self.threshold_value = QLineEdit()
|
|
1146
1147
|
self.threshold_value.setValidator(self.onlyFloat)
|
|
1147
|
-
self.threshold_value.setText(self.
|
|
1148
|
+
self.threshold_value.setText(self.parent_window.threshold_value.text())
|
|
1148
1149
|
threshold_layout.addWidget(self.threshold_lbl, alignment=Qt.AlignCenter)
|
|
1149
1150
|
threshold_layout.addWidget(self.threshold_value, alignment=Qt.AlignCenter)
|
|
1150
1151
|
self.left_layout.addLayout(threshold_layout)
|
|
@@ -1162,14 +1163,14 @@ class ThresholdSpot(ThresholdConfigWizard):
|
|
|
1162
1163
|
def draw_spot_preview(self):
|
|
1163
1164
|
|
|
1164
1165
|
try:
|
|
1165
|
-
diameter_value = float(self.
|
|
1166
|
+
diameter_value = float(self.parent_window.diameter_value.text().replace(',','.'))
|
|
1166
1167
|
except:
|
|
1167
1168
|
print('Diameter could not be converted to float... Abort.')
|
|
1168
1169
|
self.auto_close = True
|
|
1169
1170
|
return None
|
|
1170
1171
|
|
|
1171
1172
|
try:
|
|
1172
|
-
threshold_value = float(self.
|
|
1173
|
+
threshold_value = float(self.parent_window.threshold_value.text().replace(',','.'))
|
|
1173
1174
|
except:
|
|
1174
1175
|
print('Threshold could not be converted to float... Abort.')
|
|
1175
1176
|
self.auto_close = True
|
|
@@ -1212,7 +1213,8 @@ class ThresholdSpot(ThresholdConfigWizard):
|
|
|
1212
1213
|
self.contrast_slider.setSingleStep(0.00001)
|
|
1213
1214
|
self.contrast_slider.setTickInterval(0.00001)
|
|
1214
1215
|
self.contrast_slider.setOrientation(1)
|
|
1215
|
-
|
|
1216
|
+
selection = self.frame[:, :, self.current_channel]
|
|
1217
|
+
self.contrast_slider.setRange(np.amin(selection[selection==selection]), np.amax(selection[selection==selection]))
|
|
1216
1218
|
self.contrast_slider.setValue(
|
|
1217
1219
|
[np.percentile(self.frame[:, :, self.current_channel].flatten(), 1), np.percentile(self.frame[:, :, self.current_channel].flatten(), 99.99)])
|
|
1218
1220
|
self.contrast_slider.valueChanged.connect(self.contrast_slider_action)
|
|
@@ -1221,9 +1223,9 @@ class ThresholdSpot(ThresholdConfigWizard):
|
|
|
1221
1223
|
contrast_slider_layout.addWidget(self.contrast_slider)
|
|
1222
1224
|
self.preview_button=QPushButton("Preview")
|
|
1223
1225
|
self.preview_button.clicked.connect(self.update_spots)
|
|
1224
|
-
self.preview_button.setStyleSheet(self.
|
|
1226
|
+
self.preview_button.setStyleSheet(self.button_style_sheet_2)
|
|
1225
1227
|
self.apply_changes=QPushButton("Apply")
|
|
1226
|
-
self.apply_changes.setStyleSheet(self.
|
|
1228
|
+
self.apply_changes.setStyleSheet(self.button_style_sheet)
|
|
1227
1229
|
self.apply_changes.clicked.connect(self.apply)
|
|
1228
1230
|
|
|
1229
1231
|
self.diameter_value.textChanged.connect(self.enable_preview)
|
|
@@ -1291,8 +1293,8 @@ class ThresholdSpot(ThresholdConfigWizard):
|
|
|
1291
1293
|
|
|
1292
1294
|
|
|
1293
1295
|
def apply(self):
|
|
1294
|
-
self.
|
|
1295
|
-
self.
|
|
1296
|
+
self.parent_window.threshold_value.setText(self.threshold_value.text())
|
|
1297
|
+
self.parent_window.diameter_value.setText(self.diameter_value.text())
|
|
1296
1298
|
self.close()
|
|
1297
1299
|
|
|
1298
1300
|
|