celldetective 1.2.0__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.
- celldetective/__main__.py +12 -5
- celldetective/events.py +28 -2
- celldetective/gui/about.py +0 -1
- celldetective/gui/analyze_block.py +3 -18
- celldetective/gui/btrack_options.py +126 -21
- celldetective/gui/classifier_widget.py +68 -107
- celldetective/gui/configure_new_exp.py +37 -4
- celldetective/gui/control_panel.py +14 -30
- celldetective/gui/generic_signal_plot.py +793 -0
- celldetective/gui/gui_utils.py +401 -226
- celldetective/gui/json_readers.py +0 -2
- celldetective/gui/layouts.py +269 -25
- celldetective/gui/measurement_options.py +14 -23
- celldetective/gui/neighborhood_options.py +6 -16
- celldetective/gui/plot_measurements.py +10 -23
- celldetective/gui/plot_signals_ui.py +53 -687
- celldetective/gui/process_block.py +320 -186
- celldetective/gui/retrain_segmentation_model_options.py +30 -47
- celldetective/gui/retrain_signal_model_options.py +5 -14
- celldetective/gui/seg_model_loader.py +129 -113
- celldetective/gui/signal_annotator.py +93 -103
- celldetective/gui/signal_annotator2.py +9 -13
- celldetective/gui/styles.py +32 -0
- celldetective/gui/survival_ui.py +49 -712
- celldetective/gui/tableUI.py +4 -39
- celldetective/gui/thresholds_gui.py +38 -11
- celldetective/gui/viewers.py +6 -7
- celldetective/io.py +62 -84
- celldetective/measure.py +374 -15
- celldetective/models/segmentation_effectors/ricm-bimodal/config_input.json +130 -0
- celldetective/models/segmentation_effectors/ricm-bimodal/ricm-bimodal +0 -0
- celldetective/models/segmentation_effectors/ricm-bimodal/training_instructions.json +37 -0
- celldetective/neighborhood.py +3 -7
- celldetective/preprocessing.py +2 -4
- celldetective/relative_measurements.py +0 -3
- celldetective/scripts/analyze_signals.py +0 -1
- celldetective/scripts/measure_cells.py +1 -3
- celldetective/scripts/measure_relative.py +1 -2
- celldetective/scripts/segment_cells.py +16 -12
- celldetective/scripts/segment_cells_thresholds.py +17 -10
- celldetective/scripts/track_cells.py +18 -18
- celldetective/scripts/train_segmentation_model.py +1 -2
- celldetective/scripts/train_signal_model.py +0 -3
- celldetective/segmentation.py +1 -1
- celldetective/signals.py +20 -8
- celldetective/tracking.py +2 -1
- celldetective/utils.py +126 -18
- {celldetective-1.2.0.dist-info → celldetective-1.2.2.dist-info}/METADATA +19 -12
- celldetective-1.2.2.dist-info/RECORD +92 -0
- {celldetective-1.2.0.dist-info → celldetective-1.2.2.dist-info}/WHEEL +1 -1
- celldetective-1.2.0.dist-info/RECORD +0 -88
- {celldetective-1.2.0.dist-info → celldetective-1.2.2.dist-info}/LICENSE +0 -0
- {celldetective-1.2.0.dist-info → celldetective-1.2.2.dist-info}/entry_points.txt +0 -0
- {celldetective-1.2.0.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,
|
|
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(
|
|
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
|
-
|
|
251
|
-
self.
|
|
252
|
-
|
|
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 =
|
|
266
|
-
|
|
267
|
-
|
|
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
|
-
|
|
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
|
|