celldetective 1.3.6.post1__tar.gz → 1.3.6.post2__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 (114) hide show
  1. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/PKG-INFO +1 -1
  2. celldetective-1.3.6.post2/celldetective/_version.py +1 -0
  3. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/filters.py +11 -2
  4. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/gui_utils.py +2 -2
  5. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/neighborhood_options.py +1 -1
  6. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/signal_annotator2.py +17 -17
  7. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/io.py +1 -1
  8. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/measure_cells.py +28 -13
  9. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/segment_cells.py +24 -20
  10. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/segment_cells_thresholds.py +21 -21
  11. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/track_cells.py +32 -18
  12. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/PKG-INFO +1 -1
  13. celldetective-1.3.6.post1/celldetective/_version.py +0 -1
  14. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/LICENSE +0 -0
  15. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/README.md +0 -0
  16. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/__init__.py +0 -0
  17. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/__main__.py +0 -0
  18. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/datasets/segmentation_annotations/blank +0 -0
  19. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/datasets/signal_annotations/blank +0 -0
  20. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/events.py +0 -0
  21. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/extra_properties.py +0 -0
  22. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/InitWindow.py +0 -0
  23. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/__init__.py +0 -0
  24. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/about.py +0 -0
  25. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/analyze_block.py +0 -0
  26. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/btrack_options.py +0 -0
  27. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/classifier_widget.py +0 -0
  28. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/configure_new_exp.py +0 -0
  29. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/control_panel.py +0 -0
  30. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/generic_signal_plot.py +0 -0
  31. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/DL-segmentation-strategy.json +0 -0
  32. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/Threshold-vs-DL.json +0 -0
  33. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/cell-populations.json +0 -0
  34. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/exp-structure.json +0 -0
  35. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/feature-btrack.json +0 -0
  36. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/neighborhood.json +0 -0
  37. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/prefilter-for-segmentation.json +0 -0
  38. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/preprocessing.json +0 -0
  39. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/propagate-classification.json +0 -0
  40. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/track-postprocessing.json +0 -0
  41. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/help/tracking.json +0 -0
  42. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/json_readers.py +0 -0
  43. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/layouts.py +0 -0
  44. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/measurement_options.py +0 -0
  45. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/plot_measurements.py +0 -0
  46. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/plot_signals_ui.py +0 -0
  47. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/process_block.py +0 -0
  48. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/retrain_segmentation_model_options.py +0 -0
  49. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/retrain_signal_model_options.py +0 -0
  50. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/seg_model_loader.py +0 -0
  51. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/signal_annotator.py +0 -0
  52. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/signal_annotator_options.py +0 -0
  53. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/styles.py +0 -0
  54. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/survival_ui.py +0 -0
  55. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/tableUI.py +0 -0
  56. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/thresholds_gui.py +0 -0
  57. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/gui/viewers.py +0 -0
  58. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/logo-large.png +0 -0
  59. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/logo.png +0 -0
  60. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/signals_icon.png +0 -0
  61. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/splash-test.png +0 -0
  62. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/splash.png +0 -0
  63. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/splash0.png +0 -0
  64. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/survival2.png +0 -0
  65. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/vignette_signals2.png +0 -0
  66. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/icons/vignette_signals2.svg +0 -0
  67. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/links/zenodo.json +0 -0
  68. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/measure.py +0 -0
  69. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/pair_signal_detection/blank +0 -0
  70. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_effectors/blank +0 -0
  71. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_effectors/ricm_bf_all_last/config_input.json +0 -0
  72. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_effectors/ricm_bf_all_last/ricm_bf_all_last +0 -0
  73. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_effectors/ricm_bf_all_last/training_instructions.json +0 -0
  74. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_effectors/test-transfer/config_input.json +0 -0
  75. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_effectors/test-transfer/test-transfer +0 -0
  76. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_generic/blank +0 -0
  77. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/segmentation_targets/blank +0 -0
  78. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/signal_detection/blank +0 -0
  79. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/tracking_configs/biased_motion.json +0 -0
  80. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/tracking_configs/mcf7.json +0 -0
  81. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/tracking_configs/no_z_motion.json +0 -0
  82. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/tracking_configs/ricm.json +0 -0
  83. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/models/tracking_configs/ricm2.json +0 -0
  84. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/neighborhood.py +0 -0
  85. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/preprocessing.py +0 -0
  86. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/relative_measurements.py +0 -0
  87. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/analyze_signals.py +0 -0
  88. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/measure_relative.py +0 -0
  89. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/train_segmentation_model.py +0 -0
  90. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/scripts/train_signal_model.py +0 -0
  91. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/segmentation.py +0 -0
  92. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/signals.py +0 -0
  93. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/tracking.py +0 -0
  94. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective/utils.py +0 -0
  95. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/SOURCES.txt +0 -0
  96. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/dependency_links.txt +0 -0
  97. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/entry_points.txt +0 -0
  98. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/not-zip-safe +0 -0
  99. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/requires.txt +0 -0
  100. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/celldetective.egg-info/top_level.txt +0 -0
  101. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/setup.cfg +0 -0
  102. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/setup.py +0 -0
  103. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/__init__.py +0 -0
  104. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_events.py +0 -0
  105. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_filters.py +0 -0
  106. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_io.py +0 -0
  107. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_measure.py +0 -0
  108. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_neighborhood.py +0 -0
  109. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_preprocessing.py +0 -0
  110. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_qt.py +0 -0
  111. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_segmentation.py +0 -0
  112. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_signals.py +0 -0
  113. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_tracking.py +0 -0
  114. {celldetective-1.3.6.post1 → celldetective-1.3.6.post2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: celldetective
3
- Version: 1.3.6.post1
3
+ Version: 1.3.6.post2
4
4
  Summary: description
5
5
  Home-page: http://github.com/remyeltorro/celldetective
6
6
  Author: Rémy Torro
@@ -0,0 +1 @@
1
+ __version__ = "1.3.6.post2"
@@ -88,9 +88,13 @@ def laplace_filter(img, output=float, interpolate=True, *kwargs):
88
88
  img = interpolate_nan(img.astype(float))
89
89
  return snd.laplace(img.astype(float), *kwargs)
90
90
 
91
- def dog_filter(img, sigma_low, sigma_high, interpolate=True, *kwargs):
91
+ def dog_filter(img, blob_size=None, sigma_low=1, sigma_high=2, interpolate=True, *kwargs):
92
+
92
93
  if interpolate:
93
94
  img = interpolate_nan(img.astype(float))
95
+ if blob_size is not None:
96
+ sigma_low = 1.0 / (1.0 + np.sqrt(2)) * blob_size
97
+ sigma_high = np.sqrt(2)*sigma_low
94
98
  return difference_of_gaussians(img.astype(float), sigma_low, sigma_high, *kwargs)
95
99
 
96
100
  def otsu_filter(img, *kwargs):
@@ -115,13 +119,18 @@ def sauvola_filter(img, *kwargs):
115
119
  binary = img >= thresh
116
120
  return binary.astype(float)
117
121
 
118
- def log_filter(img, sigma, *kwargs):
122
+ def log_filter(img, blob_size=None, sigma=1, interpolate=True, *kwargs):
119
123
 
120
124
  if interpolate:
121
125
  img = interpolate_nan(img.astype(float))
126
+ if blob_size is not None:
127
+ sigma_low = 1.0 / (1.0 + np.sqrt(2)) * blob_size
128
+ sigma_high = np.sqrt(2)*sigma_low
129
+
122
130
  return snd.gaussian_laplace(img.astype(float), sigma, *kwargs)
123
131
 
124
132
  def tophat_filter(img, size, connectivity=4, interpolate=True, *kwargs):
133
+
125
134
  if interpolate:
126
135
  img = interpolate_nan(img.astype(float))
127
136
  structure = snd.generate_binary_structure(rank=2, connectivity=connectivity)
@@ -622,8 +622,8 @@ class FilterChoice(QWidget, Styles):
622
622
  'ln_filter': None,
623
623
  'invert_filter': {'value': 65535},
624
624
  'subtract_filter': {'value': 1},
625
- 'dog_filter': {'sigma_low': 0.8, 'sigma_high': 1.6},
626
- 'log_filter': {'sigma': 2},
625
+ 'dog_filter': {'blob_size': 30},
626
+ 'log_filter': {'blob_size': 30},
627
627
  'tophat_filter': {'size': 4, 'connectivity': 4},
628
628
  'otsu_filter': None,
629
629
  'local_filter': {'block_size': 73, 'method': 'mean', 'offset': 0},
@@ -400,7 +400,7 @@ class ConfigNeighborhoods(QWidget, Styles):
400
400
 
401
401
  status_options = [self.reference_population_status_cb.currentText(), self.neighbor_population_status_cb.currentText()]
402
402
  for k in range(2):
403
- if status_options[k]=='--':
403
+ if status_options[k]=='--' or status_options[k]=='':
404
404
  status_options[k] = None
405
405
  if pop[0]!=pop[1]:
406
406
  mode = 'two-pop'
@@ -205,14 +205,14 @@ class SignalAnnotator2(QMainWindow,Styles):
205
205
 
206
206
  self.cell_events_hbox = QHBoxLayout()
207
207
  self.cell_events_hbox.setContentsMargins(0,0,0,0)
208
- self.cell_events_hbox.addWidget(QLabel('reference event: '), 25)
208
+ self.cell_events_hbox.addWidget(QLabel('Event: '), 25)
209
209
  self.reference_event_choice_cb = QComboBox()
210
210
  self.cell_events_hbox.addWidget(self.reference_event_choice_cb, 75)
211
211
 
212
212
  #if 'self' not in self.neighborhood_choice_cb.currentText():
213
213
  self.neigh_cell_events_hbox = QHBoxLayout()
214
214
  self.neigh_cell_events_hbox.setContentsMargins(0,0,0,0)
215
- self.neigh_lab=QLabel('neighbor event: ')
215
+ self.neigh_lab=QLabel('Event: ')
216
216
  self.neigh_cell_events_hbox.addWidget(self.neigh_lab, 25)
217
217
  self.neighbor_event_choice_cb = QComboBox()
218
218
  self.neigh_cell_events_hbox.addWidget(self.neighbor_event_choice_cb, 75)
@@ -233,7 +233,7 @@ class SignalAnnotator2(QMainWindow,Styles):
233
233
  neighbor_layout.addLayout(self.neigh_cell_events_hbox)
234
234
 
235
235
  self.cell_info_hbox.addLayout(reference_layout, 33)
236
- self.cell_info_hbox.addWidget(self.pair_info, 33, alignment=Qt.AlignCenter)
236
+ self.cell_info_hbox.addWidget(self.pair_info, 33)
237
237
  self.cell_info_hbox.addLayout(neighbor_layout, 33)
238
238
 
239
239
  self.left_panel.addLayout(self.cell_info_hbox)
@@ -2378,41 +2378,41 @@ class SignalAnnotator2(QMainWindow,Styles):
2378
2378
 
2379
2379
  df_reference = self.dataframes[self.reference_population]
2380
2380
  if self.reference_track_of_interest is not None:
2381
- reference_cell_selected = f"reference cell: {self.reference_track_of_interest}\n"
2382
- reference_cell_population = f"population: {self.reference_population}\n"
2381
+ reference_cell_selected = f"Ref #{self.reference_track_of_interest}\n"
2382
+ reference_cell_population = f"Pop: {self.reference_population}\n"
2383
2383
  #reference_cell_class = f"class: {df_reference[df_reference['TRACK_ID']==self.reference_track_of_interest, self.reference_event_choice_cb.currentText()].values[0]}\n"
2384
2384
  #reference_cell_time = f"time of interest: {df_reference[df_reference['TRACK_ID']==self.reference_track_of_interest, ''].values[0]}\n"
2385
2385
  self.reference_cell_info.setText(reference_cell_selected+reference_cell_population)
2386
2386
  else:
2387
- reference_cell_selected = f"reference cell: None\n"
2388
- reference_cell_population = f"population: {self.reference_population}\n"
2387
+ reference_cell_selected = f"Ref: None\n"
2388
+ reference_cell_population = f"Pop: {self.reference_population}\n"
2389
2389
  self.reference_cell_info.setText(reference_cell_selected+reference_cell_population)
2390
2390
 
2391
2391
  def give_neighbor_cell_information(self):
2392
2392
 
2393
2393
  if self.neighbor_track_of_interest is not None:
2394
- neighbor_cell_selected = f"neighbor cell: {self.neighbor_track_of_interest}\n"
2395
- neighbor_cell_population = f"population: {self.neighbor_population}\n"
2394
+ neighbor_cell_selected = f"Neigh #{self.neighbor_track_of_interest}\n"
2395
+ neighbor_cell_population = f"Pop: {self.neighbor_population}\n"
2396
2396
  #neighbor_cell_time = f"time of interest: {self.df_relative.loc[(self.df_relative['REFERENCE_ID']==self.reference_track_of_interest)&(self.df_relative['NEIGHBOR_ID']==self.neighbor_track_of_interest), self.pair_time_name].to_numpy()[0]}\n"
2397
2397
  #neighbor_cell_class = f"class: {self.df_relative.loc[(self.df_relative['REFERENCE_ID']==self.reference_track_of_interest)&(self.df_relative['NEIGHBOR_ID']==self.neighbor_track_of_interest), self.pair_class_name].to_numpy()[0]}\n"
2398
2398
  self.neighbor_cell_info.setText(neighbor_cell_selected+neighbor_cell_population) #neighbor_cell_class+neighbor_cell_time
2399
2399
  else:
2400
- neighbor_cell_selected = f"neighbor cell: None\n"
2401
- neighbor_cell_population = f"population: {self.neighbor_population}\n"
2400
+ neighbor_cell_selected = f"Neigh: None\n"
2401
+ neighbor_cell_population = f"Pop: {self.neighbor_population}\n"
2402
2402
  self.neighbor_cell_info.setText(neighbor_cell_selected+neighbor_cell_population)
2403
2403
 
2404
2404
  def give_pair_information(self):
2405
2405
 
2406
2406
  if self.neighbor_track_of_interest is not None and self.reference_track_of_interest is not None:
2407
- pair_selected = f"(reference/neighbor) pair: ({self.reference_track_of_interest},{self.neighbor_track_of_interest})\n"
2408
- pair_populations = f"populations: ({self.reference_population}, {self.neighbor_population})\n"
2407
+ pair_selected = f"Pair: ({self.reference_track_of_interest},{self.neighbor_track_of_interest})\n"
2408
+ pair_populations = "" #f"populations: ({self.reference_population}, {self.neighbor_population})\n"
2409
2409
  current_class = self.relative_class_choice_cb.currentText()
2410
- pair_class = f"interaction event class: {self.df_relative.loc[(self.df_relative['REFERENCE_ID']==self.reference_track_of_interest)&(self.df_relative['NEIGHBOR_ID']==self.neighbor_track_of_interest)&(self.df_relative['reference_population']==self.reference_population)&(self.df_relative['neighbor_population']==self.neighbor_population)&(~self.df_relative['status_'+self.current_neighborhood].isnull()), current_class].values[0]}\n"
2411
- pair_time = f"time of interest: {self.df_relative.loc[(self.df_relative['REFERENCE_ID']==self.reference_track_of_interest)&(self.df_relative['NEIGHBOR_ID']==self.neighbor_track_of_interest)&(self.df_relative['reference_population']==self.reference_population)&(self.df_relative['neighbor_population']==self.neighbor_population)&(~self.df_relative['status_'+self.current_neighborhood].isnull()), self.pair_time_name].values[0]}\n"
2410
+ pair_class = f"Event class: {self.df_relative.loc[(self.df_relative['REFERENCE_ID']==self.reference_track_of_interest)&(self.df_relative['NEIGHBOR_ID']==self.neighbor_track_of_interest)&(self.df_relative['reference_population']==self.reference_population)&(self.df_relative['neighbor_population']==self.neighbor_population)&(~self.df_relative['status_'+self.current_neighborhood].isnull()), current_class].values[0]}\n"
2411
+ pair_time = f"Time: {self.df_relative.loc[(self.df_relative['REFERENCE_ID']==self.reference_track_of_interest)&(self.df_relative['NEIGHBOR_ID']==self.neighbor_track_of_interest)&(self.df_relative['reference_population']==self.reference_population)&(self.df_relative['neighbor_population']==self.neighbor_population)&(~self.df_relative['status_'+self.current_neighborhood].isnull()), self.pair_time_name].values[0]}\n"
2412
2412
  self.pair_info.setText(pair_selected+pair_populations+pair_class+pair_time)
2413
2413
  else:
2414
- pair_selected = f"(reference/neighbor) pair: None\n"
2415
- pair_populations = f"populations: ({self.reference_population}, {self.neighbor_population})\n"
2414
+ pair_selected = f"Pair: None\n"
2415
+ pair_populations = "" #f"populations: ({self.reference_population}, {self.neighbor_population})\n"
2416
2416
  self.pair_info.setText(pair_selected+pair_populations)
2417
2417
 
2418
2418
 
@@ -2874,7 +2874,7 @@ def locate_segmentation_model(name):
2874
2874
 
2875
2875
  main_dir = os.sep.join([os.path.split(os.path.dirname(os.path.realpath(__file__)))[0],"celldetective"])
2876
2876
  modelpath = os.sep.join([main_dir, "models", "segmentation*"]) + os.sep
2877
- print(f'Looking for {name} in {modelpath}')
2877
+ #print(f'Looking for {name} in {modelpath}')
2878
2878
  models = glob(modelpath + f'*{os.sep}')
2879
2879
 
2880
2880
  match = None
@@ -5,7 +5,7 @@ Copright © 2022 Laboratoire Adhesion et Inflammation, Authored by Remy Torro.
5
5
  import argparse
6
6
  import os
7
7
  import json
8
- from celldetective.io import auto_load_number_of_frames, load_frames, fix_missing_labels, locate_labels
8
+ from celldetective.io import auto_load_number_of_frames, load_frames, fix_missing_labels, locate_labels, extract_position_name
9
9
  from celldetective.utils import extract_experiment_channels, ConfigSectionMap, _get_img_num_per_channel, extract_experiment_channels
10
10
  from celldetective.utils import remove_redundant_features, remove_trajectory_measurements
11
11
  from celldetective.measure import drop_tonal_features, measure_features, measure_isotropic_intensity
@@ -50,7 +50,10 @@ parent1 = Path(pos).parent
50
50
  expfolder = parent1.parent
51
51
  config = PurePath(expfolder,Path("config.ini"))
52
52
  assert os.path.exists(config),'The configuration file for the experiment could not be located. Abort.'
53
+
54
+ print(f"Position: {extract_position_name(pos)}...")
53
55
  print("Configuration file: ",config)
56
+ print(f"Population: {mode}...")
54
57
 
55
58
  # from exp config fetch spatial calib, channel names
56
59
  movie_prefix = ConfigSectionMap(config,"MovieSettings")["movie_prefix"]
@@ -62,11 +65,15 @@ nbr_channels = len(channel_names)
62
65
 
63
66
  # from tracking instructions, fetch btrack config, features, haralick, clean_traj, idea: fetch custom timeline?
64
67
  instr_path = PurePath(expfolder,Path(f"{instruction_file}"))
68
+ print('Looking for measurement instruction file...')
69
+
65
70
  if os.path.exists(instr_path):
66
- print(f"Tracking instructions for the {mode} population has been successfully located.")
71
+
67
72
  with open(instr_path, 'r') as f:
68
73
  instructions = json.load(f)
69
- print("Reading the following instructions: ", instructions)
74
+ print(f"Measurement instruction file successfully loaded...")
75
+ print(f"Instructions: {instructions}...")
76
+
70
77
  if 'background_correction' in instructions:
71
78
  background_correction = instructions['background_correction']
72
79
  else:
@@ -144,7 +151,7 @@ except IndexError:
144
151
  # Load trajectories, add centroid if not in trajectory
145
152
  trajectories = pos+os.sep.join(['output','tables', table_name])
146
153
  if os.path.exists(trajectories):
147
- print('trajectory exists...')
154
+ print('A trajectory table was found...')
148
155
  trajectories = pd.read_csv(trajectories)
149
156
  if 'TRACK_ID' not in list(trajectories.columns):
150
157
  do_iso_intensities = False
@@ -289,18 +296,26 @@ def measure_index(indices):
289
296
  measurements_at_t[column_labels['time']] = t
290
297
  timestep_dataframes.append(measurements_at_t)
291
298
 
299
+ return
300
+
301
+
302
+ print(f"Starting the measurements with {n_threads} thread(s)...")
303
+
304
+ import concurrent.futures
292
305
 
293
306
  # Multithreading
294
307
  indices = list(range(img_num_channels.shape[1]))
295
308
  chunks = np.array_split(indices, n_threads)
296
- threads = []
297
- for i in range(n_threads):
298
- thread_i = threading.Thread(target=measure_index, args=[chunks[i]])
299
- threads.append(thread_i)
300
- for th in threads:
301
- th.start()
302
- for th in threads:
303
- th.join()
309
+
310
+ with concurrent.futures.ThreadPoolExecutor() as executor:
311
+ results = executor.map(measure_index, chunks)
312
+ try:
313
+ for i,return_value in enumerate(results):
314
+ print(f"Thread {i} output check: ",return_value)
315
+ except Exception as e:
316
+ print("Exception: ", e)
317
+
318
+ print('Done.')
304
319
 
305
320
 
306
321
  if len(timestep_dataframes)>0:
@@ -320,7 +335,7 @@ if len(timestep_dataframes)>0:
320
335
  df = df.drop(invalid_cols, axis=1)
321
336
 
322
337
  df.to_csv(pos+os.sep.join(["output", "tables", table_name]), index=False)
323
- print(f'Measurements successfully written in table {pos+os.sep.join(["output", "tables", table_name])}')
338
+ print(f'Measurement table successfully exported in {os.sep.join(["output", "tables"])}...')
324
339
  print('Done.')
325
340
  else:
326
341
  print('No measurement could be performed. Check your inputs.')
@@ -8,7 +8,7 @@ import os
8
8
  import json
9
9
  from stardist.models import StarDist2D
10
10
  from cellpose.models import CellposeModel
11
- from celldetective.io import locate_segmentation_model, auto_load_number_of_frames, load_frames
11
+ from celldetective.io import locate_segmentation_model, auto_load_number_of_frames, load_frames, extract_position_name
12
12
  from celldetective.utils import interpolate_nan, _estimate_scale_factor, _extract_channel_indices_from_config, ConfigSectionMap, _extract_nbr_channels_from_config, _get_img_num_per_channel
13
13
  from pathlib import Path, PurePath
14
14
  from glob import glob
@@ -44,6 +44,7 @@ if use_gpu=='True' or use_gpu=='true' or use_gpu=='1':
44
44
  n_threads = 1 # avoid misbehavior on GPU with multithreading
45
45
  else:
46
46
  use_gpu = False
47
+ #n_threads = 1 # force 1 threads since all CPUs seem to be in use anyway
47
48
 
48
49
  if not use_gpu:
49
50
  os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
@@ -60,20 +61,22 @@ parent1 = Path(pos).parent
60
61
  expfolder = parent1.parent
61
62
  config = PurePath(expfolder,Path("config.ini"))
62
63
  assert os.path.exists(config),'The configuration file for the experiment could not be located. Abort.'
64
+
65
+ print(f"Position: {extract_position_name(pos)}...")
63
66
  print("Configuration file: ",config)
67
+ print(f"Population: {mode}...")
64
68
 
65
69
  ####################################
66
70
  # Check model requirements #########
67
71
  ####################################
68
72
 
69
73
  modelpath = os.sep.join([os.path.split(os.path.dirname(os.path.realpath(__file__)))[0],"models"])
70
- print(modelpath)
71
74
  model_complete_path = locate_segmentation_model(modelname)
72
75
  if model_complete_path is None:
73
76
  print('Model could not be found. Abort.')
74
77
  os.abort()
75
78
  else:
76
- print(f'Model successfully located in {model_complete_path}')
79
+ print(f'Model path: {model_complete_path}...')
77
80
 
78
81
  # load config
79
82
  assert os.path.exists(model_complete_path+"config_input.json"),'The configuration for the inputs to the model could not be located. Abort.'
@@ -86,7 +89,7 @@ required_channels = input_config["channels"]
86
89
  channel_indices = _extract_channel_indices_from_config(config, required_channels)
87
90
  print(f'Required channels: {required_channels} located at channel indices {channel_indices}.')
88
91
  required_spatial_calibration = input_config['spatial_calibration']
89
- print(f'Expected spatial calibration is {required_spatial_calibration}.')
92
+ print(f'Spatial calibration expected by the model: {required_spatial_calibration}...')
90
93
 
91
94
  normalization_percentile = input_config['normalization_percentile']
92
95
  normalization_clip = input_config['normalization_clip']
@@ -117,18 +120,19 @@ if model_type=='cellpose':
117
120
  flow_threshold = input_config['flow_threshold']
118
121
 
119
122
  scale = _estimate_scale_factor(spatial_calibration, required_spatial_calibration)
120
- print(f"Scale = {scale}...")
123
+ print(f"Scale: {scale}...")
121
124
 
122
125
  nbr_channels = _extract_nbr_channels_from_config(config)
123
- print(f'Number of channels in the input movie: {nbr_channels}')
126
+ #print(f'Number of channels in the input movie: {nbr_channels}')
124
127
  img_num_channels = _get_img_num_per_channel(channel_indices, int(len_movie), nbr_channels)
125
128
 
126
129
  # If everything OK, prepare output, load models
127
- print('Erasing previous segmentation folder.')
128
130
  if os.path.exists(pos+label_folder):
131
+ print('Erasing the previous labels folder...')
129
132
  rmtree(pos+label_folder)
130
133
  os.mkdir(pos+label_folder)
131
- print(f'Folder {pos+label_folder} successfully generated.')
134
+ print(f'Labels folder successfully generated...')
135
+
132
136
  log=f'segmentation model: {modelname}\n'
133
137
  with open(pos+f'log_{mode}.json', 'a') as f:
134
138
  f.write(f'{datetime.datetime.now()} SEGMENT \n')
@@ -137,6 +141,7 @@ with open(pos+f'log_{mode}.json', 'a') as f:
137
141
 
138
142
  # Loop over all frames and segment
139
143
  def segment_index(indices):
144
+
140
145
  global scale
141
146
 
142
147
  if model_type=='stardist':
@@ -179,8 +184,7 @@ def segment_index(indices):
179
184
  f = np.moveaxis([interpolate_nan(f[:,:,c].copy()) for c in range(f.shape[-1])],0,-1)
180
185
 
181
186
  if np.any(img_num_channels[:,t]==-1):
182
- f[:,:,np.where(img_num_channels[:,t]==-1)[0]] = 0.
183
-
187
+ f[:,:,np.where(img_num_channels[:,t]==-1)[0]] = 0.
184
188
 
185
189
  if model_type=="stardist":
186
190
  Y_pred, details = model.predict_instances(f, n_tiles=model._guess_n_tiles(f), show_tile_progress=False, verbose=False)
@@ -206,6 +210,10 @@ def segment_index(indices):
206
210
  del Y_pred;
207
211
  gc.collect()
208
212
 
213
+ return
214
+
215
+
216
+ print(f"Starting the segmentation with {n_threads} thread(s) and GPU={use_gpu}...")
209
217
 
210
218
  import concurrent.futures
211
219
 
@@ -214,16 +222,12 @@ indices = list(range(img_num_channels.shape[1]))
214
222
  chunks = np.array_split(indices, n_threads)
215
223
 
216
224
  with concurrent.futures.ThreadPoolExecutor() as executor:
217
- executor.map(segment_index, chunks)
218
-
219
- # threads = []
220
- # for i in range(n_threads):
221
- # thread_i = threading.Thread(target=segment_index, args=[chunks[i]])
222
- # threads.append(thread_i)
223
- # for th in threads:
224
- # th.start()
225
- # for th in threads:
226
- # th.join()
225
+ results = executor.map(segment_index, chunks)
226
+ try:
227
+ for i,return_value in enumerate(results):
228
+ print(f"Thread {i} output check: ",return_value)
229
+ except Exception as e:
230
+ print("Exception: ", e)
227
231
 
228
232
  print('Done.')
229
233
 
@@ -5,7 +5,7 @@ Copright © 2022 Laboratoire Adhesion et Inflammation, Authored by Remy Torro.
5
5
  import argparse
6
6
  import os
7
7
  import json
8
- from celldetective.io import auto_load_number_of_frames, load_frames
8
+ from celldetective.io import auto_load_number_of_frames, load_frames, extract_position_name
9
9
  from celldetective.segmentation import segment_frame_from_thresholds
10
10
  from celldetective.utils import _extract_channel_indices_from_config, ConfigSectionMap, _extract_nbr_channels_from_config, _get_img_num_per_channel, extract_experiment_channels
11
11
  from pathlib import Path, PurePath
@@ -48,8 +48,6 @@ else:
48
48
  print('The configuration path is not valid. Abort.')
49
49
  os.abort()
50
50
 
51
- print('The following instructions were successfully loaded: ', threshold_instructions)
52
-
53
51
  if mode.lower()=="target" or mode.lower()=="targets":
54
52
  label_folder = "labels_targets"
55
53
  elif mode.lower()=="effector" or mode.lower()=="effectors":
@@ -60,12 +58,14 @@ parent1 = Path(pos).parent
60
58
  expfolder = parent1.parent
61
59
  config = PurePath(expfolder,Path("config.ini"))
62
60
  assert os.path.exists(config),'The configuration file for the experiment could not be located. Abort.'
63
- print("Configuration file: ",config)
64
61
 
62
+ print(f"Position: {extract_position_name(pos)}...")
63
+ print("Configuration file: ",config)
64
+ print(f"Population: {mode}...")
65
65
 
66
66
  channel_indices = _extract_channel_indices_from_config(config, required_channels)
67
67
  # need to abort if channel not found
68
- print(f'Required channels: {required_channels} located at channel indices {channel_indices}.')
68
+ print(f'Required channels: {required_channels} located at channel indices {channel_indices}...')
69
69
 
70
70
  threshold_instructions.update({'target_channel': channel_indices[0]})
71
71
 
@@ -86,15 +86,15 @@ if len_movie_auto is not None:
86
86
  len_movie = len_movie_auto
87
87
 
88
88
  nbr_channels = _extract_nbr_channels_from_config(config)
89
- print(f'Number of channels in the input movie: {nbr_channels}')
89
+ #print(f'Number of channels in the input movie: {nbr_channels}')
90
90
  img_num_channels = _get_img_num_per_channel(np.arange(nbr_channels), len_movie, nbr_channels)
91
91
 
92
92
  # If everything OK, prepare output, load models
93
- print('Erasing previous segmentation folder.')
94
93
  if os.path.exists(os.sep.join([pos,label_folder])):
94
+ print('Erasing the previous labels folder...')
95
95
  rmtree(os.sep.join([pos,label_folder]))
96
96
  os.mkdir(os.sep.join([pos,label_folder]))
97
- print(f'Folder {os.sep.join([pos,label_folder])} successfully generated.')
97
+ print(f'Labels folder successfully generated...')
98
98
 
99
99
  if equalize:
100
100
  f_reference = load_frames(img_num_channels[:,equalize_time], file, scale=None, normalize_input=False)
@@ -103,7 +103,7 @@ else:
103
103
  f_reference = None
104
104
 
105
105
  threshold_instructions.update({'equalize_reference': f_reference})
106
- print(threshold_instructions)
106
+ print(f"Instructions: {threshold_instructions}...")
107
107
 
108
108
  # Loop over all frames and segment
109
109
  def segment_index(indices):
@@ -119,6 +119,11 @@ def segment_index(indices):
119
119
  del mask;
120
120
  gc.collect()
121
121
 
122
+ return
123
+
124
+
125
+ print(f"Starting the segmentation with {n_threads} thread(s)...")
126
+
122
127
  import concurrent.futures
123
128
 
124
129
  # Multithreading
@@ -126,20 +131,15 @@ indices = list(range(img_num_channels.shape[1]))
126
131
  chunks = np.array_split(indices, n_threads)
127
132
 
128
133
  with concurrent.futures.ThreadPoolExecutor() as executor:
129
- executor.map(segment_index, chunks)
130
-
131
- # indices = list(range(img_num_channels.shape[1]))
132
- # chunks = np.array_split(indices, n_threads)
133
- # threads = []
134
- # for i in range(n_threads):
135
- # thread_i = threading.Thread(target=segment_index, args=[chunks[i]])
136
- # threads.append(thread_i)
137
- # for th in threads:
138
- # th.start()
139
- # for th in threads:
140
- # th.join()
134
+ results = executor.map(segment_index, chunks)
135
+ try:
136
+ for i,return_value in enumerate(results):
137
+ print(f"Thread {i} output check: ",return_value)
138
+ except Exception as e:
139
+ print("Exception: ", e)
141
140
 
142
141
  print('Done.')
142
+
143
143
  gc.collect()
144
144
 
145
145
 
@@ -6,7 +6,7 @@ import argparse
6
6
  import datetime
7
7
  import os
8
8
  import json
9
- from celldetective.io import auto_load_number_of_frames, load_frames, interpret_tracking_configuration
9
+ from celldetective.io import auto_load_number_of_frames, load_frames, interpret_tracking_configuration, extract_position_name
10
10
  from celldetective.utils import extract_experiment_channels, ConfigSectionMap, _get_img_num_per_channel, extract_experiment_channels
11
11
  from celldetective.measure import drop_tonal_features, measure_features
12
12
  from celldetective.tracking import track
@@ -59,6 +59,10 @@ expfolder = parent1.parent
59
59
  config = PurePath(expfolder,Path("config.ini"))
60
60
  assert os.path.exists(config),'The configuration file for the experiment could not be located. Abort.'
61
61
 
62
+ print(f"Position: {extract_position_name(pos)}...")
63
+ print("Configuration file: ",config)
64
+ print(f"Population: {mode}...")
65
+
62
66
  # from exp config fetch spatial calib, channel names
63
67
  movie_prefix = ConfigSectionMap(config,"MovieSettings")["movie_prefix"]
64
68
  spatial_calibration = float(ConfigSectionMap(config,"MovieSettings")["pxtoum"])
@@ -71,9 +75,10 @@ channel_names, channel_indices = extract_experiment_channels(config)
71
75
  nbr_channels = len(channel_names)
72
76
 
73
77
  # from tracking instructions, fetch btrack config, features, haralick, clean_traj, idea: fetch custom timeline?
78
+ print('Looking for tracking instruction file...')
74
79
  instr_path = PurePath(expfolder,Path(f"{instruction_file}"))
75
80
  if os.path.exists(instr_path):
76
- print(f"Tracking instructions for the {mode} population have been successfully loaded...")
81
+ print(f"Tracking instruction file successfully loaded...")
77
82
  with open(instr_path, 'r') as f:
78
83
  instructions = json.load(f)
79
84
  btrack_config = interpret_tracking_configuration(instructions['btrack_config_path'])
@@ -107,8 +112,6 @@ if os.path.exists(instr_path):
107
112
  memory = None
108
113
  if 'memory' in instructions:
109
114
  memory = instructions['memory']
110
-
111
-
112
115
  else:
113
116
  print('Tracking instructions could not be located... Using a standard bTrack motion model instead...')
114
117
  btrack_config = interpret_tracking_configuration(None)
@@ -169,6 +172,7 @@ if not btrack_option:
169
172
 
170
173
 
171
174
  def measure_index(indices):
175
+
172
176
  for t in tqdm(indices,desc="frame"):
173
177
 
174
178
  # Load channels at time t
@@ -181,24 +185,27 @@ def measure_index(indices):
181
185
  df_props.rename(columns={'centroid-1': 'x', 'centroid-0': 'y'},inplace=True)
182
186
  df_props['t'] = int(t)
183
187
  timestep_dataframes.append(df_props)
188
+ return
189
+
190
+
191
+
192
+ print(f"Measuring features with {n_threads} thread(s)...")
193
+
194
+ import concurrent.futures
184
195
 
185
196
  # Multithreading
186
197
  indices = list(range(img_num_channels.shape[1]))
187
198
  chunks = np.array_split(indices, n_threads)
188
199
 
189
- import concurrent.futures
190
-
191
200
  with concurrent.futures.ThreadPoolExecutor() as executor:
192
- executor.map(measure_index, chunks)
201
+ results = executor.map(measure_index, chunks)
202
+ try:
203
+ for i,return_value in enumerate(results):
204
+ print(f"Thread {i} output check: ",return_value)
205
+ except Exception as e:
206
+ print("Exception: ", e)
193
207
 
194
- # threads = []
195
- # for i in range(n_threads):
196
- # thread_i = threading.Thread(target=measure_index, args=[chunks[i]])
197
- # threads.append(thread_i)
198
- # for th in threads:
199
- # th.start()
200
- # for th in threads:
201
- # th.join()
208
+ print('Features successfully measured...')
202
209
 
203
210
  df = pd.concat(timestep_dataframes)
204
211
  df.reset_index(inplace=True, drop=True)
@@ -214,6 +221,13 @@ if mask_channels is not None:
214
221
  df = df.drop(cols_to_drop, axis=1)
215
222
 
216
223
  # do tracking
224
+ if btrack_option:
225
+ tracker = 'bTrack'
226
+ else:
227
+ tracker = 'trackpy'
228
+
229
+ print(f"Start the tracking step using the {tracker} tracker...")
230
+
217
231
  trajectories, napari_data = track(None,
218
232
  configuration=btrack_config,
219
233
  objects=df,
@@ -228,14 +242,14 @@ trajectories, napari_data = track(None,
228
242
  search_range=search_range,
229
243
  memory=memory,
230
244
  )
245
+ print(f"Tracking successfully performed...")
231
246
 
232
247
  # out trajectory table, create POSITION_X_um, POSITION_Y_um, TIME_min (new ones)
233
- # Save napari data
248
+ # Save napari data # deprecated, should disappear progressively
234
249
  np.save(pos+os.sep.join(['output', 'tables', napari_name]), napari_data, allow_pickle=True)
235
- print(f"napari data successfully saved in {pos+os.sep.join(['output', 'tables'])}")
236
250
 
237
251
  trajectories.to_csv(pos+os.sep.join(['output', 'tables', table_name]), index=False)
238
- print(f"Table {table_name} successfully saved in {os.sep.join(['output', 'tables'])}")
252
+ print(f"Trajectory table successfully exported in {os.sep.join(['output', 'tables'])}...")
239
253
 
240
254
  if os.path.exists(pos+os.sep.join(['output', 'tables', table_name.replace('.csv','.pkl')])):
241
255
  os.remove(pos+os.sep.join(['output', 'tables', table_name.replace('.csv','.pkl')]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: celldetective
3
- Version: 1.3.6.post1
3
+ Version: 1.3.6.post2
4
4
  Summary: description
5
5
  Home-page: http://github.com/remyeltorro/celldetective
6
6
  Author: Rémy Torro
@@ -1 +0,0 @@
1
- __version__ = "1.3.6.post1"