celldetective 1.0.2.post1__py3-none-any.whl → 1.1.1__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 (63) hide show
  1. celldetective/__main__.py +7 -21
  2. celldetective/events.py +2 -44
  3. celldetective/extra_properties.py +62 -52
  4. celldetective/filters.py +4 -5
  5. celldetective/gui/__init__.py +1 -1
  6. celldetective/gui/analyze_block.py +37 -10
  7. celldetective/gui/btrack_options.py +24 -23
  8. celldetective/gui/classifier_widget.py +62 -19
  9. celldetective/gui/configure_new_exp.py +32 -35
  10. celldetective/gui/control_panel.py +120 -81
  11. celldetective/gui/gui_utils.py +674 -396
  12. celldetective/gui/json_readers.py +7 -6
  13. celldetective/gui/layouts.py +756 -0
  14. celldetective/gui/measurement_options.py +98 -513
  15. celldetective/gui/neighborhood_options.py +322 -270
  16. celldetective/gui/plot_measurements.py +1114 -0
  17. celldetective/gui/plot_signals_ui.py +21 -20
  18. celldetective/gui/process_block.py +449 -169
  19. celldetective/gui/retrain_segmentation_model_options.py +27 -26
  20. celldetective/gui/retrain_signal_model_options.py +25 -24
  21. celldetective/gui/seg_model_loader.py +31 -27
  22. celldetective/gui/signal_annotator.py +2326 -2295
  23. celldetective/gui/signal_annotator_options.py +18 -16
  24. celldetective/gui/styles.py +16 -1
  25. celldetective/gui/survival_ui.py +67 -39
  26. celldetective/gui/tableUI.py +337 -48
  27. celldetective/gui/thresholds_gui.py +75 -71
  28. celldetective/gui/viewers.py +743 -0
  29. celldetective/io.py +247 -27
  30. celldetective/measure.py +43 -263
  31. celldetective/models/segmentation_effectors/primNK_cfse/config_input.json +29 -0
  32. celldetective/models/segmentation_effectors/primNK_cfse/cp-cfse-transfer +0 -0
  33. celldetective/models/segmentation_effectors/primNK_cfse/training_instructions.json +37 -0
  34. celldetective/neighborhood.py +498 -27
  35. celldetective/preprocessing.py +1023 -0
  36. celldetective/scripts/analyze_signals.py +7 -0
  37. celldetective/scripts/measure_cells.py +12 -0
  38. celldetective/scripts/segment_cells.py +20 -4
  39. celldetective/scripts/track_cells.py +11 -0
  40. celldetective/scripts/train_segmentation_model.py +35 -34
  41. celldetective/segmentation.py +14 -9
  42. celldetective/signals.py +234 -329
  43. celldetective/tracking.py +2 -2
  44. celldetective/utils.py +602 -49
  45. celldetective-1.1.1.dist-info/METADATA +305 -0
  46. celldetective-1.1.1.dist-info/RECORD +84 -0
  47. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.1.dist-info}/top_level.txt +1 -0
  48. tests/__init__.py +0 -0
  49. tests/test_events.py +28 -0
  50. tests/test_filters.py +24 -0
  51. tests/test_io.py +70 -0
  52. tests/test_measure.py +141 -0
  53. tests/test_neighborhood.py +70 -0
  54. tests/test_preprocessing.py +37 -0
  55. tests/test_segmentation.py +93 -0
  56. tests/test_signals.py +135 -0
  57. tests/test_tracking.py +164 -0
  58. tests/test_utils.py +118 -0
  59. celldetective-1.0.2.post1.dist-info/METADATA +0 -221
  60. celldetective-1.0.2.post1.dist-info/RECORD +0 -66
  61. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.1.dist-info}/LICENSE +0 -0
  62. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.1.dist-info}/WHEEL +0 -0
  63. {celldetective-1.0.2.post1.dist-info → celldetective-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -31,28 +31,30 @@ from tqdm import tqdm
31
31
  from lifelines import KaplanMeierFitter
32
32
  from matplotlib.cm import viridis, tab10
33
33
  import math
34
+ from celldetective.gui import Styles
35
+ from matplotlib import colormaps
34
36
 
35
37
 
36
38
 
37
- class ConfigSignalPlot(QWidget):
39
+ class ConfigSignalPlot(QWidget, Styles):
38
40
 
39
41
  """
40
42
  UI to set survival instructions.
41
43
 
42
44
  """
43
45
 
44
- def __init__(self, parent=None):
46
+ def __init__(self, parent_window=None):
45
47
 
46
48
  super().__init__()
47
- self.parent = parent
49
+ self.parent_window = parent_window
48
50
  self.setWindowTitle("Configure signal plot")
49
51
  self.setWindowIcon(QIcon(os.sep.join(['celldetective','icons','mexican-hat.png'])))
50
- self.exp_dir = self.parent.exp_dir
52
+ self.exp_dir = self.parent_window.exp_dir
51
53
  self.soft_path = get_software_location()
52
54
  self.exp_config = self.exp_dir +"config.ini"
53
- self.wells = np.array(self.parent.parent.wells,dtype=str)
55
+ self.wells = np.array(self.parent_window.parent_window.wells,dtype=str)
54
56
  self.well_labels = _extract_labels_from_config(self.exp_config,len(self.wells))
55
- self.FrameToMin = self.parent.parent.FrameToMin
57
+ self.FrameToMin = self.parent_window.parent_window.FrameToMin
56
58
  self.float_validator = QDoubleValidator()
57
59
  self.target_class = [0,1]
58
60
  self.show_ci = True
@@ -64,13 +66,13 @@ class ConfigSignalPlot(QWidget):
64
66
  print('Parent wells: ', self.wells)
65
67
 
66
68
 
67
- self.well_option = self.parent.parent.well_list.currentIndex()
68
- self.position_option = self.parent.parent.position_list.currentIndex()
69
+ self.well_option = self.parent_window.parent_window.well_list.currentIndex()
70
+ self.position_option = self.parent_window.parent_window.position_list.currentIndex()
69
71
  self.interpret_pos_location()
70
72
  #self.load_available_tables()
71
73
  #self.config_path = self.exp_dir + self.config_name
72
74
 
73
- self.screen_height = self.parent.parent.parent.screen_height
75
+ self.screen_height = self.parent_window.parent_window.parent_window.screen_height
74
76
  center_window(self)
75
77
  #self.setMinimumHeight(int(0.8*self.screen_height))
76
78
  #self.setMaximumHeight(int(0.8*self.screen_height))
@@ -97,7 +99,6 @@ class ConfigSignalPlot(QWidget):
97
99
  else:
98
100
  self.position_indices = np.array([self.position_option],dtype=int)
99
101
 
100
-
101
102
  def populate_widget(self):
102
103
 
103
104
  """
@@ -117,7 +118,7 @@ class ConfigSignalPlot(QWidget):
117
118
  main_layout.addWidget(panel_title, alignment=Qt.AlignCenter)
118
119
 
119
120
  labels = [QLabel('population: '), QLabel('class: '), QLabel('time of\ninterest: ')]
120
- self.cb_options = [['targets','effectors'],['class'], ['t0','first detection']]
121
+ self.cb_options = [['targets','effectors'],['class'], ['t0']]
121
122
  self.cbs = [QComboBox() for i in range(len(labels))]
122
123
  self.cbs[0].currentIndexChanged.connect(self.set_classes_and_times)
123
124
 
@@ -138,7 +139,7 @@ class ConfigSignalPlot(QWidget):
138
139
  self.frame_slider = QLabeledSlider()
139
140
  self.frame_slider.setSingleStep(1)
140
141
  self.frame_slider.setOrientation(1)
141
- self.frame_slider.setRange(0,self.parent.parent.len_movie)
142
+ self.frame_slider.setRange(0,self.parent_window.parent_window.len_movie)
142
143
  self.frame_slider.setValue(0)
143
144
  self.frame_slider.setEnabled(False)
144
145
  slider_hbox = QHBoxLayout()
@@ -160,7 +161,7 @@ class ConfigSignalPlot(QWidget):
160
161
  main_layout.addLayout(time_calib_layout)
161
162
 
162
163
  self.submit_btn = QPushButton('Submit')
163
- self.submit_btn.setStyleSheet(self.parent.parent.parent.button_style_sheet)
164
+ self.submit_btn.setStyleSheet(self.button_style_sheet)
164
165
  self.submit_btn.clicked.connect(self.process_signal)
165
166
  main_layout.addWidget(self.submit_btn)
166
167
 
@@ -173,7 +174,7 @@ class ConfigSignalPlot(QWidget):
173
174
  def set_classes_and_times(self):
174
175
 
175
176
  # Look for all classes and times
176
- tables = glob(self.exp_dir+os.sep.join(['W*','*','output','tables',f'trajectories_*']))
177
+ tables = natsorted(glob(self.exp_dir+os.sep.join(['W*','*','output','tables',f'trajectories_*.csv'])))
177
178
  self.all_columns = []
178
179
  for tab in tables:
179
180
  cols = pd.read_csv(tab, nrows=1).columns.tolist()
@@ -295,7 +296,7 @@ class ConfigSignalPlot(QWidget):
295
296
 
296
297
  self.legend_btn = QPushButton('')
297
298
  self.legend_btn.setIcon(icon(MDI6.text_box,color="black"))
298
- self.legend_btn.setStyleSheet(self.parent.parent.parent.button_select_all)
299
+ self.legend_btn.setStyleSheet(self.button_select_all)
299
300
  self.legend_btn.setToolTip('Show or hide the legend')
300
301
  self.legend_visible = True
301
302
  self.legend_btn.clicked.connect(self.show_hide_legend)
@@ -304,7 +305,7 @@ class ConfigSignalPlot(QWidget):
304
305
 
305
306
  self.log_btn = QPushButton('')
306
307
  self.log_btn.setIcon(icon(MDI6.math_log,color="black"))
307
- self.log_btn.setStyleSheet(self.parent.parent.parent.button_select_all)
308
+ self.log_btn.setStyleSheet(self.button_select_all)
308
309
  self.log_btn.clicked.connect(self.switch_to_log)
309
310
  self.log_btn.setToolTip('Enable or disable log scale')
310
311
  plot_buttons_hbox.addWidget(self.log_btn, 5, alignment=Qt.AlignRight)
@@ -312,14 +313,14 @@ class ConfigSignalPlot(QWidget):
312
313
 
313
314
  self.ci_btn = QPushButton('')
314
315
  self.ci_btn.setIcon(icon(MDI6.arrow_expand_horizontal,color="blue"))
315
- self.ci_btn.setStyleSheet(self.parent.parent.parent.button_select_all)
316
+ self.ci_btn.setStyleSheet(self.button_select_all)
316
317
  self.ci_btn.clicked.connect(self.switch_ci)
317
318
  self.ci_btn.setToolTip('Show or hide confidence intervals.')
318
319
  plot_buttons_hbox.addWidget(self.ci_btn, 5, alignment=Qt.AlignRight)
319
320
 
320
321
  self.cell_lines_btn = QPushButton('')
321
322
  self.cell_lines_btn.setIcon(icon(MDI6.view_headline,color="black"))
322
- self.cell_lines_btn.setStyleSheet(self.parent.parent.parent.button_select_all)
323
+ self.cell_lines_btn.setStyleSheet(self.button_select_all)
323
324
  self.cell_lines_btn.clicked.connect(self.switch_cell_lines)
324
325
  self.cell_lines_btn.setToolTip('Show or hide individual cell signals.')
325
326
  plot_buttons_hbox.addWidget(self.cell_lines_btn, 5, alignment=Qt.AlignRight)
@@ -513,12 +514,12 @@ class ConfigSignalPlot(QWidget):
513
514
 
514
515
  """
515
516
 
516
- self.well_option = self.parent.parent.well_list.currentIndex()
517
+ self.well_option = self.parent_window.parent_window.well_list.currentIndex()
517
518
  if self.well_option==len(self.wells):
518
519
  wo = '*'
519
520
  else:
520
521
  wo = self.well_option
521
- self.position_option = self.parent.parent.position_list.currentIndex()
522
+ self.position_option = self.parent_window.parent_window.position_list.currentIndex()
522
523
  if self.position_option==0:
523
524
  po = '*'
524
525
  else: