celldetective 1.1.0__tar.gz → 1.1.1__tar.gz

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 (92) hide show
  1. {celldetective-1.1.0 → celldetective-1.1.1}/PKG-INFO +1 -1
  2. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/__main__.py +5 -19
  3. celldetective-1.1.1/celldetective/extra_properties.py +110 -0
  4. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/control_panel.py +5 -0
  5. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/layouts.py +1 -0
  6. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/measurement_options.py +13 -109
  7. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/plot_signals_ui.py +1 -0
  8. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/process_block.py +1 -1
  9. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/survival_ui.py +7 -1
  10. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/tableUI.py +280 -28
  11. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/thresholds_gui.py +7 -5
  12. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/viewers.py +169 -22
  13. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/io.py +14 -5
  14. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/measure.py +13 -238
  15. celldetective-1.1.1/celldetective/models/segmentation_effectors/primNK_cfse/config_input.json +29 -0
  16. celldetective-1.1.1/celldetective/models/segmentation_effectors/primNK_cfse/cp-cfse-transfer +0 -0
  17. celldetective-1.1.1/celldetective/models/segmentation_effectors/primNK_cfse/training_instructions.json +37 -0
  18. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/neighborhood.py +4 -1
  19. celldetective-1.1.1/celldetective/preprocessing.py +1023 -0
  20. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/segment_cells.py +15 -4
  21. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/train_segmentation_model.py +35 -34
  22. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/segmentation.py +14 -9
  23. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/signals.py +13 -231
  24. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/tracking.py +2 -1
  25. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/utils.py +437 -26
  26. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/PKG-INFO +1 -1
  27. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/SOURCES.txt +4 -0
  28. {celldetective-1.1.0 → celldetective-1.1.1}/setup.py +1 -1
  29. celldetective-1.1.1/tests/test_preprocessing.py +37 -0
  30. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_utils.py +48 -1
  31. celldetective-1.1.0/celldetective/extra_properties.py +0 -100
  32. celldetective-1.1.0/celldetective/preprocessing.py +0 -683
  33. {celldetective-1.1.0 → celldetective-1.1.1}/LICENSE +0 -0
  34. {celldetective-1.1.0 → celldetective-1.1.1}/README.md +0 -0
  35. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/__init__.py +0 -0
  36. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/datasets/segmentation_annotations/blank +0 -0
  37. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/datasets/signal_annotations/blank +0 -0
  38. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/events.py +0 -0
  39. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/filters.py +0 -0
  40. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/__init__.py +0 -0
  41. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/about.py +0 -0
  42. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/analyze_block.py +0 -0
  43. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/btrack_options.py +0 -0
  44. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/classifier_widget.py +0 -0
  45. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/configure_new_exp.py +0 -0
  46. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/gui_utils.py +0 -0
  47. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/json_readers.py +0 -0
  48. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/neighborhood_options.py +0 -0
  49. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/plot_measurements.py +0 -0
  50. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/retrain_segmentation_model_options.py +0 -0
  51. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/retrain_signal_model_options.py +0 -0
  52. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/seg_model_loader.py +0 -0
  53. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/signal_annotator.py +0 -0
  54. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/signal_annotator_options.py +0 -0
  55. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/gui/styles.py +0 -0
  56. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/logo-large.png +0 -0
  57. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/logo.png +0 -0
  58. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/signals_icon.png +0 -0
  59. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/splash-test.png +0 -0
  60. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/splash.png +0 -0
  61. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/splash0.png +0 -0
  62. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/survival2.png +0 -0
  63. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/vignette_signals2.png +0 -0
  64. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/icons/vignette_signals2.svg +0 -0
  65. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/links/zenodo.json +0 -0
  66. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/segmentation_effectors/blank +0 -0
  67. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/segmentation_generic/blank +0 -0
  68. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/segmentation_targets/blank +0 -0
  69. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/signal_detection/blank +0 -0
  70. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/tracking_configs/mcf7.json +0 -0
  71. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/tracking_configs/ricm.json +0 -0
  72. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/models/tracking_configs/ricm2.json +0 -0
  73. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/analyze_signals.py +0 -0
  74. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/measure_cells.py +0 -0
  75. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/segment_cells_thresholds.py +0 -0
  76. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/track_cells.py +0 -0
  77. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective/scripts/train_signal_model.py +0 -0
  78. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/dependency_links.txt +0 -0
  79. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/entry_points.txt +0 -0
  80. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/not-zip-safe +0 -0
  81. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/requires.txt +0 -0
  82. {celldetective-1.1.0 → celldetective-1.1.1}/celldetective.egg-info/top_level.txt +0 -0
  83. {celldetective-1.1.0 → celldetective-1.1.1}/setup.cfg +0 -0
  84. {celldetective-1.1.0 → celldetective-1.1.1}/tests/__init__.py +0 -0
  85. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_events.py +0 -0
  86. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_filters.py +0 -0
  87. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_io.py +0 -0
  88. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_measure.py +0 -0
  89. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_neighborhood.py +0 -0
  90. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_segmentation.py +0 -0
  91. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_signals.py +0 -0
  92. {celldetective-1.1.0 → celldetective-1.1.1}/tests/test_tracking.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: celldetective
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: description
5
5
  Home-page: http://github.com/remyeltorro/celldetective
6
6
  Author: Rémy Torro
@@ -54,6 +54,11 @@ class AppInitWindow(QMainWindow):
54
54
  self.setCentralWidget(central_widget)
55
55
  self.reload_previous_gpu_threads()
56
56
  self.show()
57
+
58
+ def closeEvent(self, event):
59
+ QApplication.closeAllWindows()
60
+ event.accept()
61
+ gc.collect()
57
62
 
58
63
  def create_locate_exp_hbox(self):
59
64
 
@@ -365,25 +370,6 @@ class AppInitWindow(QMainWindow):
365
370
  if returnValue == QMessageBox.Ok:
366
371
  self.experiment_path_selection.setText('')
367
372
  return None
368
-
369
- def closeEvent(self, event):
370
-
371
- """
372
- Close child windows if closed.
373
- """
374
-
375
- try:
376
- if self.control_panel:
377
- self.control_panel.close()
378
- except:
379
- pass
380
- try:
381
- if self.new_exp_window:
382
- self.new_exp_window.close()
383
- except:
384
- pass
385
-
386
- gc.collect()
387
373
 
388
374
  if __name__ == "__main__":
389
375
 
@@ -0,0 +1,110 @@
1
+ """
2
+ Add extra properties to directly to regionprops
3
+ Functions must take regionmask as first argument and optionally intensity_image as second argument
4
+ If intensity is in function name, it will be replaced by the name of the channel. These measurements are applied automatically to all channels
5
+
6
+ """
7
+ import warnings
8
+
9
+ import numpy as np
10
+ from scipy.ndimage import distance_transform_edt
11
+ from scipy.spatial.distance import euclidean
12
+
13
+
14
+ # Percentiles
15
+
16
+ def intensity_percentile_ninety_nine(regionmask, intensity_image):
17
+ return np.nanpercentile(intensity_image[regionmask],99)
18
+
19
+ def intensity_percentile_ninety_five(regionmask, intensity_image):
20
+ return np.nanpercentile(intensity_image[regionmask],95)
21
+
22
+ def intensity_percentile_ninety(regionmask, intensity_image):
23
+ return np.nanpercentile(intensity_image[regionmask],90)
24
+
25
+ def intensity_percentile_seventy_five(regionmask, intensity_image):
26
+ return np.nanpercentile(intensity_image[regionmask],75)
27
+
28
+ def intensity_percentile_fifty(regionmask, intensity_image):
29
+ return np.nanpercentile(intensity_image[regionmask],50)
30
+
31
+ def intensity_percentile_twenty_five(regionmask, intensity_image):
32
+ return np.nanpercentile(intensity_image[regionmask],25)
33
+
34
+ # STD
35
+
36
+ def intensity_std(regionmask, intensity_image):
37
+ return np.nanstd(intensity_image[regionmask])
38
+
39
+
40
+ def intensity_median(regionmask, intensity_image):
41
+ return np.nanmedian(intensity_image[regionmask])
42
+
43
+ def intensity_nanmean(regionmask, intensity_image):
44
+ return np.nanmean(intensity_image[regionmask])
45
+
46
+ def intensity_centre_of_mass_displacement(regionmask, intensity_image):
47
+ y, x = np.mgrid[:regionmask.shape[0], :regionmask.shape[1]]
48
+ xtemp = x.copy()
49
+ ytemp = y.copy()
50
+ intensity_weighted_center = center_of_mass(intensity_image, regionmask)
51
+ centroid_x = intensity_weighted_center[1]
52
+ centroid_y = intensity_weighted_center[0]
53
+
54
+ geometric_centroid_x = np.sum(xtemp * regionmask) / np.sum(regionmask)
55
+ geometric_centroid_y = np.sum(ytemp * regionmask) / np.sum(regionmask)
56
+ distance = euclidean(np.array((geometric_centroid_y, geometric_centroid_x)), np.array((centroid_y, centroid_x)))
57
+ delta_x = geometric_centroid_x - centroid_x
58
+ delta_y = geometric_centroid_y - centroid_y
59
+ direction_arctan = np.arctan2(delta_y, delta_x) * 180 / np.pi
60
+ if direction_arctan < 0:
61
+ direction_arctan += 360
62
+ return distance, direction_arctan
63
+
64
+ def intensity_radial_gradient(regionmask, intensity_image):
65
+ warnings.filterwarnings('ignore', message="Polyfit may be poorly conditioned")
66
+ cell_mask = regionmask.copy()
67
+ intensity = intensity_image.copy()
68
+ y = intensity[cell_mask].flatten()
69
+ x = distance_transform_edt(cell_mask)
70
+ x = x[cell_mask].flatten()
71
+ params = np.polyfit(x, y, 1)
72
+ line = np.poly1d(params)
73
+
74
+ return line.coefficients[0], line.coefficients[1]
75
+
76
+
77
+ def intensity_centre_of_mass_displacement_edge(regionmask, intensity_image):
78
+ edt = distance_transform_edt(regionmask)
79
+ min_distance = 0
80
+ max_distance = 0.1*edt.max()
81
+ thresholded = (edt <= max_distance) * (edt > min_distance)
82
+ edge_mask = np.copy(regionmask)
83
+ edge_mask[np.where(thresholded == 0)] = 0
84
+ y, x = np.mgrid[:edge_mask.shape[0], :edge_mask.shape[1]]
85
+ xtemp = x.copy()
86
+ ytemp = y.copy()
87
+ intensity_edge = intensity_image.copy()
88
+ intensity_edge[np.where(edge_mask == 0)] = 0.
89
+ sum_intensity_edge = np.sum(intensity_edge)
90
+ sum_regionmask = np.sum(regionmask)
91
+
92
+ if sum_intensity_edge != 0 and sum_regionmask != 0:
93
+ y, x = np.mgrid[:regionmask.shape[0], :regionmask.shape[1]]
94
+ xtemp = x.copy()
95
+ ytemp = y.copy()
96
+ intensity_weighted_center = center_of_mass(intensity_image, regionmask)
97
+ centroid_x = intensity_weighted_center[1]
98
+ centroid_y = intensity_weighted_center[0]
99
+
100
+ geometric_centroid_x = np.sum(xtemp * regionmask) / np.sum(regionmask)
101
+ geometric_centroid_y = np.sum(ytemp * regionmask) / np.sum(regionmask)
102
+ distance = euclidean(np.array((geometric_centroid_y, geometric_centroid_x)), np.array((centroid_y, centroid_x)))
103
+ delta_x = geometric_centroid_x - centroid_x
104
+ delta_y = geometric_centroid_y - centroid_y
105
+ direction_arctan = np.arctan2(delta_y, delta_x) * 180 / np.pi
106
+ if direction_arctan < 0:
107
+ direction_arctan += 360
108
+ return distance, direction_arctan
109
+ else:
110
+ return np.nan, np.nan
@@ -319,6 +319,11 @@ class ControlPanel(QMainWindow, Styles):
319
319
  process_block.ConfigSignalAnnotator.close()
320
320
  except:
321
321
  pass
322
+ try:
323
+ if process_block.tab_ui:
324
+ process_block.tab_ui.close()
325
+ except:
326
+ pass
322
327
 
323
328
  try:
324
329
  if self.cfg_editor:
@@ -192,6 +192,7 @@ class BackgroundFitCorrectionLayout(QGridLayout, Styles):
192
192
  clip = clip,
193
193
  export= False,
194
194
  return_stacks=True,
195
+ activation_protocol=[['gauss',2],['std',4]],
195
196
  show_progress_per_well = True,
196
197
  show_progress_per_pos = False,
197
198
  )
@@ -21,8 +21,7 @@ from fonticon_mdi6 import MDI6
21
21
  from celldetective.gui.thresholds_gui import ThresholdNormalisation, ThresholdSpot
22
22
  from celldetective.utils import extract_experiment_channels, get_software_location
23
23
  from celldetective.io import interpret_tracking_configuration, load_frames, auto_load_number_of_frames
24
- from celldetective.measure import compute_haralick_features, contour_of_instance_segmentation, correct_image, \
25
- field_normalisation, normalise_by_cell
24
+ from celldetective.measure import compute_haralick_features, contour_of_instance_segmentation, normalise_by_cell
26
25
  import numpy as np
27
26
  from tifffile import imread
28
27
  import json
@@ -736,6 +735,17 @@ class ConfigMeasurements(QMainWindow, Styles):
736
735
  return None
737
736
  else:
738
737
  self.current_stack = movies[0]
738
+ self.stack_length = auto_load_number_of_frames(self.current_stack)
739
+
740
+ if self.stack_length is None:
741
+ stack = imread(self.current_stack)
742
+ self.stack_length = len(stack)
743
+ del stack
744
+ gc.collect()
745
+
746
+ self.mid_time = self.stack_length // 2
747
+ indices = self.mid_time + np.arange(len(self.channel_names))
748
+ self.test_frame = load_frames(list(indices.astype(int)),self.current_stack, normalize_input=False)
739
749
 
740
750
 
741
751
  def control_haralick_digitalization(self):
@@ -824,7 +834,7 @@ class ConfigMeasurements(QMainWindow, Styles):
824
834
  Load the first mask of the detected movie.
825
835
  """
826
836
 
827
- labels_path = str(Path(self.stack0).parent_window.parent_window) + f'/labels_{self.mode}/'
837
+ labels_path = str(Path(self.current_stack).parent.parent) + os.sep+f'labels_{self.mode}'+os.sep
828
838
  masks = natsorted(glob(labels_path + '*.tif'))
829
839
  if len(masks) == 0:
830
840
  print('no mask found')
@@ -859,47 +869,6 @@ class ConfigMeasurements(QMainWindow, Styles):
859
869
  self.im_mask.set_alpha(value)
860
870
  self.fig_contour.canvas.draw_idle()
861
871
 
862
- # def populate_normalisation_tabs(self):
863
-
864
- # """
865
- # Multi-tab options to perform background correction before measurements.
866
- # """
867
-
868
- # layout = QVBoxLayout(self.normalisation_frame)
869
-
870
- # self.normalisation_lbl = QLabel("BACKGROUND CORRECTION")
871
- # self.normalisation_lbl.setStyleSheet("""
872
- # font-weight: bold;
873
- # padding: 0px;
874
- # """)
875
- # layout.addWidget(self.normalisation_lbl, alignment=Qt.AlignCenter)
876
-
877
-
878
- # self.tabs = QTabWidget()
879
- # self.tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
880
-
881
- # self.tab1, self.tab2 = QWidget(), QWidget()
882
- # self.normalisation_list = QListWidget()
883
- # self.tabs.addTab(self.tab1, 'Local')
884
- # self.tabs.addTab(self.tab2, 'Field')
885
- # self.local_correction_layout = LocalCorrectionLayout(self, self.tab1)
886
- # self.fit_correction_layout = BackgroundFitCorrectionLayout(self, self.tab2)
887
- # layout.addWidget(self.tabs)
888
-
889
- # self.norm_list_lbl = QLabel('Background correction to perform:')
890
- # hbox = QHBoxLayout()
891
- # hbox.addWidget(self.norm_list_lbl)
892
- # self.del_norm_btn = QPushButton("")
893
- # self.del_norm_btn.setStyleSheet(self.button_select_all)
894
- # self.del_norm_btn.setIcon(icon(MDI6.trash_can, color="black"))
895
- # self.del_norm_btn.setToolTip("Remove background correction")
896
- # self.del_norm_btn.setIconSize(QSize(20, 20))
897
- # hbox.addWidget(self.del_norm_btn, alignment=Qt.AlignRight)
898
- # layout.addLayout(hbox)
899
- # self.del_norm_btn.clicked.connect(self.remove_item_from_list)
900
- # layout.addWidget(self.normalisation_list)
901
-
902
-
903
872
  def remove_item_from_list(self):
904
873
  current_item = self.normalisation_list.currentRow()
905
874
  if current_item > -1:
@@ -935,47 +904,6 @@ class ConfigMeasurements(QMainWindow, Styles):
935
904
  def fun(self, x, y):
936
905
  return x ** 2 + y
937
906
 
938
- # def preview_normalisation(self):
939
- # plt.close('all')
940
- # plt.figure("Intensity Profiles",figsize=(10, 5))
941
- # self.locate_image()
942
- # diagonal_length = min(self.test_frame[:, :, self.tab2_channel_dropdown.currentIndex()].shape[0], self.test_frame[:, :, self.tab2_channel_dropdown.currentIndex()].shape[1])
943
- # if self.tab2_subtract.isChecked():
944
- # norm_operation='Subtract'
945
- # else:
946
- # norm_operation='Divide'
947
- # normalised, bg_fit = field_normalisation(self.test_frame[:, :, self.tab2_channel_dropdown.currentIndex()],
948
- # threshold=self.tab2_txt_threshold.text(),
949
- # normalisation_operation=norm_operation,
950
- # clip=self.tab2_clip.isChecked(),
951
- # mode=self.tab2_dropdown.currentText())
952
- # diagonal_original = [self.test_frame[:, :, self.tab2_channel_dropdown.currentIndex()][i, i] for i in
953
- # range(diagonal_length)]
954
- # diagonal_corrected = [normalised[i, i] for i in range(diagonal_length)]
955
- # diagonal_indices = np.arange(diagonal_length)
956
-
957
- # plt.subplot(1, 2, 1)
958
- # plt.plot(diagonal_indices, diagonal_original, color='black', linewidth=0.2) # Adjust linewidth here
959
- # plt.title('Original Image')
960
- # plt.xlabel('Pixel Index along Diagonal')
961
- # plt.ylabel('Intensity')
962
-
963
- # plt.subplot(1, 2, 2)
964
- # plt.plot(diagonal_indices, diagonal_corrected, color='black', linewidth=0.2) # Adjust linewidth here
965
- # plt.title('Corrected Image')
966
- # plt.xlabel('Pixel Index along Diagonal')
967
- # plt.ylabel('Intensity')
968
-
969
- # plt.tight_layout()
970
- # plt.show()
971
-
972
- # self.fig, self.ax = plt.subplots()
973
- # self.normalised_img = FigureCanvas(self.fig, "Corrected background image preview")
974
- # self.ax.clear()
975
- # self.ax.imshow(normalised, cmap='gray')
976
- # self.normalised_img.canvas.draw()
977
- # self.normalised_img.show()
978
-
979
907
  def view_normalisation_contour(self):
980
908
 
981
909
  """
@@ -1061,30 +989,6 @@ class ConfigMeasurements(QMainWindow, Styles):
1061
989
  if self.test_mask is not None:
1062
990
  self.spot_visual = ThresholdSpot(current_channel=self.spot_channel.currentIndex(), img=self.test_frame,
1063
991
  mask=self.test_mask, parent_window=self)
1064
- # for dictionary in self.background_correction:
1065
- # if self.spot_channel.currentText() in dictionary['target channel']:
1066
- # if dictionary['mode'] == 'field':
1067
- # if dictionary['operation'] == 'Divide':
1068
- # normalised, bg_fit = field_normalisation(
1069
- # self.test_frame[:, :, self.spot_channel.currentIndex()],
1070
- # threshold=dictionary['threshold'],
1071
- # normalisation_operation=dictionary['operation'],
1072
- # clip=False,
1073
- # mode=dictionary['type'])
1074
- # else:
1075
- # normalised, bg_fit = field_normalisation(
1076
- # self.test_frame[:, :, self.spot_channel.currentIndex()],
1077
- # threshold=dictionary['threshold'],
1078
- # normalisation_operation=dictionary['operation'],
1079
- # clip=dictionary['clip'],
1080
- # mode=dictionary['type'])
1081
- # self.test_frame[:, :, self.spot_channel.currentIndex()] = normalised
1082
- # if dictionary['mode'] == 'local':
1083
- # normalised_image = normalise_by_cell(self.test_frame[:, :, self.spot_channel.currentIndex()].copy(), self.test_mask,
1084
- # distance=int(dictionary['distance']), mode=dictionary['type'],
1085
- # operation=dictionary['operation'])
1086
- # self.test_frame[:, :, self.spot_channel.currentIndex()] = normalised_image
1087
-
1088
992
 
1089
993
  def enable_spot_detection(self):
1090
994
  if self.spot_check.isChecked():
@@ -32,6 +32,7 @@ from lifelines import KaplanMeierFitter
32
32
  from matplotlib.cm import viridis, tab10
33
33
  import math
34
34
  from celldetective.gui import Styles
35
+ from matplotlib import colormaps
35
36
 
36
37
 
37
38
 
@@ -1288,7 +1288,7 @@ class PreprocessingPanel(QFrame, Styles):
1288
1288
  correct_background_model_free(self.exp_dir,
1289
1289
  well_option=well_option,
1290
1290
  position_option=pos_option,
1291
- export= True,
1291
+ export = True,
1292
1292
  return_stacks=False,
1293
1293
  show_progress_per_well = True,
1294
1294
  show_progress_per_pos = True,
@@ -28,6 +28,7 @@ import matplotlib.cm as mcm
28
28
  import math
29
29
  from celldetective.events import switch_to_events
30
30
  from celldetective.gui import Styles
31
+ from matplotlib import colormaps
31
32
 
32
33
  class ConfigSurvival(QWidget, Styles):
33
34
 
@@ -124,7 +125,12 @@ class ConfigSurvival(QWidget, Styles):
124
125
  self.cbs[i].addItems(self.cb_options[i])
125
126
  choice_layout.addLayout(hbox)
126
127
 
127
- self.cbs[-1].addColormaps(self.cb_options[-1])
128
+ for cm in list(colormaps):
129
+ try:
130
+ self.cbs[-1].addColormap(cm)
131
+ except:
132
+ pass
133
+
128
134
  main_layout.addLayout(choice_layout)
129
135
 
130
136
  self.cbs[0].setCurrentIndex(0)