celldetective 1.5.0b1__py3-none-any.whl → 1.5.0b3__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/_version.py +1 -1
- celldetective/gui/InitWindow.py +51 -12
- celldetective/gui/base/components.py +22 -1
- celldetective/gui/base_annotator.py +20 -9
- celldetective/gui/control_panel.py +21 -16
- celldetective/gui/event_annotator.py +51 -1060
- celldetective/gui/gui_utils.py +14 -5
- celldetective/gui/interactions_block.py +55 -25
- celldetective/gui/interactive_timeseries_viewer.py +11 -1
- celldetective/gui/measure_annotator.py +1064 -0
- celldetective/gui/plot_measurements.py +2 -4
- celldetective/gui/plot_signals_ui.py +3 -4
- celldetective/gui/process_block.py +298 -72
- celldetective/gui/viewers/base_viewer.py +134 -3
- celldetective/gui/viewers/contour_viewer.py +4 -4
- celldetective/gui/workers.py +25 -10
- celldetective/measure.py +3 -0
- celldetective/napari/utils.py +29 -19
- celldetective/processes/load_table.py +55 -0
- celldetective/processes/measure_cells.py +107 -81
- celldetective/processes/track_cells.py +39 -39
- celldetective/segmentation.py +1 -1
- celldetective/tracking.py +9 -0
- celldetective/utils/data_loaders.py +21 -1
- celldetective/utils/image_loaders.py +3 -0
- celldetective/utils/masks.py +1 -1
- celldetective/utils/maths.py +14 -1
- {celldetective-1.5.0b1.dist-info → celldetective-1.5.0b3.dist-info}/METADATA +1 -1
- {celldetective-1.5.0b1.dist-info → celldetective-1.5.0b3.dist-info}/RECORD +35 -32
- tests/gui/test_enhancements.py +351 -0
- tests/test_notebooks.py +2 -1
- {celldetective-1.5.0b1.dist-info → celldetective-1.5.0b3.dist-info}/WHEEL +0 -0
- {celldetective-1.5.0b1.dist-info → celldetective-1.5.0b3.dist-info}/entry_points.txt +0 -0
- {celldetective-1.5.0b1.dist-info → celldetective-1.5.0b3.dist-info}/licenses/LICENSE +0 -0
- {celldetective-1.5.0b1.dist-info → celldetective-1.5.0b3.dist-info}/top_level.txt +0 -0
celldetective/gui/gui_utils.py
CHANGED
|
@@ -822,10 +822,15 @@ def color_from_state(state, recently_modified=False):
|
|
|
822
822
|
color_map = {}
|
|
823
823
|
for value in unique_values:
|
|
824
824
|
|
|
825
|
-
|
|
826
|
-
value
|
|
827
|
-
|
|
828
|
-
|
|
825
|
+
try:
|
|
826
|
+
if np.isnan(value):
|
|
827
|
+
value = "nan"
|
|
828
|
+
color_map[value] = "k"
|
|
829
|
+
continue
|
|
830
|
+
except TypeError:
|
|
831
|
+
pass
|
|
832
|
+
|
|
833
|
+
if value == 0:
|
|
829
834
|
color_map[value] = "tab:blue"
|
|
830
835
|
elif value == 1:
|
|
831
836
|
color_map[value] = "tab:red"
|
|
@@ -834,7 +839,11 @@ def color_from_state(state, recently_modified=False):
|
|
|
834
839
|
else:
|
|
835
840
|
import matplotlib.pyplot as plt
|
|
836
841
|
|
|
837
|
-
|
|
842
|
+
if isinstance(value, (int, float, np.number)):
|
|
843
|
+
idx = value
|
|
844
|
+
else:
|
|
845
|
+
idx = hash(str(value)) % 20
|
|
846
|
+
color_map[value] = plt.cm.tab20(idx / 20.0)
|
|
838
847
|
|
|
839
848
|
return color_map
|
|
840
849
|
|
|
@@ -23,7 +23,8 @@ from superqt.fonticon import icon
|
|
|
23
23
|
|
|
24
24
|
import celldetective.gui.preprocessing_block
|
|
25
25
|
from celldetective import get_software_location
|
|
26
|
-
from celldetective.gui.base.components import QHSeperationLine
|
|
26
|
+
from celldetective.gui.base.components import QHSeperationLine, HoverButton
|
|
27
|
+
|
|
27
28
|
from celldetective.gui.base.styles import Styles
|
|
28
29
|
from celldetective.gui.base.utils import center_window
|
|
29
30
|
from celldetective.gui.gui_utils import help_generic
|
|
@@ -295,11 +296,12 @@ class NeighPanel(QFrame, Styles):
|
|
|
295
296
|
self.refresh_signal_models()
|
|
296
297
|
# self.to_disable.append(self.cell_models_list)
|
|
297
298
|
|
|
298
|
-
self.pair_train_signal_model_btn =
|
|
299
|
+
self.pair_train_signal_model_btn = HoverButton(
|
|
300
|
+
"TRAIN", MDI6.redo_variant, "black", "white"
|
|
301
|
+
)
|
|
299
302
|
self.pair_train_signal_model_btn.setToolTip(
|
|
300
303
|
"Train a cell pair event detection model."
|
|
301
304
|
)
|
|
302
|
-
self.pair_train_signal_model_btn.setIcon(icon(MDI6.redo_variant, color="black"))
|
|
303
305
|
self.pair_train_signal_model_btn.setIconSize(QSize(20, 20))
|
|
304
306
|
self.pair_train_signal_model_btn.setStyleSheet(self.button_style_sheet_3)
|
|
305
307
|
pair_model_zoo_layout.addWidget(self.pair_train_signal_model_btn, 5)
|
|
@@ -412,31 +414,59 @@ class NeighPanel(QFrame, Styles):
|
|
|
412
414
|
|
|
413
415
|
def view_table_ui(self):
|
|
414
416
|
from celldetective.gui.tableUI import TableUI
|
|
417
|
+
from celldetective.gui.workers import ProgressWindow
|
|
418
|
+
from celldetective.processes.load_table import TableLoaderProcess
|
|
415
419
|
|
|
416
420
|
logger.info("Load table...")
|
|
417
|
-
self.load_available_tables()
|
|
418
421
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
422
|
+
# Prepare args for the process
|
|
423
|
+
self.well_option = self.parent_window.well_list.getSelectedIndices()
|
|
424
|
+
self.position_option = self.parent_window.position_list.getSelectedIndices()
|
|
425
|
+
|
|
426
|
+
process_args = {
|
|
427
|
+
"experiment": self.exp_dir,
|
|
428
|
+
"population": "pairs",
|
|
429
|
+
"well_option": self.well_option,
|
|
430
|
+
"position_option": self.position_option,
|
|
431
|
+
"show_frame_progress": False,
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
self.df = None
|
|
435
|
+
|
|
436
|
+
def on_table_loaded(df):
|
|
437
|
+
self.df = df
|
|
438
|
+
if self.df is not None:
|
|
439
|
+
plot_mode = "static"
|
|
440
|
+
self.tab_ui = TableUI(
|
|
441
|
+
self.df,
|
|
442
|
+
f"{self.parent_window.well_list.currentText()}; Position {self.parent_window.position_list.currentText()}",
|
|
443
|
+
population="pairs",
|
|
444
|
+
plot_mode=plot_mode,
|
|
445
|
+
save_inplace_option=True,
|
|
446
|
+
)
|
|
447
|
+
self.tab_ui.show()
|
|
448
|
+
center_window(self.tab_ui)
|
|
449
|
+
else:
|
|
450
|
+
logger.info("Table could not be loaded...")
|
|
451
|
+
msgBox = QMessageBox()
|
|
452
|
+
msgBox.setIcon(QMessageBox.Warning)
|
|
453
|
+
msgBox.setText("No table could be loaded...")
|
|
454
|
+
msgBox.setWindowTitle("Info")
|
|
455
|
+
msgBox.setStandardButtons(QMessageBox.Ok)
|
|
456
|
+
returnValue = msgBox.exec()
|
|
457
|
+
|
|
458
|
+
self.job = ProgressWindow(
|
|
459
|
+
TableLoaderProcess,
|
|
460
|
+
parent_window=self,
|
|
461
|
+
title="Loading tables...",
|
|
462
|
+
process_args=process_args,
|
|
463
|
+
position_info=False,
|
|
464
|
+
well_label="Wells loaded:",
|
|
465
|
+
pos_label="Positions loaded:",
|
|
466
|
+
)
|
|
467
|
+
self.job._ProgressWindow__runner.signals.result.connect(on_table_loaded)
|
|
468
|
+
|
|
469
|
+
result = self.job.exec_()
|
|
440
470
|
|
|
441
471
|
def activate_neigh_options(self):
|
|
442
472
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
from PyQt5.QtCore import Qt
|
|
3
|
-
from PyQt5.QtWidgets import
|
|
3
|
+
from PyQt5.QtWidgets import (
|
|
4
|
+
QComboBox,
|
|
5
|
+
QDialog,
|
|
6
|
+
QHBoxLayout,
|
|
7
|
+
QLabel,
|
|
8
|
+
QMessageBox,
|
|
9
|
+
QPushButton,
|
|
10
|
+
QVBoxLayout,
|
|
11
|
+
)
|
|
4
12
|
from matplotlib import pyplot as plt
|
|
5
13
|
from matplotlib.widgets import RectangleSelector
|
|
6
14
|
|
|
@@ -243,7 +251,9 @@ class InteractiveEventViewer(QDialog, Styles):
|
|
|
243
251
|
|
|
244
252
|
# Plot
|
|
245
253
|
self.fig = plt.figure(figsize=(8, 6))
|
|
254
|
+
self.fig.patch.set_alpha(0)
|
|
246
255
|
self.canvas = FigureCanvas(self.fig, interactive=True)
|
|
256
|
+
self.canvas.setStyleSheet("background-color:transparent;")
|
|
247
257
|
layout.addWidget(self.canvas)
|
|
248
258
|
|
|
249
259
|
# Tooltip/Info
|