celldetective 1.0.2.post1__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.
Files changed (56) hide show
  1. celldetective/__main__.py +2 -2
  2. celldetective/events.py +2 -44
  3. celldetective/filters.py +4 -5
  4. celldetective/gui/__init__.py +1 -1
  5. celldetective/gui/analyze_block.py +37 -10
  6. celldetective/gui/btrack_options.py +24 -23
  7. celldetective/gui/classifier_widget.py +62 -19
  8. celldetective/gui/configure_new_exp.py +32 -35
  9. celldetective/gui/control_panel.py +115 -81
  10. celldetective/gui/gui_utils.py +674 -396
  11. celldetective/gui/json_readers.py +7 -6
  12. celldetective/gui/layouts.py +755 -0
  13. celldetective/gui/measurement_options.py +168 -487
  14. celldetective/gui/neighborhood_options.py +322 -270
  15. celldetective/gui/plot_measurements.py +1114 -0
  16. celldetective/gui/plot_signals_ui.py +20 -20
  17. celldetective/gui/process_block.py +449 -169
  18. celldetective/gui/retrain_segmentation_model_options.py +27 -26
  19. celldetective/gui/retrain_signal_model_options.py +25 -24
  20. celldetective/gui/seg_model_loader.py +31 -27
  21. celldetective/gui/signal_annotator.py +2326 -2295
  22. celldetective/gui/signal_annotator_options.py +18 -16
  23. celldetective/gui/styles.py +16 -1
  24. celldetective/gui/survival_ui.py +61 -39
  25. celldetective/gui/tableUI.py +60 -23
  26. celldetective/gui/thresholds_gui.py +68 -66
  27. celldetective/gui/viewers.py +596 -0
  28. celldetective/io.py +234 -23
  29. celldetective/measure.py +37 -32
  30. celldetective/neighborhood.py +495 -27
  31. celldetective/preprocessing.py +683 -0
  32. celldetective/scripts/analyze_signals.py +7 -0
  33. celldetective/scripts/measure_cells.py +12 -0
  34. celldetective/scripts/segment_cells.py +5 -0
  35. celldetective/scripts/track_cells.py +11 -0
  36. celldetective/signals.py +221 -98
  37. celldetective/tracking.py +0 -1
  38. celldetective/utils.py +178 -36
  39. celldetective-1.1.0.dist-info/METADATA +305 -0
  40. celldetective-1.1.0.dist-info/RECORD +80 -0
  41. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.0.dist-info}/top_level.txt +1 -0
  42. tests/__init__.py +0 -0
  43. tests/test_events.py +28 -0
  44. tests/test_filters.py +24 -0
  45. tests/test_io.py +70 -0
  46. tests/test_measure.py +141 -0
  47. tests/test_neighborhood.py +70 -0
  48. tests/test_segmentation.py +93 -0
  49. tests/test_signals.py +135 -0
  50. tests/test_tracking.py +164 -0
  51. tests/test_utils.py +71 -0
  52. celldetective-1.0.2.post1.dist-info/METADATA +0 -221
  53. celldetective-1.0.2.post1.dist-info/RECORD +0 -66
  54. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.0.dist-info}/LICENSE +0 -0
  55. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.0.dist-info}/WHEEL +0 -0
  56. {celldetective-1.0.2.post1.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, parent=None):
42
+ def __init__(self, parent_window=None):
41
43
 
42
44
  super().__init__()
43
- self.parent = parent
44
- self.screen_height = self.parent.parent.parent.parent.screen_height
45
- self.screen_width = self.parent.parent.parent.parent.screen_width
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.parent.mode
54
- self.pos = self.parent.parent.parent.pos
55
- self.exp_dir = self.parent.parent.exp_dir
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.parent.parent.parent.parent.button_select_all)
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.parent.parent.parent.parent.button_select_all)
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.parent.parent.parent.parent.button_style_sheet)
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.parent.parent.parent.parent.button_select_all)
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.parent.parent.parent.parent.button_select_all)
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.parent.parent.parent.parent.button_style_sheet)
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.parent.parent.parent.parent.button_style_sheet)
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.parent.parent.parent.parent.button_style_sheet)
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.parent.parent.parent.parent.button_style_sheet)
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.parent.parent.parent.movie_prefix}*.tif")
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
- if returnValue == QMessageBox.Ok:
396
- self.img = None
397
- self.close()
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
- if returnValue == QMessageBox.Yes:
408
- self.close()
408
+ self.img = None
409
+ self.close()
409
410
  else:
410
411
  self.stack_path = movies[0]
411
- self.len_movie = self.parent.parent.parent.len_movie
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.parent.filename = self.instruction_file
819
- self.parent.file_label.setText(self.instruction_file[:16] + '...')
820
- self.parent.file_label.setToolTip(self.instruction_file)
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, parent=None):
876
+ def __init__(self, min_threshold, current_channel, parent_window=None):
876
877
  QMainWindow.__init__(self)
877
- self.parent = parent
878
- self.screen_height = self.parent.parent.parent.parent.screen_height
879
- self.screen_width = self.parent.parent.parent.parent.screen_width
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.parent.mode
888
- self.pos = self.parent.parent.parent.pos
889
- self.exp_dir = self.parent.parent.exp_dir
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.parent.parent.parent.parent.button_style_sheet_2)
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.parent.parent.parent.parent.button_select_all)
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.parent.parent.parent.movie_prefix}*.tif")
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.parent.parent.parent.len_movie
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.parent.tab2_txt_threshold.setText(str(self.threshold_slider.value()))
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, parent=None):
1105
+ def __init__(self, current_channel, img, mask, parent_window=None):
1105
1106
  QMainWindow.__init__(self)
1106
- self.parent = parent
1107
- self.screen_height = self.parent.parent.parent.parent.screen_height
1108
- self.screen_width = self.parent.parent.parent.parent.screen_width
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.parent.mode
1115
- self.pos = self.parent.parent.parent.pos
1116
- self.exp_dir = self.parent.parent.exp_dir
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.parent.diameter_value.text())
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.parent.threshold_value.text())
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.parent.diameter_value.text().replace(',','.'))
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.parent.threshold_value.text().replace(',','.'))
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
- self.contrast_slider.setRange(np.amin(self.frame[:, :, self.current_channel]), np.amax(self.frame[:, :, self.current_channel]))
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.parent.parent.parent.parent.button_style_sheet_2)
1226
+ self.preview_button.setStyleSheet(self.button_style_sheet_2)
1225
1227
  self.apply_changes=QPushButton("Apply")
1226
- self.apply_changes.setStyleSheet(self.parent.parent.parent.parent.button_style_sheet)
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.parent.threshold_value.setText(self.threshold_value.text())
1295
- self.parent.diameter_value.setText(self.diameter_value.text())
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