microeye 2.3.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.
Files changed (190) hide show
  1. microEye/__init__.py +47 -0
  2. microEye/_version.py +2 -0
  3. microEye/analysis/__init__.py +1 -0
  4. microEye/analysis/checklist_dialog.py +143 -0
  5. microEye/analysis/cmosMaps.py +228 -0
  6. microEye/analysis/filters/__init__.py +9 -0
  7. microEye/analysis/filters/base.py +21 -0
  8. microEye/analysis/filters/spatial.py +338 -0
  9. microEye/analysis/filters/temporal.py +76 -0
  10. microEye/analysis/fitting/__init__.py +0 -0
  11. microEye/analysis/fitting/fit.py +680 -0
  12. microEye/analysis/fitting/nena.py +375 -0
  13. microEye/analysis/fitting/phasor_fit.py +90 -0
  14. microEye/analysis/fitting/processing.py +317 -0
  15. microEye/analysis/fitting/psf/__init__.py +6 -0
  16. microEye/analysis/fitting/psf/extract.py +1129 -0
  17. microEye/analysis/fitting/psf/rubost_mean.py +150 -0
  18. microEye/analysis/fitting/psf/spline.py +167 -0
  19. microEye/analysis/fitting/psf/stats/__init__.py +12 -0
  20. microEye/analysis/fitting/psf/stats/core.py +295 -0
  21. microEye/analysis/fitting/psf/stats/curve_fit.py +708 -0
  22. microEye/analysis/fitting/psf/stats/io.py +104 -0
  23. microEye/analysis/fitting/psf/stats/slope_fit.py +171 -0
  24. microEye/analysis/fitting/psf/temp.py +147 -0
  25. microEye/analysis/fitting/psf/test.py +47 -0
  26. microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUfunctions.py +657 -0
  27. microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUmleFit_LM.py +1336 -0
  28. microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUsplineLib.py +270 -0
  29. microEye/analysis/fitting/pyfit3Dcspline/CPU/__init__.py +1 -0
  30. microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUfunctions.py +609 -0
  31. microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_EMCCD.py +1396 -0
  32. microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_sCMOS.py +1426 -0
  33. microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUsplineLib.py +231 -0
  34. microEye/analysis/fitting/pyfit3Dcspline/GPU/__init__.py +2 -0
  35. microEye/analysis/fitting/pyfit3Dcspline/__init__.py +10 -0
  36. microEye/analysis/fitting/pyfit3Dcspline/constants.py +27 -0
  37. microEye/analysis/fitting/pyfit3Dcspline/mainfunctions.py +903 -0
  38. microEye/analysis/fitting/results.py +917 -0
  39. microEye/analysis/fitting/results_stats.py +251 -0
  40. microEye/analysis/fitting/tardis.py +209 -0
  41. microEye/analysis/multi_viewer.py +568 -0
  42. microEye/analysis/processing/__init__.py +1 -0
  43. microEye/analysis/processing/frc.py +120 -0
  44. microEye/analysis/rendering/__init__.py +3 -0
  45. microEye/analysis/rendering/base.py +452 -0
  46. microEye/analysis/rendering/cloud.py +215 -0
  47. microEye/analysis/rendering/core.py +47 -0
  48. microEye/analysis/rendering/volumetric.py +198 -0
  49. microEye/analysis/tools/__init__.py +0 -0
  50. microEye/analysis/tools/kymograms.py +1079 -0
  51. microEye/analysis/tools/roi_selectors.py +556 -0
  52. microEye/analysis/utils/__init__.py +3 -0
  53. microEye/analysis/utils/coordinates.py +18 -0
  54. microEye/analysis/utils/images.py +68 -0
  55. microEye/analysis/utils/windows.py +19 -0
  56. microEye/analysis/viewer/__init__.py +3 -0
  57. microEye/analysis/viewer/image_options_widget.py +615 -0
  58. microEye/analysis/viewer/images.py +1225 -0
  59. microEye/analysis/viewer/layers_widget.py +415 -0
  60. microEye/analysis/viewer/localizations.py +1304 -0
  61. microEye/analysis/viewer/psf.py +1003 -0
  62. microEye/analysis/viewer/volume.py +456 -0
  63. microEye/hardware/__init__.py +3 -0
  64. microEye/hardware/cams/__init__.py +29 -0
  65. microEye/hardware/cams/camera_calibration.py +99 -0
  66. microEye/hardware/cams/camera_list.py +528 -0
  67. microEye/hardware/cams/camera_options.py +694 -0
  68. microEye/hardware/cams/camera_panel.py +941 -0
  69. microEye/hardware/cams/dummy/__init__.py +1 -0
  70. microEye/hardware/cams/dummy/dummy_panel.py +759 -0
  71. microEye/hardware/cams/jobs.py +497 -0
  72. microEye/hardware/cams/line_profiler.py +99 -0
  73. microEye/hardware/cams/linescan/IR_Cam.py +474 -0
  74. microEye/hardware/cams/linescan/__init__.py +1 -0
  75. microEye/hardware/cams/micam.py +524 -0
  76. microEye/hardware/cams/pco/__init__.py +58 -0
  77. microEye/hardware/cams/pco/enums.py +382 -0
  78. microEye/hardware/cams/pco/pco_cam.py +761 -0
  79. microEye/hardware/cams/pco/pco_panel.py +477 -0
  80. microEye/hardware/cams/shortcuts.py +312 -0
  81. microEye/hardware/cams/thorlabs/__init__.py +1 -0
  82. microEye/hardware/cams/thorlabs/thorlabs.py +1508 -0
  83. microEye/hardware/cams/thorlabs/thorlabs_panel.py +850 -0
  84. microEye/hardware/cams/ueye/__init__.py +1 -0
  85. microEye/hardware/cams/ueye/ueye_camera.py +1023 -0
  86. microEye/hardware/cams/ueye/ueye_panel.py +861 -0
  87. microEye/hardware/cams/vimba/__init__.py +1 -0
  88. microEye/hardware/cams/vimba/vimba_cam.py +1000 -0
  89. microEye/hardware/cams/vimba/vimba_panel.py +813 -0
  90. microEye/hardware/device.py +60 -0
  91. microEye/hardware/lasers/__init__.py +13 -0
  92. microEye/hardware/lasers/io_matchbox.py +791 -0
  93. microEye/hardware/lasers/io_params.py +85 -0
  94. microEye/hardware/lasers/io_single_laser.py +742 -0
  95. microEye/hardware/lasers/laser_relay.py +594 -0
  96. microEye/hardware/mieye/__init__.py +1 -0
  97. microEye/hardware/mieye/acquisition_manager.py +467 -0
  98. microEye/hardware/mieye/devices_manager.py +533 -0
  99. microEye/hardware/mieye/miEye.py +659 -0
  100. microEye/hardware/misc/__init__.py +0 -0
  101. microEye/hardware/misc/acquisition_view.py +71 -0
  102. microEye/hardware/misc/reglo.py +761 -0
  103. microEye/hardware/misc/temp.py +188 -0
  104. microEye/hardware/port_config.py +59 -0
  105. microEye/hardware/protocols/__init__.py +2 -0
  106. microEye/hardware/protocols/actions.py +402 -0
  107. microEye/hardware/protocols/actions_items.py +703 -0
  108. microEye/hardware/protocols/designer.py +244 -0
  109. microEye/hardware/protocols/scene_manager.py +191 -0
  110. microEye/hardware/protocols/serialization.py +97 -0
  111. microEye/hardware/pycromanager/__init__.py +16 -0
  112. microEye/hardware/pycromanager/core.py +1433 -0
  113. microEye/hardware/pycromanager/devices.py +461 -0
  114. microEye/hardware/pycromanager/enums.py +107 -0
  115. microEye/hardware/pycromanager/headless.py +153 -0
  116. microEye/hardware/pycromanager/utils.py +34 -0
  117. microEye/hardware/pycromanager/widgets/__init__.py +5 -0
  118. microEye/hardware/pycromanager/widgets/bridges.py +407 -0
  119. microEye/hardware/pycromanager/widgets/headless_manager.py +258 -0
  120. microEye/hardware/pycromanager/widgets/headless_options.py +224 -0
  121. microEye/hardware/pycromanager/widgets/pycro_panel.py +455 -0
  122. microEye/hardware/stages/__init__.py +18 -0
  123. microEye/hardware/stages/elliptec/__init__.py +5 -0
  124. microEye/hardware/stages/elliptec/baseDevice.py +314 -0
  125. microEye/hardware/stages/elliptec/device.py +384 -0
  126. microEye/hardware/stages/elliptec/deviceID.py +212 -0
  127. microEye/hardware/stages/elliptec/devicePort.py +379 -0
  128. microEye/hardware/stages/elliptec/deviceStatus.py +65 -0
  129. microEye/hardware/stages/elliptec/devicesView.py +706 -0
  130. microEye/hardware/stages/elliptec/ellDevices.py +134 -0
  131. microEye/hardware/stages/elliptec/messageUpdater.py +34 -0
  132. microEye/hardware/stages/elliptec/motorInfo.py +153 -0
  133. microEye/hardware/stages/elliptec/stage.py +62 -0
  134. microEye/hardware/stages/elliptec/test.py +139 -0
  135. microEye/hardware/stages/kinesis/__init__.py +1 -0
  136. microEye/hardware/stages/kinesis/kdc101/__init__.py +1 -0
  137. microEye/hardware/stages/kinesis/kdc101/enums.py +1002 -0
  138. microEye/hardware/stages/kinesis/kdc101/factory.py +171 -0
  139. microEye/hardware/stages/kinesis/kdc101/kdc101.py +718 -0
  140. microEye/hardware/stages/kinesis/kinesis.py +776 -0
  141. microEye/hardware/stages/piezo_concept.py +607 -0
  142. microEye/hardware/stages/stabilizer.py +785 -0
  143. microEye/hardware/stages/stage.py +89 -0
  144. microEye/hardware/widgets/__init__.py +10 -0
  145. microEye/hardware/widgets/controller.py +246 -0
  146. microEye/hardware/widgets/devices.py +133 -0
  147. microEye/hardware/widgets/focusWidget.py +264 -0
  148. microEye/hardware/widgets/qlist_slider.py +113 -0
  149. microEye/hardware/widgets/scan_acquisition.py +424 -0
  150. microEye/icons/1024.png +0 -0
  151. microEye/icons/128.png +0 -0
  152. microEye/icons/16.png +0 -0
  153. microEye/icons/24.png +0 -0
  154. microEye/icons/256.png +0 -0
  155. microEye/icons/32.png +0 -0
  156. microEye/icons/48.png +0 -0
  157. microEye/icons/512.png +0 -0
  158. microEye/icons/64.png +0 -0
  159. microEye/icons/__init__.py +0 -0
  160. microEye/icons/close.svg +88 -0
  161. microEye/icons/mieye.png +0 -0
  162. microEye/icons/min.svg +83 -0
  163. microEye/icons/viewer.png +0 -0
  164. microEye/launcher.py +42 -0
  165. microEye/qt.py +181 -0
  166. microEye/utils/__init__.py +2 -0
  167. microEye/utils/enum_encoder.py +10 -0
  168. microEye/utils/expandable_groupbox.py +93 -0
  169. microEye/utils/gui_helper.py +457 -0
  170. microEye/utils/hid/__init__.py +8 -0
  171. microEye/utils/hid/controller.py +153 -0
  172. microEye/utils/hid/device.py +63 -0
  173. microEye/utils/hid/enums.py +140 -0
  174. microEye/utils/hid/utils.py +58 -0
  175. microEye/utils/labelled_slider.py +134 -0
  176. microEye/utils/metadata.py +599 -0
  177. microEye/utils/metadata_tree.py +718 -0
  178. microEye/utils/micro_launcher.py +245 -0
  179. microEye/utils/parameter_tree.py +325 -0
  180. microEye/utils/pyscripting.py +444 -0
  181. microEye/utils/retry_exec.py +35 -0
  182. microEye/utils/start_gui.py +112 -0
  183. microEye/utils/thread_worker.py +115 -0
  184. microEye/utils/uImage.py +1512 -0
  185. microeye-2.3.2.dist-info/METADATA +401 -0
  186. microeye-2.3.2.dist-info/RECORD +190 -0
  187. microeye-2.3.2.dist-info/WHEEL +5 -0
  188. microeye-2.3.2.dist-info/entry_points.txt +2 -0
  189. microeye-2.3.2.dist-info/licenses/LICENSE +674 -0
  190. microeye-2.3.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,455 @@
1
+ import logging
2
+ import time
3
+ import traceback
4
+ from enum import Enum
5
+
6
+ from microEye.analysis.tools.roi_selectors import (
7
+ MultiRectangularROISelector,
8
+ convert_pos_size_to_rois,
9
+ convert_rois_to_pos_size,
10
+ )
11
+ from microEye.hardware.cams.camera_options import CamParams
12
+ from microEye.hardware.cams.camera_panel import Camera_Panel
13
+ from microEye.hardware.pycromanager.devices import PycroCamera
14
+ from microEye.qt import QDateTime, QtCore, QtWidgets, getOpenFileName, getSaveFileName
15
+ from microEye.utils.gui_helper import get_scaling_factor
16
+ from microEye.utils.metadata_tree import MetaParams
17
+ from microEye.utils.thread_worker import QThreadWorker
18
+ from microEye.utils.uImage import uImage
19
+
20
+
21
+ class PycroParams(Enum):
22
+ FREERUN = 'Acquisition.Freerun'
23
+ STOP = 'Acquisition.Stop'
24
+ LOAD = 'Acquisition Settings.Load Config'
25
+ SAVE = 'Acquisition Settings.Save Config'
26
+
27
+ def __str__(self):
28
+ '''
29
+ Return the last part of the enum value (Param name).
30
+ '''
31
+ return self.value.split('.')[-1]
32
+
33
+ def get_path(self):
34
+ '''
35
+ Return the full parameter path.
36
+ '''
37
+ return self.value.split('.')
38
+
39
+
40
+ class PycroPanel(Camera_Panel):
41
+ '''
42
+ A Qt Widget for a pycro-manager camera
43
+ | Inherits Camera_Panel
44
+ '''
45
+
46
+ PARAMS = PycroParams
47
+
48
+ def __init__(self, cam: PycroCamera, mini=False, *args, **kwargs):
49
+ '''
50
+ Initializes a new Dummy_Panel Qt widget.
51
+
52
+ Inherits Camera_Panel.
53
+
54
+ Parameters
55
+ ----------
56
+ cam : PycroCamera
57
+ The camera to be used in the panel.
58
+ mini : bool, optional
59
+ Flag indicating if this is a mini camera panel, by default False.
60
+
61
+ Other Parameters
62
+ ---------------
63
+ *args
64
+ Arguments to pass to the Camera_Panel constructor.
65
+
66
+ **kwargs
67
+ Keyword arguments to pass to the Camera_Panel constructor.
68
+ '''
69
+ if not isinstance(cam, PycroCamera) or cam is None:
70
+ raise ValueError('Invalid camera type!')
71
+
72
+ super().__init__(cam, mini, *args, **kwargs)
73
+
74
+ self.OME_tab.set_param_value(MetaParams.CHANNEL_NAME, self._cam.name)
75
+ self.OME_tab.set_param_value(MetaParams.DET_MANUFACTURER, 'Pycromanager')
76
+ self.OME_tab.set_param_value(MetaParams.DET_MODEL, cam.label)
77
+ self.OME_tab.set_param_value(MetaParams.DET_SERIAL, 'N/A')
78
+ self.OME_tab.set_param_value(MetaParams.DET_TYPE, 'CMOS')
79
+
80
+ self.camera_options.set_param_value(CamParams.FRAMES, 10000)
81
+
82
+ for property in self._cam.property_tree():
83
+ self.camera_options.add_param_child(
84
+ CamParams.ACQ_SETTINGS,
85
+ property,
86
+ )
87
+ self.camera_options.get_param(
88
+ '.'.join([CamParams.ACQ_SETTINGS.value, property['name']])
89
+ ).sigValueChanged.connect(self.update_cam)
90
+
91
+ # exposure init
92
+ exposure = self.camera_options.get_param(CamParams.EXPOSURE)
93
+ exposure.setLimits((self._cam.exposure_range[0], self._cam.exposure_range[1]))
94
+ exposure.setOpts(step=0.1, suffix='ms')
95
+ exposure.setValue(self._cam.exposure_current)
96
+ exposure.sigValueChanged.connect(self.exposure_spin_changed)
97
+
98
+ # start freerun mode button
99
+ freerun = self.get_event_action(PycroParams.FREERUN)
100
+ self.camera_options.add_param_child(CamParams.ACQUISITION, freerun)
101
+ self.camera_options.get_param(PycroParams.FREERUN).sigActivated.connect(
102
+ self.start_free_run
103
+ )
104
+
105
+ # stop acquisition button
106
+ stop = {'name': str(PycroParams.STOP), 'type': 'action'}
107
+ self.camera_options.add_param_child(CamParams.ACQUISITION, stop)
108
+ self.camera_options.get_param(PycroParams.STOP).sigActivated.connect(self.stop)
109
+
110
+ # ROI
111
+ self.camera_options.set_roi_limits(
112
+ (0, self.cam.getWidth()),
113
+ (0, self.cam.getHeight()),
114
+ (32, self.cam.getWidth()),
115
+ (32, self.cam.getHeight()),
116
+ )
117
+
118
+ # start a timer to update the camera params
119
+ self.timer = QtCore.QTimer(self, timeout=self.update_params, interval=1000)
120
+ self.timer.start()
121
+
122
+ @property
123
+ def cam(self):
124
+ '''The PycroCamera property.
125
+
126
+ Returns
127
+ -------
128
+ PycroCamera
129
+ the PycroCamera used as panel camera.
130
+ '''
131
+ return self._cam
132
+
133
+ @cam.setter
134
+ def cam(self, cam: PycroCamera):
135
+ '''The PycroCamera setter.
136
+
137
+ Parameters
138
+ ----------
139
+ cam : PycroCamera
140
+ the PycroCamera to set as panel camera.
141
+ '''
142
+ self._cam = cam
143
+
144
+ def update_cam(self, param, value):
145
+ if self._cam.has_property(param.name()):
146
+ self._cam.set_property(param.name(), value)
147
+
148
+ param.setValue(self._cam.get_property(param.name()), self.update_cam)
149
+
150
+ def update_params(self):
151
+ for property in self._cam.get_prop_names():
152
+ param = self.camera_options.get_param(
153
+ '.'.join([CamParams.ACQ_SETTINGS.value, property])
154
+ )
155
+
156
+ new_value = type(param.value())(self._cam.get_property(property))
157
+ if param and new_value != param.value():
158
+ param.setValue(new_value, self.update_cam)
159
+
160
+ self.refresh_exposure()
161
+ self.updateInfo()
162
+
163
+ def set_ROI(self):
164
+ '''Sets the ROI for the slected PycroCamera'''
165
+ if self.cam.acquisition:
166
+ QtWidgets.QMessageBox.warning(
167
+ self, 'Warning', 'Cannot set ROI while acquiring images!'
168
+ )
169
+ return # if acquisition is already going on
170
+
171
+ self.cam.set_roi(*self.camera_options.get_roi_info(False))
172
+
173
+ def reset_ROI(self):
174
+ '''Resets the ROI for the slected PycroCamera'''
175
+ if self.cam.acquisition:
176
+ QtWidgets.QMessageBox.warning(
177
+ self, 'Warning', 'Cannot reset ROI while acquiring images!'
178
+ )
179
+ return # if acquisition is already going on
180
+
181
+ self.cam.reset_roi()
182
+
183
+ self.camera_options.set_roi_info(
184
+ 0, 0, int(self.cam.width), int(self.cam.height)
185
+ )
186
+
187
+ def center_ROI(self):
188
+ '''Sets the ROI for the slected PycroCamera'''
189
+ if self.cam.acquisition:
190
+ QtWidgets.QMessageBox.warning(
191
+ self, 'Warning', 'Cannot set ROI while acquiring images!'
192
+ )
193
+ return # if acquisition is already going on
194
+
195
+ x, y, width, height = self.camera_options.get_roi_info(False)
196
+ x = (int(self.cam.width) - width) // 2
197
+ y = (int(self.cam.height) - height) // 2
198
+
199
+ self.cam.set_roi(x, y, width, height)
200
+
201
+ self.camera_options.set_roi_info(x, y, width, height)
202
+
203
+ def select_ROI(self):
204
+ '''
205
+ Opens a dialog to select a ROI from the last image.
206
+ '''
207
+ if self.cam.acquisition:
208
+ QtWidgets.QMessageBox.warning(
209
+ self, 'Warning', 'Cannot set ROI while acquiring images!'
210
+ )
211
+ return # if acquisition is already going on
212
+
213
+ if self.acq_job is not None:
214
+ try:
215
+
216
+ def work_func(**kwargs):
217
+ try:
218
+ image = uImage(self.acq_job.frame.image)
219
+
220
+ image.equalizeLUT(nLUT=True)
221
+
222
+ scale_factor = get_scaling_factor(image.height, image.width)
223
+
224
+ selector = MultiRectangularROISelector.get_selector(
225
+ image._view, scale_factor, max_rois=1
226
+ )
227
+ # if old_rois:
228
+ # selector.rois = old_rois
229
+
230
+ rois = selector.select_rectangular_rois()
231
+
232
+ rois = convert_rois_to_pos_size(rois)
233
+
234
+ if len(rois) > 0:
235
+ return rois[0]
236
+ else:
237
+ return None
238
+ except Exception:
239
+ traceback.print_exc()
240
+ return None
241
+
242
+ def done(result: list):
243
+ if result is not None:
244
+ # x, y, w, h = result
245
+ self.camera_options.set_roi_info(*result)
246
+
247
+ self.worker = QThreadWorker(work_func)
248
+ self.worker.signals.result.connect(done)
249
+ # Execute
250
+ self._threadpool.start(self.worker)
251
+ except Exception:
252
+ traceback.print_exc()
253
+
254
+ def select_ROIs(self):
255
+ '''
256
+ Opens a dialog to select multiple ROIs from the last image.
257
+ '''
258
+ if self.cam.acquisition:
259
+ QtWidgets.QMessageBox.warning(
260
+ self, 'Warning', 'Cannot set ROI while acquiring images!'
261
+ )
262
+ return # if acquisition is already going on
263
+
264
+ if self.acq_job is not None:
265
+ try:
266
+
267
+ def work_func(**kwargs):
268
+ try:
269
+ image = uImage(self.acq_job.frame.image)
270
+
271
+ image.equalizeLUT(nLUT=True)
272
+
273
+ scale_factor = get_scaling_factor(image.height, image.width)
274
+
275
+ selector = MultiRectangularROISelector.get_selector(
276
+ image._view, scale_factor, max_rois=4, one_size=True
277
+ )
278
+
279
+ old_rois = self.camera_options.get_export_rois()
280
+
281
+ if len(old_rois) > 0:
282
+ old_rois = convert_pos_size_to_rois(old_rois)
283
+ selector.rois = old_rois
284
+
285
+ rois = selector.select_rectangular_rois()
286
+
287
+ rois = convert_rois_to_pos_size(rois)
288
+
289
+ if len(rois) > 0:
290
+ return rois
291
+ else:
292
+ return None
293
+ except Exception:
294
+ traceback.print_exc()
295
+ return None
296
+
297
+ def done(results: list[list]):
298
+ if results is not None:
299
+ rois_param = self.camera_options.get_param(
300
+ CamParams.EXPORTED_ROIS
301
+ )
302
+ rois_param.clearChildren()
303
+ for x, y, w, h in results:
304
+ self.camera_options.add_param_child(
305
+ CamParams.EXPORTED_ROIS,
306
+ {
307
+ 'name': 'ROI 1',
308
+ 'type': 'str',
309
+ 'readonly': True,
310
+ 'removable': True,
311
+ 'value': f'{x}, {y}, {w}, {h}',
312
+ },
313
+ )
314
+
315
+ self.worker = QThreadWorker(work_func)
316
+ self.worker.signals.result.connect(done)
317
+ # Execute
318
+ self._threadpool.start(self.worker)
319
+ except Exception:
320
+ traceback.print_exc()
321
+
322
+ def exposure_spin_changed(self, param, value: float):
323
+ '''
324
+ Slot for changed exposure
325
+
326
+ Parameters
327
+ ----------
328
+ Value : double
329
+ selected exposure in milliseconds
330
+ '''
331
+ self._cam.setExposure(value)
332
+
333
+ self.refresh_exposure()
334
+
335
+ self.OME_tab.set_param_value(
336
+ MetaParams.EXPOSURE, float(self._cam.exposure_current)
337
+ )
338
+
339
+ def refresh_exposure(self):
340
+ self.camera_options.set_param_value(
341
+ CamParams.EXPOSURE, self._cam.exposure_current, self.exposure_spin_changed
342
+ )
343
+
344
+ def cam_capture(self, *args, **kwargs):
345
+ '''Capture function executed by the capture worker.
346
+
347
+ Sends software trigger signals and transfers the
348
+ acquired frame to the display processing stack.
349
+
350
+ Parameters
351
+ ----------
352
+ cam : PycroCamera
353
+ the PycroCamera used to acquire frames.
354
+ '''
355
+ try:
356
+ if self.mini:
357
+ self._cam.start_continuous_acquisition(0)
358
+ else:
359
+ self._cam.start_sequence_acquisition(0, self.acq_job.frames)
360
+
361
+ start_time = time.perf_counter_ns()
362
+ # Continuous image capture
363
+ while self._cam.is_sequence_running() or self.mini:
364
+ # Check if there are images before trying to get one
365
+ if self._cam.image_count > 0:
366
+ self.acq_job.capture_time = (
367
+ time.perf_counter_ns() - start_time
368
+ ) / 1e6
369
+ start_time = time.perf_counter_ns()
370
+
371
+ # Get the next image from the camera
372
+ self._buffer.put(self._cam.pop_image().tobytes())
373
+ # add sensor temperature to the stack
374
+ self._temps.put(self._cam.get_temperature())
375
+ self.acq_job.frames_captured += 1
376
+
377
+ if self.acq_job.stop_threads or self.acq_job.c_event.is_set():
378
+ self._cam.stop_sequence_acquisition()
379
+ break # in case stop threads is initiated
380
+
381
+ while self._cam.image_count > 0:
382
+ self._buffer.put(self._cam.pop_image().tobytes())
383
+ self._temps.put(self.cam.get_temperature())
384
+ self.acq_job.frames_captured += 1
385
+
386
+ self.acq_job.stop_threads = True
387
+ logging.debug('Stop')
388
+ except Exception:
389
+ traceback.print_exc()
390
+ finally:
391
+ # reset flags and release resources
392
+ self._cam.acquisition = False
393
+ QtCore.QThreadPool.globalInstance().releaseThread()
394
+ return QDateTime.currentDateTime()
395
+
396
+ def getCaptureArgs(self) -> list:
397
+ '''User specific arguments to be passed to the parallelized
398
+ Camera_Panel.cam_capture function.
399
+
400
+ Returns
401
+ -------
402
+ list
403
+ list of args to be passed in order to
404
+ Camera_Panel.cam_capture function.
405
+
406
+ Raises
407
+ ------
408
+ NotImplementedError
409
+ Has to be implemented by the use in child class.
410
+ '''
411
+ args = []
412
+ return args
413
+
414
+
415
+ if __name__ == '__main__':
416
+ import os
417
+ import time
418
+
419
+ import cv2
420
+
421
+ from microEye.hardware.pycromanager.devices import (
422
+ PycroCore,
423
+ start_headless,
424
+ stop_headless,
425
+ )
426
+
427
+ mm_path = 'C:/Program Files/Micro-Manager-2.0'
428
+ config = os.path.join(mm_path, 'MMConfig_demo.cfg')
429
+ port = 4827
430
+
431
+ try:
432
+ start_headless(
433
+ mm_path,
434
+ config,
435
+ port=port,
436
+ # python_backend=True,
437
+ )
438
+
439
+ cam = PycroCamera('Camera', port=port)
440
+
441
+ app = QtWidgets.QApplication([])
442
+
443
+ panel = PycroPanel(cam)
444
+
445
+ panel.show()
446
+
447
+ app.exec()
448
+ except Exception as e:
449
+ import traceback
450
+
451
+ traceback.print_exc()
452
+ finally:
453
+ PycroCore._instances[port].close()
454
+ # Stop the camera and close the acquisition
455
+ stop_headless()
@@ -0,0 +1,18 @@
1
+ from microEye.hardware.stages.elliptec import (
2
+ ELLDevices,
3
+ ElliptecStageParams,
4
+ ElliptecView,
5
+ )
6
+ from microEye.hardware.stages.kinesis import KinesisView, KinesisXY
7
+ from microEye.hardware.stages.piezo_concept import (
8
+ PzFoc,
9
+ PzFocController,
10
+ PzFocSignals,
11
+ PzFocView,
12
+ StageParams,
13
+ )
14
+ from microEye.hardware.stages.stabilizer import (
15
+ FocusStabilizer,
16
+ FocusStabilizerParams,
17
+ FocusStabilizerView,
18
+ )
@@ -0,0 +1,5 @@
1
+ from microEye.hardware.stages.elliptec.devicesView import (
2
+ ElliptecStageParams,
3
+ ElliptecView,
4
+ )
5
+ from microEye.hardware.stages.elliptec.ellDevices import ELLDevices