celldetective 1.4.2__py3-none-any.whl → 1.5.0b0__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 (151) hide show
  1. celldetective/__init__.py +25 -0
  2. celldetective/__main__.py +62 -43
  3. celldetective/_version.py +1 -1
  4. celldetective/extra_properties.py +477 -399
  5. celldetective/filters.py +192 -97
  6. celldetective/gui/InitWindow.py +541 -411
  7. celldetective/gui/__init__.py +0 -15
  8. celldetective/gui/about.py +44 -39
  9. celldetective/gui/analyze_block.py +120 -84
  10. celldetective/gui/base/__init__.py +0 -0
  11. celldetective/gui/base/channel_norm_generator.py +335 -0
  12. celldetective/gui/base/components.py +249 -0
  13. celldetective/gui/base/feature_choice.py +92 -0
  14. celldetective/gui/base/figure_canvas.py +52 -0
  15. celldetective/gui/base/list_widget.py +133 -0
  16. celldetective/gui/{styles.py → base/styles.py} +92 -36
  17. celldetective/gui/base/utils.py +33 -0
  18. celldetective/gui/base_annotator.py +900 -767
  19. celldetective/gui/classifier_widget.py +6 -22
  20. celldetective/gui/configure_new_exp.py +777 -671
  21. celldetective/gui/control_panel.py +635 -524
  22. celldetective/gui/dynamic_progress.py +449 -0
  23. celldetective/gui/event_annotator.py +2023 -1662
  24. celldetective/gui/generic_signal_plot.py +1292 -944
  25. celldetective/gui/gui_utils.py +899 -1289
  26. celldetective/gui/interactions_block.py +658 -0
  27. celldetective/gui/interactive_timeseries_viewer.py +447 -0
  28. celldetective/gui/json_readers.py +48 -15
  29. celldetective/gui/layouts/__init__.py +5 -0
  30. celldetective/gui/layouts/background_model_free_layout.py +537 -0
  31. celldetective/gui/layouts/channel_offset_layout.py +134 -0
  32. celldetective/gui/layouts/local_correction_layout.py +91 -0
  33. celldetective/gui/layouts/model_fit_layout.py +372 -0
  34. celldetective/gui/layouts/operation_layout.py +68 -0
  35. celldetective/gui/layouts/protocol_designer_layout.py +96 -0
  36. celldetective/gui/pair_event_annotator.py +3130 -2435
  37. celldetective/gui/plot_measurements.py +586 -267
  38. celldetective/gui/plot_signals_ui.py +724 -506
  39. celldetective/gui/preprocessing_block.py +395 -0
  40. celldetective/gui/process_block.py +1678 -1831
  41. celldetective/gui/seg_model_loader.py +580 -473
  42. celldetective/gui/settings/__init__.py +0 -7
  43. celldetective/gui/settings/_cellpose_model_params.py +181 -0
  44. celldetective/gui/settings/_event_detection_model_params.py +95 -0
  45. celldetective/gui/settings/_segmentation_model_params.py +159 -0
  46. celldetective/gui/settings/_settings_base.py +77 -65
  47. celldetective/gui/settings/_settings_event_model_training.py +752 -526
  48. celldetective/gui/settings/_settings_measurements.py +1133 -964
  49. celldetective/gui/settings/_settings_neighborhood.py +574 -488
  50. celldetective/gui/settings/_settings_segmentation_model_training.py +779 -564
  51. celldetective/gui/settings/_settings_signal_annotator.py +329 -305
  52. celldetective/gui/settings/_settings_tracking.py +1304 -1094
  53. celldetective/gui/settings/_stardist_model_params.py +98 -0
  54. celldetective/gui/survival_ui.py +422 -312
  55. celldetective/gui/tableUI.py +1665 -1701
  56. celldetective/gui/table_ops/_maths.py +295 -0
  57. celldetective/gui/table_ops/_merge_groups.py +140 -0
  58. celldetective/gui/table_ops/_merge_one_hot.py +95 -0
  59. celldetective/gui/table_ops/_query_table.py +43 -0
  60. celldetective/gui/table_ops/_rename_col.py +44 -0
  61. celldetective/gui/thresholds_gui.py +382 -179
  62. celldetective/gui/viewers/__init__.py +0 -0
  63. celldetective/gui/viewers/base_viewer.py +700 -0
  64. celldetective/gui/viewers/channel_offset_viewer.py +331 -0
  65. celldetective/gui/viewers/contour_viewer.py +394 -0
  66. celldetective/gui/viewers/size_viewer.py +153 -0
  67. celldetective/gui/viewers/spot_detection_viewer.py +341 -0
  68. celldetective/gui/viewers/threshold_viewer.py +309 -0
  69. celldetective/gui/workers.py +304 -126
  70. celldetective/log_manager.py +92 -0
  71. celldetective/measure.py +1895 -1478
  72. celldetective/napari/__init__.py +0 -0
  73. celldetective/napari/utils.py +1025 -0
  74. celldetective/neighborhood.py +1914 -1448
  75. celldetective/preprocessing.py +1620 -1220
  76. celldetective/processes/__init__.py +0 -0
  77. celldetective/processes/background_correction.py +271 -0
  78. celldetective/processes/compute_neighborhood.py +894 -0
  79. celldetective/processes/detect_events.py +246 -0
  80. celldetective/processes/measure_cells.py +565 -0
  81. celldetective/processes/segment_cells.py +760 -0
  82. celldetective/processes/track_cells.py +435 -0
  83. celldetective/processes/train_segmentation_model.py +694 -0
  84. celldetective/processes/train_signal_model.py +265 -0
  85. celldetective/processes/unified_process.py +292 -0
  86. celldetective/regionprops/_regionprops.py +358 -317
  87. celldetective/relative_measurements.py +987 -710
  88. celldetective/scripts/measure_cells.py +313 -212
  89. celldetective/scripts/measure_relative.py +90 -46
  90. celldetective/scripts/segment_cells.py +165 -104
  91. celldetective/scripts/segment_cells_thresholds.py +96 -68
  92. celldetective/scripts/track_cells.py +198 -149
  93. celldetective/scripts/train_segmentation_model.py +324 -201
  94. celldetective/scripts/train_signal_model.py +87 -45
  95. celldetective/segmentation.py +844 -749
  96. celldetective/signals.py +3514 -2861
  97. celldetective/tracking.py +30 -15
  98. celldetective/utils/__init__.py +0 -0
  99. celldetective/utils/cellpose_utils/__init__.py +133 -0
  100. celldetective/utils/color_mappings.py +42 -0
  101. celldetective/utils/data_cleaning.py +630 -0
  102. celldetective/utils/data_loaders.py +450 -0
  103. celldetective/utils/dataset_helpers.py +207 -0
  104. celldetective/utils/downloaders.py +197 -0
  105. celldetective/utils/event_detection/__init__.py +8 -0
  106. celldetective/utils/experiment.py +1782 -0
  107. celldetective/utils/image_augmenters.py +308 -0
  108. celldetective/utils/image_cleaning.py +74 -0
  109. celldetective/utils/image_loaders.py +926 -0
  110. celldetective/utils/image_transforms.py +335 -0
  111. celldetective/utils/io.py +62 -0
  112. celldetective/utils/mask_cleaning.py +348 -0
  113. celldetective/utils/mask_transforms.py +5 -0
  114. celldetective/utils/masks.py +184 -0
  115. celldetective/utils/maths.py +351 -0
  116. celldetective/utils/model_getters.py +325 -0
  117. celldetective/utils/model_loaders.py +296 -0
  118. celldetective/utils/normalization.py +380 -0
  119. celldetective/utils/parsing.py +465 -0
  120. celldetective/utils/plots/__init__.py +0 -0
  121. celldetective/utils/plots/regression.py +53 -0
  122. celldetective/utils/resources.py +34 -0
  123. celldetective/utils/stardist_utils/__init__.py +104 -0
  124. celldetective/utils/stats.py +90 -0
  125. celldetective/utils/types.py +21 -0
  126. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/METADATA +1 -1
  127. celldetective-1.5.0b0.dist-info/RECORD +187 -0
  128. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/WHEEL +1 -1
  129. tests/gui/test_new_project.py +129 -117
  130. tests/gui/test_project.py +127 -79
  131. tests/test_filters.py +39 -15
  132. tests/test_notebooks.py +8 -0
  133. tests/test_tracking.py +232 -13
  134. tests/test_utils.py +123 -77
  135. celldetective/gui/base_components.py +0 -23
  136. celldetective/gui/layouts.py +0 -1602
  137. celldetective/gui/processes/compute_neighborhood.py +0 -594
  138. celldetective/gui/processes/measure_cells.py +0 -360
  139. celldetective/gui/processes/segment_cells.py +0 -499
  140. celldetective/gui/processes/track_cells.py +0 -303
  141. celldetective/gui/processes/train_segmentation_model.py +0 -270
  142. celldetective/gui/processes/train_signal_model.py +0 -108
  143. celldetective/gui/table_ops/merge_groups.py +0 -118
  144. celldetective/gui/viewers.py +0 -1354
  145. celldetective/io.py +0 -3663
  146. celldetective/utils.py +0 -3108
  147. celldetective-1.4.2.dist-info/RECORD +0 -123
  148. /celldetective/{gui/processes → processes}/downloader.py +0 -0
  149. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/entry_points.txt +0 -0
  150. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/licenses/LICENSE +0 -0
  151. {celldetective-1.4.2.dist-info → celldetective-1.5.0b0.dist-info}/top_level.txt +0 -0
@@ -1,118 +0,0 @@
1
- from typing import List
2
-
3
- import numpy as np
4
- from PyQt5.QtCore import QSize, Qt
5
- from PyQt5.QtWidgets import QComboBox, QHBoxLayout, QLabel, QLineEdit, QPushButton, QVBoxLayout
6
- from fonticon_mdi6 import MDI6
7
- from superqt.fonticon import icon
8
-
9
- from celldetective.gui import CelldetectiveWidget
10
- from celldetective.gui.gui_utils import PandasModel, center_window
11
-
12
-
13
- class MergeGroupWidget(CelldetectiveWidget):
14
- def __init__(self, parent_window, columns: List[str] = [], n_cols_init: int = 3):
15
-
16
- super().__init__()
17
- self.parent_window = parent_window
18
-
19
- self.setWindowTitle("Merge classifications")
20
- self.group_cols = [c for c in list(self.parent_window.data.columns) if c.startswith("group_") or c.startswith("status_")]
21
- self.group_cols.insert(0, "--")
22
- if len(columns) > n_cols_init:
23
- n_cols_init = len(columns)
24
-
25
- center_window(self)
26
-
27
- layout = QVBoxLayout(self)
28
- layout.setContentsMargins(30, 10, 30, 30)
29
-
30
- label = QLabel(
31
- "Merge several binary or multi-label classification features into a multi-label classification feature where each state is one of the possible combinations.\n")
32
-
33
- label.setWordWrap(True) # enables automatic line breaking
34
- label.setTextInteractionFlags(Qt.TextSelectableByMouse) # optional, to allow copy
35
- label.setStyleSheet("color: gray;") # optional style
36
-
37
- layout.addWidget(label)
38
-
39
-
40
- self.name_le = QLineEdit("group_multilabel")
41
- name_layout = QHBoxLayout()
42
- name_layout.addWidget(QLabel("name: "), 25)
43
- name_layout.addWidget(self.name_le, 75)
44
- layout.addLayout(name_layout)
45
-
46
- self.cbs_layout = QVBoxLayout()
47
- self.cbs_layout.setContentsMargins(0,10,0,0)
48
-
49
- self.cbs = []
50
- for i in range(n_cols_init):
51
- cb_i = QComboBox()
52
- cb_i.addItems(self.group_cols)
53
- if i < len(columns):
54
- selection = columns[i]
55
- idx = cb_i.findText(selection)
56
- if idx>=0:
57
- cb_i.setCurrentIndex(idx)
58
- else:
59
- cb_i.setCurrentIndex(0)
60
- self.cbs.append(cb_i)
61
-
62
- col_layout = QHBoxLayout()
63
- col_layout.addWidget(QLabel(f'state {i}: '), 25)
64
- col_layout.addWidget(cb_i, 75)
65
- self.cbs_layout.addLayout(col_layout)
66
-
67
- layout.addLayout(self.cbs_layout)
68
-
69
- self.add_feature_btn = QPushButton()
70
- self.add_feature_btn.setIcon(icon(MDI6.plus, color=self.help_color))
71
- self.add_feature_btn.setIconSize(QSize(20, 20))
72
- self.add_feature_btn.clicked.connect(self.add_col)
73
- self.add_feature_btn.setStyleSheet(self.button_select_all)
74
- layout.addWidget(self.add_feature_btn, alignment=Qt.AlignRight)
75
-
76
- self.submit_btn = QPushButton('Compute')
77
- self.submit_btn.setStyleSheet(self.button_style_sheet)
78
- self.submit_btn.clicked.connect(self.compute)
79
- layout.addWidget(self.submit_btn, 30)
80
-
81
- self.setAttribute(Qt.WA_DeleteOnClose)
82
-
83
- def add_col(self):
84
- cb_i = QComboBox()
85
- cb_i.addItems(self.group_cols)
86
- self.cbs.append(cb_i)
87
-
88
- col_layout = QHBoxLayout()
89
- col_layout.addWidget(QLabel(f'state {len(self.cbs)}: '), 25)
90
- col_layout.addWidget(cb_i, 75)
91
-
92
- self.cbs_layout.addLayout(col_layout)
93
-
94
- def compute(self):
95
-
96
- cols_to_merge = [cb_i.currentText() for cb_i in self.cbs if cb_i.currentText() != "--"]
97
- name = self.name_le.text()
98
- if " " in name:
99
- name.replace(" ","_")
100
- if name == '':
101
- name = "multilabel"
102
- if not name.startswith("group_"):
103
- name = "group_" + name
104
-
105
- if len(cols_to_merge) > 1:
106
- print("Computing a multi-label classification from the classification feature sources...")
107
- bases = [int(self.parent_window.data[c].max()) + 1 for c in cols_to_merge]
108
- multipliers = np.concatenate(([1], np.cumprod(bases[:-1])))
109
- self.parent_window.data[name] = (self.parent_window.data[cols_to_merge] * multipliers).sum(axis=1)
110
- self.parent_window.data.loc[self.parent_window.data[cols_to_merge].isna().any(axis=1), name] = np.nan
111
-
112
- self.parent_window.model = PandasModel(self.parent_window.data)
113
- self.parent_window.table_view.setModel(self.parent_window.model)
114
- self.close()
115
- elif len(cols_to_merge) == 1:
116
- print("Only one classification feature was selected, nothing to merge...")
117
- else:
118
- print("No classification feature was selected...")