celldetective 1.2.1__py3-none-any.whl → 1.2.2__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 (51) hide show
  1. celldetective/__main__.py +12 -5
  2. celldetective/events.py +28 -2
  3. celldetective/gui/about.py +0 -1
  4. celldetective/gui/analyze_block.py +3 -18
  5. celldetective/gui/btrack_options.py +126 -21
  6. celldetective/gui/classifier_widget.py +67 -111
  7. celldetective/gui/configure_new_exp.py +37 -4
  8. celldetective/gui/control_panel.py +14 -30
  9. celldetective/gui/generic_signal_plot.py +793 -0
  10. celldetective/gui/gui_utils.py +401 -226
  11. celldetective/gui/json_readers.py +0 -2
  12. celldetective/gui/layouts.py +269 -25
  13. celldetective/gui/measurement_options.py +14 -23
  14. celldetective/gui/neighborhood_options.py +3 -15
  15. celldetective/gui/plot_measurements.py +10 -23
  16. celldetective/gui/plot_signals_ui.py +53 -687
  17. celldetective/gui/process_block.py +320 -186
  18. celldetective/gui/retrain_segmentation_model_options.py +30 -47
  19. celldetective/gui/retrain_signal_model_options.py +5 -14
  20. celldetective/gui/seg_model_loader.py +129 -113
  21. celldetective/gui/signal_annotator.py +89 -99
  22. celldetective/gui/signal_annotator2.py +5 -9
  23. celldetective/gui/styles.py +32 -0
  24. celldetective/gui/survival_ui.py +49 -712
  25. celldetective/gui/tableUI.py +0 -1
  26. celldetective/gui/thresholds_gui.py +38 -11
  27. celldetective/gui/viewers.py +6 -7
  28. celldetective/io.py +60 -82
  29. celldetective/measure.py +374 -15
  30. celldetective/neighborhood.py +1 -7
  31. celldetective/preprocessing.py +2 -4
  32. celldetective/relative_measurements.py +0 -3
  33. celldetective/scripts/analyze_signals.py +0 -1
  34. celldetective/scripts/measure_cells.py +1 -3
  35. celldetective/scripts/measure_relative.py +1 -2
  36. celldetective/scripts/segment_cells.py +16 -12
  37. celldetective/scripts/segment_cells_thresholds.py +17 -10
  38. celldetective/scripts/track_cells.py +18 -18
  39. celldetective/scripts/train_segmentation_model.py +1 -2
  40. celldetective/scripts/train_signal_model.py +0 -3
  41. celldetective/segmentation.py +1 -1
  42. celldetective/signals.py +17 -8
  43. celldetective/tracking.py +2 -1
  44. celldetective/utils.py +42 -2
  45. {celldetective-1.2.1.dist-info → celldetective-1.2.2.dist-info}/METADATA +19 -12
  46. celldetective-1.2.2.dist-info/RECORD +92 -0
  47. {celldetective-1.2.1.dist-info → celldetective-1.2.2.dist-info}/WHEEL +1 -1
  48. celldetective-1.2.1.dist-info/RECORD +0 -91
  49. {celldetective-1.2.1.dist-info → celldetective-1.2.2.dist-info}/LICENSE +0 -0
  50. {celldetective-1.2.1.dist-info → celldetective-1.2.2.dist-info}/entry_points.txt +0 -0
  51. {celldetective-1.2.1.dist-info → celldetective-1.2.2.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,16 @@
1
- from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox, QDialog, QHBoxLayout, QFileDialog, QVBoxLayout, QScrollArea, QCheckBox, QSlider, QGridLayout, QLabel, QLineEdit, QPushButton, QWidget
1
+ from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox, QHBoxLayout, QFileDialog, QVBoxLayout, QScrollArea, QCheckBox, QGridLayout, QLabel, QLineEdit, QPushButton, QWidget
2
2
  from PyQt5.QtGui import QIntValidator, QDoubleValidator
3
- from celldetective.gui.gui_utils import center_window
3
+ from celldetective.gui.gui_utils import center_window, help_generic
4
4
  from celldetective.gui.styles import Styles
5
+ from celldetective.utils import get_software_location
6
+ import json
7
+
5
8
  from superqt import QLabeledSlider
6
9
  from PyQt5.QtCore import Qt, QSize
7
10
  from superqt.fonticon import icon
8
11
  from fonticon_mdi6 import MDI6
9
12
  from configparser import ConfigParser
10
13
  import os
11
- from shutil import copyfile
12
- import time
13
14
  from functools import partial
14
15
  import numpy as np
15
16
  from celldetective.gui import Styles
@@ -119,6 +120,15 @@ class ConfigNewExperiment(QMainWindow, Styles):
119
120
  self.number_of_wells = QLabel("Number of wells:")
120
121
  self.ms_grid.addWidget(self.number_of_wells, 1, 0, 1, 3)
121
122
 
123
+ self.help_btn = QPushButton()
124
+ self.help_btn.setIcon(icon(MDI6.help_circle,color=self.help_color))
125
+ self.help_btn.setIconSize(QSize(20, 20))
126
+ self.help_btn.clicked.connect(self.help_structure)
127
+ self.help_btn.setStyleSheet(self.button_select_all)
128
+ self.help_btn.setToolTip("Help.")
129
+ self.ms_grid.addWidget(self.help_btn, 1, 0, 1, 3, alignment=Qt.AlignRight)
130
+
131
+
122
132
  self.SliderWells = QLabeledSlider(Qt.Horizontal, self)
123
133
  self.SliderWells.setMinimum(1)
124
134
  self.SliderWells.setMaximum(32)
@@ -189,6 +199,29 @@ class ConfigNewExperiment(QMainWindow, Styles):
189
199
  self.shape_y_field.setText("2048")
190
200
  self.ms_grid.addWidget(self.shape_y_field, 16, 0, 1, 3)
191
201
 
202
+ def help_structure(self):
203
+
204
+ """
205
+ Helper to choose an experiment structure.
206
+ """
207
+
208
+ dict_path = os.sep.join([get_software_location(),'celldetective','gui','help','exp-structure.json'])
209
+
210
+ with open(dict_path) as f:
211
+ d = json.load(f)
212
+
213
+ suggestion = help_generic(d)
214
+ if isinstance(suggestion, str):
215
+ print(f"{suggestion=}")
216
+ msgBox = QMessageBox()
217
+ msgBox.setIcon(QMessageBox.Information)
218
+ msgBox.setTextFormat(Qt.RichText)
219
+ msgBox.setText(suggestion+"\nSee <a href='https://celldetective.readthedocs.io/en/latest/get-started.html#data-organization'>the docs</a> for more information.")
220
+ msgBox.setWindowTitle("Info")
221
+ msgBox.setStandardButtons(QMessageBox.Ok)
222
+ returnValue = msgBox.exec()
223
+ if returnValue == QMessageBox.Ok:
224
+ return None
192
225
 
193
226
  def generate_channel_params_box(self):
194
227
 
@@ -1,10 +1,10 @@
1
1
  from PyQt5.QtWidgets import QMainWindow, QComboBox, QPushButton, QHBoxLayout, QLabel, QWidget, QGridLayout, QFrame, \
2
2
  QTabWidget, QVBoxLayout, QMessageBox, QScrollArea, QDesktopWidget
3
3
  from PyQt5.QtCore import Qt, QSize
4
- from PyQt5.QtGui import QIcon
5
4
  from celldetective.gui.gui_utils import center_window, QHSeperationLine
6
5
  from celldetective.utils import _extract_labels_from_config, ConfigSectionMap, extract_experiment_channels, extract_identity_col
7
6
  from celldetective.gui import ConfigEditor, ProcessPanel, PreprocessingPanel, AnalysisPanel, NeighPanel
7
+ from celldetective.io import get_experiment_wells, get_config, get_spatial_calibration, get_temporal_calibration, get_experiment_concentrations, get_experiment_cell_types, get_experiment_antibodies, get_experiment_pharmaceutical_agents
8
8
  from natsort import natsorted
9
9
  from glob import glob
10
10
  import os
@@ -28,7 +28,7 @@ class ControlPanel(QMainWindow, Styles):
28
28
  if not self.exp_dir.endswith(os.sep):
29
29
  self.exp_dir = self.exp_dir+os.sep
30
30
  self.setWindowTitle("celldetective")
31
- self.setWindowIcon(QIcon(os.sep.join(['celldetective','icons','logo.png'])))
31
+ self.setWindowIcon(self.celldetective_icon)
32
32
  self.parent_window = parent_window
33
33
  center_window(self)
34
34
 
@@ -98,7 +98,7 @@ class ControlPanel(QMainWindow, Styles):
98
98
  Detect the wells in the experiment folder and the associated positions.
99
99
  """
100
100
 
101
- self.wells = natsorted(glob(self.exp_dir + "W*" + os.sep))
101
+ self.wells = get_experiment_wells(self.exp_dir) #natsorted(glob(self.exp_dir + "W*" + os.sep))
102
102
  self.positions = []
103
103
  for w in self.wells:
104
104
  w = os.path.split(w[:-1])
@@ -247,9 +247,12 @@ class ControlPanel(QMainWindow, Styles):
247
247
  This methods load the configuration read in the config.ini file of the experiment.
248
248
  '''
249
249
 
250
- self.exp_config = self.exp_dir + "config.ini"
251
- self.PxToUm = float(ConfigSectionMap(self.exp_config,"MovieSettings")["pxtoum"])
252
- self.FrameToMin = float(ConfigSectionMap(self.exp_config,"MovieSettings")["frametomin"])
250
+ print('Reading experiment configuration...')
251
+ self.exp_config = get_config(self.exp_dir)
252
+
253
+ self.PxToUm = get_spatial_calibration(self.exp_dir)
254
+ self.FrameToMin = get_temporal_calibration(self.exp_dir)
255
+
253
256
  self.len_movie = int(ConfigSectionMap(self.exp_config,"MovieSettings")["len_movie"])
254
257
  self.shape_x = int(ConfigSectionMap(self.exp_config,"MovieSettings")["shape_x"])
255
258
  self.shape_y = int(ConfigSectionMap(self.exp_config,"MovieSettings")["shape_y"])
@@ -262,31 +265,12 @@ class ControlPanel(QMainWindow, Styles):
262
265
  number_of_wells = len(self.wells)
263
266
  self.well_labels = _extract_labels_from_config(self.exp_config,number_of_wells)
264
267
 
265
- self.concentrations = ConfigSectionMap(self.exp_config,"Labels")["concentrations"].split(",")
266
- if number_of_wells != len(self.concentrations):
267
- self.concentrations = [str(s) for s in np.linspace(0,number_of_wells-1,number_of_wells)]
268
-
269
- #self.antibodies = extract_labels_from_config(config, number_of_wells)
268
+ self.concentrations = get_experiment_concentrations(self.exp_dir)
269
+ self.cell_types = get_experiment_cell_types(self.exp_dir)
270
+ self.antibodies = get_experiment_antibodies(self.exp_dir)
271
+ self.pharmaceutical_agents = get_experiment_pharmaceutical_agents(self.exp_dir)
270
272
 
271
- self.cell_types = ConfigSectionMap(self.exp_config,"Labels")["cell_types"].split(",")
272
- if number_of_wells != len(self.cell_types):
273
- self.cell_types = [str(s) for s in np.linspace(0,number_of_wells-1,number_of_wells)]
274
-
275
- try:
276
- self.antibodies = ConfigSectionMap(self.exp_config,"Labels")["antibodies"].split(",")
277
- if number_of_wells != len(self.antibodies):
278
- self.antibodies = [str(s) for s in np.linspace(0,number_of_wells-1,number_of_wells)]
279
- except:
280
- print("Warning... antibodies not found...")
281
- self.antibodies = [str(s) for s in np.linspace(0,number_of_wells-1,number_of_wells)]
282
-
283
- try:
284
- self.pharmaceutical_agents = ConfigSectionMap(self.exp_config,"Labels")["pharmaceutical_agents"].split(",")
285
- if number_of_wells != len(self.pharmaceutical_agents):
286
- self.pharmaceutical_agents = [str(s) for s in np.linspace(0,number_of_wells-1,number_of_wells)]
287
- except:
288
- print("Warning... pharmaceutical agents not found...")
289
- self.pharmaceutical_agents = [str(s) for s in np.linspace(0,number_of_wells-1,number_of_wells)]
273
+ print('Experiment configuration successfully read...')
290
274
 
291
275
  def closeEvent(self, event):
292
276