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.
- microEye/__init__.py +47 -0
- microEye/_version.py +2 -0
- microEye/analysis/__init__.py +1 -0
- microEye/analysis/checklist_dialog.py +143 -0
- microEye/analysis/cmosMaps.py +228 -0
- microEye/analysis/filters/__init__.py +9 -0
- microEye/analysis/filters/base.py +21 -0
- microEye/analysis/filters/spatial.py +338 -0
- microEye/analysis/filters/temporal.py +76 -0
- microEye/analysis/fitting/__init__.py +0 -0
- microEye/analysis/fitting/fit.py +680 -0
- microEye/analysis/fitting/nena.py +375 -0
- microEye/analysis/fitting/phasor_fit.py +90 -0
- microEye/analysis/fitting/processing.py +317 -0
- microEye/analysis/fitting/psf/__init__.py +6 -0
- microEye/analysis/fitting/psf/extract.py +1129 -0
- microEye/analysis/fitting/psf/rubost_mean.py +150 -0
- microEye/analysis/fitting/psf/spline.py +167 -0
- microEye/analysis/fitting/psf/stats/__init__.py +12 -0
- microEye/analysis/fitting/psf/stats/core.py +295 -0
- microEye/analysis/fitting/psf/stats/curve_fit.py +708 -0
- microEye/analysis/fitting/psf/stats/io.py +104 -0
- microEye/analysis/fitting/psf/stats/slope_fit.py +171 -0
- microEye/analysis/fitting/psf/temp.py +147 -0
- microEye/analysis/fitting/psf/test.py +47 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUfunctions.py +657 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUmleFit_LM.py +1336 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUsplineLib.py +270 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/__init__.py +1 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUfunctions.py +609 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_EMCCD.py +1396 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_sCMOS.py +1426 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUsplineLib.py +231 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/__init__.py +2 -0
- microEye/analysis/fitting/pyfit3Dcspline/__init__.py +10 -0
- microEye/analysis/fitting/pyfit3Dcspline/constants.py +27 -0
- microEye/analysis/fitting/pyfit3Dcspline/mainfunctions.py +903 -0
- microEye/analysis/fitting/results.py +917 -0
- microEye/analysis/fitting/results_stats.py +251 -0
- microEye/analysis/fitting/tardis.py +209 -0
- microEye/analysis/multi_viewer.py +568 -0
- microEye/analysis/processing/__init__.py +1 -0
- microEye/analysis/processing/frc.py +120 -0
- microEye/analysis/rendering/__init__.py +3 -0
- microEye/analysis/rendering/base.py +452 -0
- microEye/analysis/rendering/cloud.py +215 -0
- microEye/analysis/rendering/core.py +47 -0
- microEye/analysis/rendering/volumetric.py +198 -0
- microEye/analysis/tools/__init__.py +0 -0
- microEye/analysis/tools/kymograms.py +1079 -0
- microEye/analysis/tools/roi_selectors.py +556 -0
- microEye/analysis/utils/__init__.py +3 -0
- microEye/analysis/utils/coordinates.py +18 -0
- microEye/analysis/utils/images.py +68 -0
- microEye/analysis/utils/windows.py +19 -0
- microEye/analysis/viewer/__init__.py +3 -0
- microEye/analysis/viewer/image_options_widget.py +615 -0
- microEye/analysis/viewer/images.py +1225 -0
- microEye/analysis/viewer/layers_widget.py +415 -0
- microEye/analysis/viewer/localizations.py +1304 -0
- microEye/analysis/viewer/psf.py +1003 -0
- microEye/analysis/viewer/volume.py +456 -0
- microEye/hardware/__init__.py +3 -0
- microEye/hardware/cams/__init__.py +29 -0
- microEye/hardware/cams/camera_calibration.py +99 -0
- microEye/hardware/cams/camera_list.py +528 -0
- microEye/hardware/cams/camera_options.py +694 -0
- microEye/hardware/cams/camera_panel.py +941 -0
- microEye/hardware/cams/dummy/__init__.py +1 -0
- microEye/hardware/cams/dummy/dummy_panel.py +759 -0
- microEye/hardware/cams/jobs.py +497 -0
- microEye/hardware/cams/line_profiler.py +99 -0
- microEye/hardware/cams/linescan/IR_Cam.py +474 -0
- microEye/hardware/cams/linescan/__init__.py +1 -0
- microEye/hardware/cams/micam.py +524 -0
- microEye/hardware/cams/pco/__init__.py +58 -0
- microEye/hardware/cams/pco/enums.py +382 -0
- microEye/hardware/cams/pco/pco_cam.py +761 -0
- microEye/hardware/cams/pco/pco_panel.py +477 -0
- microEye/hardware/cams/shortcuts.py +312 -0
- microEye/hardware/cams/thorlabs/__init__.py +1 -0
- microEye/hardware/cams/thorlabs/thorlabs.py +1508 -0
- microEye/hardware/cams/thorlabs/thorlabs_panel.py +850 -0
- microEye/hardware/cams/ueye/__init__.py +1 -0
- microEye/hardware/cams/ueye/ueye_camera.py +1023 -0
- microEye/hardware/cams/ueye/ueye_panel.py +861 -0
- microEye/hardware/cams/vimba/__init__.py +1 -0
- microEye/hardware/cams/vimba/vimba_cam.py +1000 -0
- microEye/hardware/cams/vimba/vimba_panel.py +813 -0
- microEye/hardware/device.py +60 -0
- microEye/hardware/lasers/__init__.py +13 -0
- microEye/hardware/lasers/io_matchbox.py +791 -0
- microEye/hardware/lasers/io_params.py +85 -0
- microEye/hardware/lasers/io_single_laser.py +742 -0
- microEye/hardware/lasers/laser_relay.py +594 -0
- microEye/hardware/mieye/__init__.py +1 -0
- microEye/hardware/mieye/acquisition_manager.py +467 -0
- microEye/hardware/mieye/devices_manager.py +533 -0
- microEye/hardware/mieye/miEye.py +659 -0
- microEye/hardware/misc/__init__.py +0 -0
- microEye/hardware/misc/acquisition_view.py +71 -0
- microEye/hardware/misc/reglo.py +761 -0
- microEye/hardware/misc/temp.py +188 -0
- microEye/hardware/port_config.py +59 -0
- microEye/hardware/protocols/__init__.py +2 -0
- microEye/hardware/protocols/actions.py +402 -0
- microEye/hardware/protocols/actions_items.py +703 -0
- microEye/hardware/protocols/designer.py +244 -0
- microEye/hardware/protocols/scene_manager.py +191 -0
- microEye/hardware/protocols/serialization.py +97 -0
- microEye/hardware/pycromanager/__init__.py +16 -0
- microEye/hardware/pycromanager/core.py +1433 -0
- microEye/hardware/pycromanager/devices.py +461 -0
- microEye/hardware/pycromanager/enums.py +107 -0
- microEye/hardware/pycromanager/headless.py +153 -0
- microEye/hardware/pycromanager/utils.py +34 -0
- microEye/hardware/pycromanager/widgets/__init__.py +5 -0
- microEye/hardware/pycromanager/widgets/bridges.py +407 -0
- microEye/hardware/pycromanager/widgets/headless_manager.py +258 -0
- microEye/hardware/pycromanager/widgets/headless_options.py +224 -0
- microEye/hardware/pycromanager/widgets/pycro_panel.py +455 -0
- microEye/hardware/stages/__init__.py +18 -0
- microEye/hardware/stages/elliptec/__init__.py +5 -0
- microEye/hardware/stages/elliptec/baseDevice.py +314 -0
- microEye/hardware/stages/elliptec/device.py +384 -0
- microEye/hardware/stages/elliptec/deviceID.py +212 -0
- microEye/hardware/stages/elliptec/devicePort.py +379 -0
- microEye/hardware/stages/elliptec/deviceStatus.py +65 -0
- microEye/hardware/stages/elliptec/devicesView.py +706 -0
- microEye/hardware/stages/elliptec/ellDevices.py +134 -0
- microEye/hardware/stages/elliptec/messageUpdater.py +34 -0
- microEye/hardware/stages/elliptec/motorInfo.py +153 -0
- microEye/hardware/stages/elliptec/stage.py +62 -0
- microEye/hardware/stages/elliptec/test.py +139 -0
- microEye/hardware/stages/kinesis/__init__.py +1 -0
- microEye/hardware/stages/kinesis/kdc101/__init__.py +1 -0
- microEye/hardware/stages/kinesis/kdc101/enums.py +1002 -0
- microEye/hardware/stages/kinesis/kdc101/factory.py +171 -0
- microEye/hardware/stages/kinesis/kdc101/kdc101.py +718 -0
- microEye/hardware/stages/kinesis/kinesis.py +776 -0
- microEye/hardware/stages/piezo_concept.py +607 -0
- microEye/hardware/stages/stabilizer.py +785 -0
- microEye/hardware/stages/stage.py +89 -0
- microEye/hardware/widgets/__init__.py +10 -0
- microEye/hardware/widgets/controller.py +246 -0
- microEye/hardware/widgets/devices.py +133 -0
- microEye/hardware/widgets/focusWidget.py +264 -0
- microEye/hardware/widgets/qlist_slider.py +113 -0
- microEye/hardware/widgets/scan_acquisition.py +424 -0
- microEye/icons/1024.png +0 -0
- microEye/icons/128.png +0 -0
- microEye/icons/16.png +0 -0
- microEye/icons/24.png +0 -0
- microEye/icons/256.png +0 -0
- microEye/icons/32.png +0 -0
- microEye/icons/48.png +0 -0
- microEye/icons/512.png +0 -0
- microEye/icons/64.png +0 -0
- microEye/icons/__init__.py +0 -0
- microEye/icons/close.svg +88 -0
- microEye/icons/mieye.png +0 -0
- microEye/icons/min.svg +83 -0
- microEye/icons/viewer.png +0 -0
- microEye/launcher.py +42 -0
- microEye/qt.py +181 -0
- microEye/utils/__init__.py +2 -0
- microEye/utils/enum_encoder.py +10 -0
- microEye/utils/expandable_groupbox.py +93 -0
- microEye/utils/gui_helper.py +457 -0
- microEye/utils/hid/__init__.py +8 -0
- microEye/utils/hid/controller.py +153 -0
- microEye/utils/hid/device.py +63 -0
- microEye/utils/hid/enums.py +140 -0
- microEye/utils/hid/utils.py +58 -0
- microEye/utils/labelled_slider.py +134 -0
- microEye/utils/metadata.py +599 -0
- microEye/utils/metadata_tree.py +718 -0
- microEye/utils/micro_launcher.py +245 -0
- microEye/utils/parameter_tree.py +325 -0
- microEye/utils/pyscripting.py +444 -0
- microEye/utils/retry_exec.py +35 -0
- microEye/utils/start_gui.py +112 -0
- microEye/utils/thread_worker.py +115 -0
- microEye/utils/uImage.py +1512 -0
- microeye-2.3.2.dist-info/METADATA +401 -0
- microeye-2.3.2.dist-info/RECORD +190 -0
- microeye-2.3.2.dist-info/WHEEL +5 -0
- microeye-2.3.2.dist-info/entry_points.txt +2 -0
- microeye-2.3.2.dist-info/licenses/LICENSE +674 -0
- microeye-2.3.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import traceback
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
from microEye.analysis.tools.roi_selectors import (
|
|
6
|
+
MultiRectangularROISelector,
|
|
7
|
+
convert_pos_size_to_rois,
|
|
8
|
+
convert_rois_to_pos_size,
|
|
9
|
+
)
|
|
10
|
+
from microEye.hardware.cams.camera_options import CamParams
|
|
11
|
+
from microEye.hardware.cams.camera_panel import Camera_Panel
|
|
12
|
+
from microEye.hardware.cams.vimba.vimba_cam import vimba_cam
|
|
13
|
+
from microEye.qt import QDateTime, QtCore, QtWidgets, getOpenFileName, getSaveFileName
|
|
14
|
+
from microEye.utils.gui_helper import get_scaling_factor
|
|
15
|
+
from microEye.utils.metadata_tree import MetaParams
|
|
16
|
+
from microEye.utils.thread_worker import QThreadWorker
|
|
17
|
+
from microEye.utils.uImage import uImage
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
import vimba as vb
|
|
21
|
+
except Exception:
|
|
22
|
+
vb = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class VimbaParams(Enum):
|
|
26
|
+
FREERUN = 'Acquisition.Freerun'
|
|
27
|
+
STOP = 'Acquisition.Stop'
|
|
28
|
+
EXPOSURE_MODE = 'Acquisition Settings.Exposure Mode'
|
|
29
|
+
EXPOSURE_AUTO = 'Acquisition Settings.Exposure Auto'
|
|
30
|
+
FRAMERATE_ENABLED = 'Acquisition Settings.Frame Rate Enabled'
|
|
31
|
+
FRAMERATE = 'Acquisition Settings.Frame Rate'
|
|
32
|
+
TRIGGER_MODE = 'Acquisition Settings.Trigger Mode'
|
|
33
|
+
TRIGGER_SOURCE = 'Acquisition Settings.Trigger Source'
|
|
34
|
+
TRIGGER_SELECTOR = 'Acquisition Settings.Trigger Selector'
|
|
35
|
+
TRIGGER_ACTIVATION = 'Acquisition Settings.Trigger Activation'
|
|
36
|
+
PIXEL_FORMAT = 'Acquisition Settings.Pixel Format'
|
|
37
|
+
LOAD = 'Acquisition Settings.Load Config'
|
|
38
|
+
SAVE = 'Acquisition Settings.Save Config'
|
|
39
|
+
LINE_SELECTOR = 'GPIOs.Line Selector'
|
|
40
|
+
LINE_MODE = 'GPIOs.Line Mode'
|
|
41
|
+
LINE_SOURCE = 'GPIOs.Line Source'
|
|
42
|
+
LINE_INVERTER = 'GPIOs.Line Inverter'
|
|
43
|
+
SET_IO_CONFIG = 'GPIOs.Set IO Config'
|
|
44
|
+
TIMER_SELECTOR = 'Timers.Timer Selector'
|
|
45
|
+
TIMER_ACTIVATION = 'Timers.Timer Activation'
|
|
46
|
+
TIMER_SOURCE = 'Timers.Timer Source'
|
|
47
|
+
TIMER_DELAY = 'Timers.Timer Delay'
|
|
48
|
+
TIMER_DURATION = 'Timers.Timer Duration'
|
|
49
|
+
TIMER_RESET = 'Timers.Timer Reset'
|
|
50
|
+
SET_TIMER_CONFIG = 'Timers.Set Timer Config'
|
|
51
|
+
|
|
52
|
+
def __str__(self):
|
|
53
|
+
'''
|
|
54
|
+
Return the last part of the enum value (Param name).
|
|
55
|
+
'''
|
|
56
|
+
return self.value.split('.')[-1]
|
|
57
|
+
|
|
58
|
+
def get_path(self):
|
|
59
|
+
'''
|
|
60
|
+
Return the full parameter path.
|
|
61
|
+
'''
|
|
62
|
+
return self.value.split('.')
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class Vimba_Panel(Camera_Panel):
|
|
66
|
+
'''
|
|
67
|
+
A Qt Widget for controlling an Allied Vision Camera through Vimba
|
|
68
|
+
| Inherits Camera_Panel
|
|
69
|
+
'''
|
|
70
|
+
PARAMS = VimbaParams
|
|
71
|
+
|
|
72
|
+
def __init__(self, cam: vimba_cam, mini=False, *args, **kwargs):
|
|
73
|
+
'''
|
|
74
|
+
Initializes a new Vimba_Panel Qt widget.
|
|
75
|
+
|
|
76
|
+
Inherits Camera_Panel.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
cam : vimba_cam
|
|
81
|
+
Vimba Camera python adapter.
|
|
82
|
+
|
|
83
|
+
mini : bool, optional
|
|
84
|
+
Flag indicating if this is a mini camera panel, by default False.
|
|
85
|
+
|
|
86
|
+
Other Parameters
|
|
87
|
+
---------------
|
|
88
|
+
*args
|
|
89
|
+
Arguments to pass to the Camera_Panel constructor.
|
|
90
|
+
|
|
91
|
+
**kwargs
|
|
92
|
+
Keyword arguments to pass to the Camera_Panel constructor.
|
|
93
|
+
'''
|
|
94
|
+
super().__init__(cam, mini, *args, **kwargs)
|
|
95
|
+
|
|
96
|
+
self.OME_tab.set_param_value(MetaParams.CHANNEL_NAME, self._cam.name)
|
|
97
|
+
self.OME_tab.set_param_value(MetaParams.DET_MANUFACTURER, 'Allied Vision')
|
|
98
|
+
self.OME_tab.set_param_value(MetaParams.DET_MODEL, self._cam.cam.get_model())
|
|
99
|
+
self.OME_tab.set_param_value(MetaParams.DET_SERIAL, self._cam.cam.get_serial())
|
|
100
|
+
self.OME_tab.set_param_value(MetaParams.DET_TYPE, 'CMOS')
|
|
101
|
+
|
|
102
|
+
# exposure init
|
|
103
|
+
exposure = self.camera_options.get_param(CamParams.EXPOSURE)
|
|
104
|
+
exposure.setLimits((self._cam.exposure_range[0], self._cam.exposure_range[1]))
|
|
105
|
+
exposure.setOpts(
|
|
106
|
+
step=self._cam.exposure_increment, suffix=self._cam.exposure_unit
|
|
107
|
+
)
|
|
108
|
+
exposure.setValue(self._cam.exposure_current)
|
|
109
|
+
exposure.sigValueChanged.connect(self.exposure_spin_changed)
|
|
110
|
+
|
|
111
|
+
# exposure mode combobox
|
|
112
|
+
exposure_mode = {
|
|
113
|
+
'name': str(VimbaParams.EXPOSURE_MODE),
|
|
114
|
+
'type': 'list',
|
|
115
|
+
'limits': self._cam.exposure_modes[0],
|
|
116
|
+
}
|
|
117
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, exposure_mode)
|
|
118
|
+
# for x in range(len(self._cam.exposure_modes[2])):
|
|
119
|
+
# self.cam_exposure_mode_cbox.setItemData(
|
|
120
|
+
# x, self._cam.exposure_modes[2][x], Qt.ToolTipRole)
|
|
121
|
+
self.camera_options.get_param(
|
|
122
|
+
VimbaParams.EXPOSURE_MODE
|
|
123
|
+
).sigValueChanged.connect(
|
|
124
|
+
lambda: self.cam_cbox_changed(VimbaParams.EXPOSURE_MODE)
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# exposure auto mode combobox
|
|
128
|
+
exposure_auto = {
|
|
129
|
+
'name': str(VimbaParams.EXPOSURE_AUTO),
|
|
130
|
+
'type': 'list',
|
|
131
|
+
'limits': self._cam.exposure_auto_entries[0],
|
|
132
|
+
}
|
|
133
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, exposure_auto)
|
|
134
|
+
# for x in range(len(self._cam.exposure_auto_entries[2])):
|
|
135
|
+
# self.cam_exposure_auto_cbox.setItemData(
|
|
136
|
+
# x, self._cam.exposure_auto_entries[2][x], Qt.ToolTipRole)
|
|
137
|
+
self.camera_options.get_param(
|
|
138
|
+
VimbaParams.EXPOSURE_AUTO
|
|
139
|
+
).sigValueChanged.connect(
|
|
140
|
+
lambda: self.cam_cbox_changed(VimbaParams.EXPOSURE_AUTO)
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Frame Rate
|
|
144
|
+
framerate_enabled = {
|
|
145
|
+
'name': str(VimbaParams.FRAMERATE_ENABLED),
|
|
146
|
+
'type': 'bool',
|
|
147
|
+
'value': False,
|
|
148
|
+
}
|
|
149
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, framerate_enabled)
|
|
150
|
+
self.camera_options.get_param(
|
|
151
|
+
VimbaParams.FRAMERATE_ENABLED
|
|
152
|
+
).sigStateChanged.connect(self.cam_framerate_changed)
|
|
153
|
+
|
|
154
|
+
framerate = {
|
|
155
|
+
'name': str(VimbaParams.FRAMERATE),
|
|
156
|
+
'type': 'float',
|
|
157
|
+
'value': self._cam.frameRate,
|
|
158
|
+
'dec': False,
|
|
159
|
+
'decimals': 6,
|
|
160
|
+
'step': 0.1,
|
|
161
|
+
'limits': [self._cam.frameRate_range[0], self._cam.frameRate_range[1]],
|
|
162
|
+
'suffix': self._cam.frameRate_unit,
|
|
163
|
+
'enabled': False,
|
|
164
|
+
}
|
|
165
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, framerate)
|
|
166
|
+
self.camera_options.get_param(VimbaParams.FRAMERATE).sigValueChanged.connect(
|
|
167
|
+
self.framerate_spin_changed
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# trigger mode combobox
|
|
171
|
+
trigger_mode = {
|
|
172
|
+
'name': str(VimbaParams.TRIGGER_MODE),
|
|
173
|
+
'type': 'list',
|
|
174
|
+
'limits': self._cam.trigger_modes[0],
|
|
175
|
+
}
|
|
176
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, trigger_mode)
|
|
177
|
+
# for x in range(len(self._cam.trigger_modes[2])):
|
|
178
|
+
# self.cam_trigger_mode_cbox.setItemData(
|
|
179
|
+
# x, self._cam.trigger_modes[2][x], Qt.ToolTipRole)
|
|
180
|
+
self.camera_options.get_param(VimbaParams.TRIGGER_MODE).sigValueChanged.connect(
|
|
181
|
+
lambda: self.cam_cbox_changed(VimbaParams.TRIGGER_MODE)
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
# trigger source combobox
|
|
185
|
+
trigger_source = {
|
|
186
|
+
'name': str(VimbaParams.TRIGGER_SOURCE),
|
|
187
|
+
'type': 'list',
|
|
188
|
+
'limits': self._cam.trigger_sources[0],
|
|
189
|
+
}
|
|
190
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, trigger_source)
|
|
191
|
+
# for x in range(len(self._cam.trigger_sources[2])):
|
|
192
|
+
# self.cam_trigger_source_cbox.setItemData(
|
|
193
|
+
# x, self._cam.trigger_sources[2][x], Qt.ToolTipRole)
|
|
194
|
+
self.camera_options.get_param(
|
|
195
|
+
VimbaParams.TRIGGER_SOURCE
|
|
196
|
+
).sigValueChanged.connect(
|
|
197
|
+
lambda: self.cam_cbox_changed(VimbaParams.TRIGGER_SOURCE)
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
# trigger selector combobox
|
|
201
|
+
trigger_selector = {
|
|
202
|
+
'name': str(VimbaParams.TRIGGER_SELECTOR),
|
|
203
|
+
'type': 'list',
|
|
204
|
+
'limits': self._cam.trigger_selectors[0],
|
|
205
|
+
}
|
|
206
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, trigger_selector)
|
|
207
|
+
# for x in range(len(self._cam.trigger_selectors[2])):
|
|
208
|
+
# self.cam_trigger_selector_cbox.setItemData(
|
|
209
|
+
# x, self._cam.trigger_selectors[2][x], Qt.ToolTipRole)
|
|
210
|
+
self.camera_options.get_param(
|
|
211
|
+
VimbaParams.TRIGGER_SELECTOR
|
|
212
|
+
).sigValueChanged.connect(
|
|
213
|
+
lambda: self.cam_cbox_changed(VimbaParams.TRIGGER_SELECTOR)
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# trigger activation combobox
|
|
217
|
+
trigger_activation = {
|
|
218
|
+
'name': str(VimbaParams.TRIGGER_ACTIVATION),
|
|
219
|
+
'type': 'list',
|
|
220
|
+
'limits': self._cam.trigger_activations[0],
|
|
221
|
+
}
|
|
222
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, trigger_activation)
|
|
223
|
+
# for x in range(len(self._cam.trigger_activations[2])):
|
|
224
|
+
# self.cam_trigger_activation_cbox.setItemData(
|
|
225
|
+
# x, self._cam.trigger_activations[2][x], Qt.ToolTipRole)
|
|
226
|
+
self.camera_options.get_param(
|
|
227
|
+
VimbaParams.TRIGGER_ACTIVATION
|
|
228
|
+
).sigValueChanged.connect(
|
|
229
|
+
lambda: self.cam_cbox_changed(VimbaParams.TRIGGER_ACTIVATION)
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# pixel formats combobox
|
|
233
|
+
pixel_format = {
|
|
234
|
+
'name': str(VimbaParams.PIXEL_FORMAT),
|
|
235
|
+
'type': 'list',
|
|
236
|
+
'limits': self._cam.pixel_formats,
|
|
237
|
+
}
|
|
238
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, pixel_format)
|
|
239
|
+
self.camera_options.get_param(VimbaParams.PIXEL_FORMAT).sigValueChanged.connect(
|
|
240
|
+
lambda: self.cam_cbox_changed(VimbaParams.PIXEL_FORMAT)
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
# start freerun mode button
|
|
244
|
+
freerun = self.get_event_action(VimbaParams.FREERUN)
|
|
245
|
+
self.camera_options.add_param_child(CamParams.ACQUISITION, freerun)
|
|
246
|
+
self.camera_options.get_param(VimbaParams.FREERUN).sigActivated.connect(
|
|
247
|
+
self.start_free_run
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
# stop acquisition button
|
|
251
|
+
stop = {'name': str(VimbaParams.STOP), 'type': 'action'}
|
|
252
|
+
self.camera_options.add_param_child(CamParams.ACQUISITION, stop)
|
|
253
|
+
self.camera_options.get_param(VimbaParams.STOP).sigActivated.connect(self.stop)
|
|
254
|
+
|
|
255
|
+
# config buttons
|
|
256
|
+
load = {'name': str(VimbaParams.LOAD), 'type': 'action'}
|
|
257
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, load)
|
|
258
|
+
self.camera_options.get_param(VimbaParams.LOAD).sigActivated.connect(
|
|
259
|
+
self.load_config
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
save = {'name': str(VimbaParams.SAVE), 'type': 'action'}
|
|
263
|
+
self.camera_options.add_param_child(CamParams.ACQ_SETTINGS, save)
|
|
264
|
+
self.camera_options.get_param(VimbaParams.SAVE).sigActivated.connect(
|
|
265
|
+
self.save_config
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
# ROI
|
|
269
|
+
self.camera_options.set_roi_limits(
|
|
270
|
+
(0, self.cam.width_range[1]),
|
|
271
|
+
(0, self.cam.height_range[1]),
|
|
272
|
+
(self.cam.width_range[0], self.cam.width_range[1]),
|
|
273
|
+
(self.cam.height_range[0], self.cam.height_range[1]),
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# GPIOs
|
|
277
|
+
lineSelector = {'name': str(VimbaParams.LINE_SELECTOR), 'type': 'list'}
|
|
278
|
+
lineMode = {'name': str(VimbaParams.LINE_MODE), 'type': 'list'}
|
|
279
|
+
lineSource = {'name': str(VimbaParams.LINE_SOURCE), 'type': 'list'}
|
|
280
|
+
lineInverter = {
|
|
281
|
+
'name': str(VimbaParams.LINE_INVERTER),
|
|
282
|
+
'type': 'bool',
|
|
283
|
+
'value': False,
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
with self._cam.cam:
|
|
287
|
+
lineSelector['limits'] = self.cam.get_io_lines()
|
|
288
|
+
lineMode['limits'] = self.cam.get_line_modes()
|
|
289
|
+
lineSource['limits'] = self.cam.get_line_sources()
|
|
290
|
+
|
|
291
|
+
self.camera_options.add_param_child(CamParams.CAMERA_GPIO, lineSelector)
|
|
292
|
+
self.camera_options.add_param_child(CamParams.CAMERA_GPIO, lineMode)
|
|
293
|
+
self.camera_options.add_param_child(CamParams.CAMERA_GPIO, lineSource)
|
|
294
|
+
self.camera_options.add_param_child(CamParams.CAMERA_GPIO, lineInverter)
|
|
295
|
+
|
|
296
|
+
self.camera_options.get_param(
|
|
297
|
+
VimbaParams.LINE_SELECTOR
|
|
298
|
+
).sigValueChanged.connect(self.io_line_changed)
|
|
299
|
+
|
|
300
|
+
set_io_config = {'name': str(VimbaParams.SET_IO_CONFIG), 'type': 'action'}
|
|
301
|
+
self.camera_options.add_param_child(CamParams.CAMERA_GPIO, set_io_config)
|
|
302
|
+
self.camera_options.get_param(VimbaParams.SET_IO_CONFIG).sigActivated.connect(
|
|
303
|
+
self.set_io_line_config
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
# Timers
|
|
307
|
+
timerSelector = {'name': str(VimbaParams.TIMER_SELECTOR), 'type': 'list'}
|
|
308
|
+
timerActivation = {'name': str(VimbaParams.TIMER_ACTIVATION), 'type': 'list'}
|
|
309
|
+
timerSource = {'name': str(VimbaParams.TIMER_SOURCE), 'type': 'list'}
|
|
310
|
+
timerDelay = {
|
|
311
|
+
'name': str(VimbaParams.TIMER_DELAY),
|
|
312
|
+
'type': 'float',
|
|
313
|
+
'dec': False,
|
|
314
|
+
'decimals': 6,
|
|
315
|
+
}
|
|
316
|
+
timerDuration = {
|
|
317
|
+
'name': str(VimbaParams.TIMER_DURATION),
|
|
318
|
+
'type': 'float',
|
|
319
|
+
'dec': False,
|
|
320
|
+
'decimals': 6,
|
|
321
|
+
}
|
|
322
|
+
timerReset = {'name': str(VimbaParams.TIMER_RESET), 'type': 'action'}
|
|
323
|
+
set_timer_config = {'name': str(VimbaParams.SET_TIMER_CONFIG), 'type': 'action'}
|
|
324
|
+
|
|
325
|
+
with self._cam.cam:
|
|
326
|
+
timers = self.cam.get_timers()
|
|
327
|
+
if timers:
|
|
328
|
+
timerSelector['limits'] = timers
|
|
329
|
+
timerActivation['limits'] = self.cam.get_timer_trigger_activations()
|
|
330
|
+
timerSource['limits'] = self.cam.get_timer_trigger_sources()
|
|
331
|
+
|
|
332
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, timerSelector)
|
|
333
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, timerActivation)
|
|
334
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, timerSource)
|
|
335
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, timerDelay)
|
|
336
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, timerDuration)
|
|
337
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, timerReset)
|
|
338
|
+
self.camera_options.add_param_child(CamParams.CAMERA_TIMERS, set_timer_config)
|
|
339
|
+
|
|
340
|
+
def reset_timer():
|
|
341
|
+
with self._cam.cam:
|
|
342
|
+
self.cam.reset_timer()
|
|
343
|
+
|
|
344
|
+
def update_timer():
|
|
345
|
+
with self._cam.cam:
|
|
346
|
+
timer = self.camera_options.get_param_value(VimbaParams.TIMER_SELECTOR)
|
|
347
|
+
self.cam.select_timer(timer)
|
|
348
|
+
delay = self.cam.get_timer_delay()
|
|
349
|
+
duration = self.cam.get_timer_duration()
|
|
350
|
+
|
|
351
|
+
delay_param = self.camera_options.get_param(VimbaParams.TIMER_DELAY)
|
|
352
|
+
delay_param.setLimits((delay[1][0], delay[1][1]))
|
|
353
|
+
delay_param.setValue(delay[0])
|
|
354
|
+
|
|
355
|
+
duration_param = self.camera_options.get_param(
|
|
356
|
+
VimbaParams.TIMER_DURATION
|
|
357
|
+
)
|
|
358
|
+
duration_param.setLimits((duration[1][0], duration[1][1]))
|
|
359
|
+
duration_param.setValue(duration[0])
|
|
360
|
+
|
|
361
|
+
self.camera_options.set_param_value(
|
|
362
|
+
VimbaParams.TIMER_ACTIVATION,
|
|
363
|
+
self.cam.get_timer_trigger_activation(),
|
|
364
|
+
)
|
|
365
|
+
self.camera_options.set_param_value(
|
|
366
|
+
VimbaParams.TIMER_SOURCE, self.cam.get_timer_trigger_source()
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
def set_timer():
|
|
370
|
+
with self._cam.cam:
|
|
371
|
+
timer = self.camera_options.get_param_value(VimbaParams.TIMER_SELECTOR)
|
|
372
|
+
self.cam.select_timer(timer)
|
|
373
|
+
act = self.camera_options.get_param_value(VimbaParams.TIMER_ACTIVATION)
|
|
374
|
+
source = self.camera_options.get_param_value(VimbaParams.TIMER_SOURCE)
|
|
375
|
+
self.cam.set_timer_trigger_activation(act)
|
|
376
|
+
self.cam.set_timer_trigger_source(source)
|
|
377
|
+
self.cam.set_timer_duration(
|
|
378
|
+
self.camera_options.get_param_value(VimbaParams.TIMER_DURATION)
|
|
379
|
+
)
|
|
380
|
+
self.cam.set_timer_delay(
|
|
381
|
+
self.camera_options.get_param_value(VimbaParams.TIMER_DELAY)
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
self.camera_options.get_param(
|
|
385
|
+
VimbaParams.TIMER_SELECTOR
|
|
386
|
+
).sigValueChanged.connect(update_timer)
|
|
387
|
+
self.camera_options.get_param(VimbaParams.TIMER_RESET).sigActivated.connect(
|
|
388
|
+
reset_timer
|
|
389
|
+
)
|
|
390
|
+
self.camera_options.get_param(
|
|
391
|
+
VimbaParams.SET_TIMER_CONFIG
|
|
392
|
+
).sigActivated.connect(set_timer)
|
|
393
|
+
|
|
394
|
+
@property
|
|
395
|
+
def cam(self):
|
|
396
|
+
'''The vimba_cam property.
|
|
397
|
+
|
|
398
|
+
Returns
|
|
399
|
+
-------
|
|
400
|
+
vimba_cam
|
|
401
|
+
the cam property value
|
|
402
|
+
'''
|
|
403
|
+
return self._cam
|
|
404
|
+
|
|
405
|
+
@cam.setter
|
|
406
|
+
def cam(self, cam: vimba_cam):
|
|
407
|
+
'''The vimba_cam property.
|
|
408
|
+
|
|
409
|
+
Parameters
|
|
410
|
+
----------
|
|
411
|
+
cam : vimba_cam
|
|
412
|
+
the vimba_cam to set as panel camera.
|
|
413
|
+
'''
|
|
414
|
+
self._cam = cam
|
|
415
|
+
|
|
416
|
+
def setExposure(self, value):
|
|
417
|
+
'''Sets the exposure time widget of camera
|
|
418
|
+
|
|
419
|
+
Parameters
|
|
420
|
+
----------
|
|
421
|
+
value : float
|
|
422
|
+
selected exposure time
|
|
423
|
+
'''
|
|
424
|
+
super().setExposure(value * 1e3)
|
|
425
|
+
|
|
426
|
+
def set_ROI(self):
|
|
427
|
+
'''Sets the ROI for the slected vimba_cam'''
|
|
428
|
+
if self.cam.acquisition:
|
|
429
|
+
QtWidgets.QMessageBox.warning(
|
|
430
|
+
self, 'Warning', 'Cannot set ROI while acquiring images!'
|
|
431
|
+
)
|
|
432
|
+
return # if acquisition is already going on
|
|
433
|
+
|
|
434
|
+
with self._cam.cam:
|
|
435
|
+
self.cam.set_roi(*self.camera_options.get_roi_info(True))
|
|
436
|
+
|
|
437
|
+
self.cam.get_roi()
|
|
438
|
+
|
|
439
|
+
self.camera_options.set_roi_info(
|
|
440
|
+
int(self.cam.offsetX),
|
|
441
|
+
int(self.cam.offsetY),
|
|
442
|
+
int(self.cam.width),
|
|
443
|
+
int(self.cam.height),
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
self.refresh_framerate()
|
|
447
|
+
|
|
448
|
+
def reset_ROI(self):
|
|
449
|
+
'''Resets the ROI for the slected IDS_Camera'''
|
|
450
|
+
if self.cam.acquisition:
|
|
451
|
+
QtWidgets.QMessageBox.warning(
|
|
452
|
+
self, 'Warning', 'Cannot reset ROI while acquiring images!'
|
|
453
|
+
)
|
|
454
|
+
return # if acquisition is already going on
|
|
455
|
+
|
|
456
|
+
with self._cam.cam:
|
|
457
|
+
self.cam.set_roi(self.cam.width_max, self.cam.height_max)
|
|
458
|
+
|
|
459
|
+
self.cam.get_roi()
|
|
460
|
+
|
|
461
|
+
self.camera_options.set_roi_info(
|
|
462
|
+
0, 0, int(self.cam.width), int(self.cam.height)
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
self.refresh_framerate()
|
|
466
|
+
|
|
467
|
+
def center_ROI(self):
|
|
468
|
+
'''Sets the ROI for the slected vimba_cam'''
|
|
469
|
+
if self.cam.acquisition:
|
|
470
|
+
QtWidgets.QMessageBox.warning(
|
|
471
|
+
self, 'Warning', 'Cannot set ROI while acquiring images!'
|
|
472
|
+
)
|
|
473
|
+
return # if acquisition is already going on
|
|
474
|
+
|
|
475
|
+
with self._cam.cam:
|
|
476
|
+
self.cam.set_roi(*self.camera_options.get_roi_info(True)[:2])
|
|
477
|
+
|
|
478
|
+
self.camera_options.set_roi_info(
|
|
479
|
+
self.cam.offsetX, self.cam.offsetY, self.cam.width, self.cam.height
|
|
480
|
+
)
|
|
481
|
+
|
|
482
|
+
self.refresh_framerate()
|
|
483
|
+
|
|
484
|
+
def select_ROI(self):
|
|
485
|
+
'''
|
|
486
|
+
Opens a dialog to select a ROI from the last image.
|
|
487
|
+
'''
|
|
488
|
+
if self.cam.acquisition:
|
|
489
|
+
QtWidgets.QMessageBox.warning(
|
|
490
|
+
self, 'Warning', 'Cannot set ROI while acquiring images!'
|
|
491
|
+
)
|
|
492
|
+
return # if acquisition is already going on
|
|
493
|
+
|
|
494
|
+
if self.acq_job is not None:
|
|
495
|
+
try:
|
|
496
|
+
|
|
497
|
+
def work_func(**kwargs):
|
|
498
|
+
try:
|
|
499
|
+
image = uImage(self.acq_job.frame.image)
|
|
500
|
+
|
|
501
|
+
image.equalizeLUT(nLUT=True)
|
|
502
|
+
|
|
503
|
+
scale_factor = get_scaling_factor(image.height, image.width)
|
|
504
|
+
|
|
505
|
+
selector = MultiRectangularROISelector.get_selector(
|
|
506
|
+
image._view, scale_factor, max_rois=1
|
|
507
|
+
)
|
|
508
|
+
# if old_rois:
|
|
509
|
+
# selector.rois = old_rois
|
|
510
|
+
|
|
511
|
+
rois = selector.select_rectangular_rois()
|
|
512
|
+
|
|
513
|
+
rois = convert_rois_to_pos_size(rois)
|
|
514
|
+
|
|
515
|
+
if len(rois) > 0:
|
|
516
|
+
return rois[0]
|
|
517
|
+
else:
|
|
518
|
+
return None
|
|
519
|
+
except Exception:
|
|
520
|
+
traceback.print_exc()
|
|
521
|
+
return None
|
|
522
|
+
|
|
523
|
+
def done(result: list):
|
|
524
|
+
if result is not None:
|
|
525
|
+
# x, y, w, h = result
|
|
526
|
+
self.camera_options.set_roi_info(*result)
|
|
527
|
+
|
|
528
|
+
self.worker = QThreadWorker(work_func)
|
|
529
|
+
self.worker.signals.result.connect(done)
|
|
530
|
+
# Execute
|
|
531
|
+
self._threadpool.start(self.worker)
|
|
532
|
+
except Exception:
|
|
533
|
+
traceback.print_exc()
|
|
534
|
+
|
|
535
|
+
def select_ROIs(self):
|
|
536
|
+
'''
|
|
537
|
+
Opens a dialog to select multiple ROIs from the last image.
|
|
538
|
+
'''
|
|
539
|
+
if self.cam.acquisition:
|
|
540
|
+
QtWidgets.QMessageBox.warning(
|
|
541
|
+
self, 'Warning', 'Cannot set ROI while acquiring images!'
|
|
542
|
+
)
|
|
543
|
+
return # if acquisition is already going on
|
|
544
|
+
|
|
545
|
+
if self.acq_job is not None:
|
|
546
|
+
try:
|
|
547
|
+
|
|
548
|
+
def work_func(**kwargs):
|
|
549
|
+
try:
|
|
550
|
+
image = uImage(self.acq_job.frame.image)
|
|
551
|
+
|
|
552
|
+
image.equalizeLUT(nLUT=True)
|
|
553
|
+
|
|
554
|
+
scale_factor = get_scaling_factor(image.height, image.width)
|
|
555
|
+
|
|
556
|
+
selector = MultiRectangularROISelector.get_selector(
|
|
557
|
+
image._view, scale_factor, max_rois=4, one_size=True
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
old_rois = self.camera_options.get_export_rois()
|
|
561
|
+
|
|
562
|
+
if len(old_rois) > 0:
|
|
563
|
+
old_rois = convert_pos_size_to_rois(old_rois)
|
|
564
|
+
selector.rois = old_rois
|
|
565
|
+
|
|
566
|
+
rois = selector.select_rectangular_rois()
|
|
567
|
+
|
|
568
|
+
rois = convert_rois_to_pos_size(rois)
|
|
569
|
+
|
|
570
|
+
if len(rois) > 0:
|
|
571
|
+
return rois
|
|
572
|
+
else:
|
|
573
|
+
return None
|
|
574
|
+
except Exception:
|
|
575
|
+
traceback.print_exc()
|
|
576
|
+
return None
|
|
577
|
+
|
|
578
|
+
def done(results: list[list]):
|
|
579
|
+
if results is not None:
|
|
580
|
+
rois_param = self.camera_options.get_param(
|
|
581
|
+
CamParams.EXPORTED_ROIS
|
|
582
|
+
)
|
|
583
|
+
rois_param.clearChildren()
|
|
584
|
+
for x, y, w, h in results:
|
|
585
|
+
self.camera_options.add_param_child(
|
|
586
|
+
CamParams.EXPORTED_ROIS,
|
|
587
|
+
{
|
|
588
|
+
'name': 'ROI 1',
|
|
589
|
+
'type': 'str',
|
|
590
|
+
'readonly': True,
|
|
591
|
+
'removable': True,
|
|
592
|
+
'value': f'{x}, {y}, {w}, {h}',
|
|
593
|
+
},
|
|
594
|
+
)
|
|
595
|
+
|
|
596
|
+
self.worker = QThreadWorker(work_func)
|
|
597
|
+
self.worker.signals.result.connect(done)
|
|
598
|
+
# Execute
|
|
599
|
+
self._threadpool.start(self.worker)
|
|
600
|
+
except Exception:
|
|
601
|
+
traceback.print_exc()
|
|
602
|
+
|
|
603
|
+
def cam_cbox_changed(self, param: VimbaParams):
|
|
604
|
+
'''
|
|
605
|
+
Slot for changed combobox values
|
|
606
|
+
|
|
607
|
+
Parameters
|
|
608
|
+
----------
|
|
609
|
+
param : VimbaParams
|
|
610
|
+
selected parameter enum
|
|
611
|
+
'''
|
|
612
|
+
value = self.camera_options.get_param_value(param)
|
|
613
|
+
with self._cam.cam:
|
|
614
|
+
if param == VimbaParams.TRIGGER_MODE:
|
|
615
|
+
self._cam.set_trigger_mode(value)
|
|
616
|
+
self._cam.get_trigger_mode()
|
|
617
|
+
elif param == VimbaParams.TRIGGER_SOURCE:
|
|
618
|
+
self._cam.set_trigger_source(value)
|
|
619
|
+
self._cam.get_trigger_source()
|
|
620
|
+
elif param == VimbaParams.TRIGGER_SELECTOR:
|
|
621
|
+
self._cam.set_trigger_selector(value)
|
|
622
|
+
self._cam.get_trigger_selector()
|
|
623
|
+
elif param == VimbaParams.TRIGGER_ACTIVATION:
|
|
624
|
+
self._cam.set_trigger_activation(value)
|
|
625
|
+
self._cam.get_trigger_activation()
|
|
626
|
+
elif param == VimbaParams.EXPOSURE_MODE:
|
|
627
|
+
self._cam.set_exposure_mode(value)
|
|
628
|
+
self._cam.get_exposure_mode()
|
|
629
|
+
elif param == VimbaParams.EXPOSURE_AUTO:
|
|
630
|
+
self._cam.set_exposure_auto(value)
|
|
631
|
+
self._cam.get_exposure_auto()
|
|
632
|
+
elif param == VimbaParams.PIXEL_FORMAT:
|
|
633
|
+
self._cam.set_pixel_format(value)
|
|
634
|
+
self.refresh_framerate()
|
|
635
|
+
|
|
636
|
+
def exposure_spin_changed(self, param, value: float):
|
|
637
|
+
'''
|
|
638
|
+
Slot for changed exposure
|
|
639
|
+
|
|
640
|
+
Parameters
|
|
641
|
+
----------
|
|
642
|
+
Value : double
|
|
643
|
+
selected exposure in micro-seconds
|
|
644
|
+
'''
|
|
645
|
+
with self._cam.cam:
|
|
646
|
+
self._cam.set_exposure(value)
|
|
647
|
+
|
|
648
|
+
self.refresh_exposure()
|
|
649
|
+
self.refresh_framerate()
|
|
650
|
+
|
|
651
|
+
self.OME_tab.set_param_value(
|
|
652
|
+
MetaParams.EXPOSURE, float(self._cam.exposure_current / 1000)
|
|
653
|
+
)
|
|
654
|
+
if self.master:
|
|
655
|
+
self.exposureChanged.emit()
|
|
656
|
+
|
|
657
|
+
def refresh_exposure(self):
|
|
658
|
+
self.camera_options.set_param_value(
|
|
659
|
+
CamParams.EXPOSURE, self._cam.exposure_current, self.exposure_spin_changed
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
def refresh_framerate(self, value=None):
|
|
663
|
+
with self._cam.cam:
|
|
664
|
+
if value:
|
|
665
|
+
self._cam.set_framerate(value)
|
|
666
|
+
self._cam.get_framerate(False)
|
|
667
|
+
|
|
668
|
+
framerate = self.camera_options.get_param(VimbaParams.FRAMERATE)
|
|
669
|
+
framerate.setLimits(
|
|
670
|
+
(self._cam.frameRate_range[0], self._cam.frameRate_range[1])
|
|
671
|
+
)
|
|
672
|
+
framerate.setValue(self._cam.frameRate)
|
|
673
|
+
|
|
674
|
+
def cam_framerate_changed(self, value):
|
|
675
|
+
with self._cam.cam:
|
|
676
|
+
self.cam.set_acquisition_framerate_enable(
|
|
677
|
+
self.camera_options.get_param_value(VimbaParams.FRAMERATE_ENABLED)
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
self.camera_options.get_param(VimbaParams.FRAMERATE).setOpts(
|
|
681
|
+
enabled=self.camera_options.get_param_value(VimbaParams.FRAMERATE_ENABLED)
|
|
682
|
+
)
|
|
683
|
+
self.refresh_framerate()
|
|
684
|
+
|
|
685
|
+
def framerate_spin_changed(self, param, value: float):
|
|
686
|
+
self.refresh_framerate(value)
|
|
687
|
+
|
|
688
|
+
def io_line_changed(self, value):
|
|
689
|
+
with self._cam.cam:
|
|
690
|
+
line = self.camera_options.get_param_value(VimbaParams.LINE_SELECTOR)
|
|
691
|
+
self.cam.select_io_line(line)
|
|
692
|
+
mode = self.cam.get_line_mode()
|
|
693
|
+
self.camera_options.set_param_value(VimbaParams.LINE_MODE, mode)
|
|
694
|
+
if 'Out' in mode:
|
|
695
|
+
self.camera_options.set_param_value(
|
|
696
|
+
VimbaParams.LINE_SOURCE, self.cam.get_line_source()
|
|
697
|
+
)
|
|
698
|
+
self.camera_options.set_param_value(
|
|
699
|
+
VimbaParams.LINE_INVERTER, self.cam.get_line_inverter()
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
def set_io_line_config(self):
|
|
703
|
+
with self._cam.cam:
|
|
704
|
+
line = self.camera_options.get_param_value(VimbaParams.LINE_SELECTOR)
|
|
705
|
+
self.cam.select_io_line(line)
|
|
706
|
+
mode = self.camera_options.get_param_value(VimbaParams.LINE_MODE)
|
|
707
|
+
self.cam.set_line_mode(mode)
|
|
708
|
+
if 'Out' in mode:
|
|
709
|
+
self.cam.set_line_source(
|
|
710
|
+
self.camera_options.get_param_value(VimbaParams.LINE_SOURCE)
|
|
711
|
+
)
|
|
712
|
+
self.cam.set_line_inverter(
|
|
713
|
+
self.camera_options.get_param_value(VimbaParams.LINE_INVERTER)
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
def _capture_handler(self, cam, frame):
|
|
717
|
+
if self.acq_job.frames_captured < self.acq_job.frames or self.mini:
|
|
718
|
+
self._buffer.put(frame.as_numpy_ndarray()[..., 0])
|
|
719
|
+
cam.queue_frame(frame)
|
|
720
|
+
# add sensor temperature to the stack
|
|
721
|
+
self._temps.put(self.cam.get_temperature())
|
|
722
|
+
self.acq_job.frames_captured = self.acq_job.frames_captured + 1
|
|
723
|
+
if self.acq_job.frames_captured > self.acq_job.frames - 1 and not self.mini:
|
|
724
|
+
self.acq_job.c_event.set()
|
|
725
|
+
self.acq_job.stop_threads = True
|
|
726
|
+
logging.debug('Stop')
|
|
727
|
+
print('Capture Stopped!')
|
|
728
|
+
|
|
729
|
+
def cam_capture(self, *args, **kwargs):
|
|
730
|
+
'''Capture function executed by the capture worker.
|
|
731
|
+
|
|
732
|
+
Sends software trigger signals and transfers the
|
|
733
|
+
acquired frame to the display processing stack.
|
|
734
|
+
|
|
735
|
+
Parameters
|
|
736
|
+
----------
|
|
737
|
+
cam : vimba_cam
|
|
738
|
+
the vimba_cam used to acquire frames.
|
|
739
|
+
'''
|
|
740
|
+
try:
|
|
741
|
+
# Continuous image capture
|
|
742
|
+
with self._cam.cam:
|
|
743
|
+
self._cam.cam.start_streaming(self._capture_handler)
|
|
744
|
+
|
|
745
|
+
self.acq_job.c_event.wait()
|
|
746
|
+
except Exception:
|
|
747
|
+
traceback.print_exc()
|
|
748
|
+
finally:
|
|
749
|
+
# reset flags and release resources
|
|
750
|
+
with self._cam.cam:
|
|
751
|
+
self._cam.cam.stop_streaming()
|
|
752
|
+
self._cam.acquisition = False
|
|
753
|
+
QtCore.QThreadPool.globalInstance().releaseThread()
|
|
754
|
+
return QDateTime.currentDateTime()
|
|
755
|
+
|
|
756
|
+
def getCaptureArgs(self) -> list:
|
|
757
|
+
'''User specific arguments to be passed to the parallelized
|
|
758
|
+
Camera_Panel.cam_capture function.
|
|
759
|
+
|
|
760
|
+
Example
|
|
761
|
+
------
|
|
762
|
+
check child panels (vimba, ueye or thorlabs)
|
|
763
|
+
|
|
764
|
+
Returns
|
|
765
|
+
-------
|
|
766
|
+
list
|
|
767
|
+
list of args to be passed in order to
|
|
768
|
+
Camera_Panel.cam_capture function.
|
|
769
|
+
|
|
770
|
+
Raises
|
|
771
|
+
------
|
|
772
|
+
NotImplementedError
|
|
773
|
+
Has to be implemented by the use in child class.
|
|
774
|
+
'''
|
|
775
|
+
args = []
|
|
776
|
+
return args
|
|
777
|
+
|
|
778
|
+
def save_config(self):
|
|
779
|
+
filename, _ = getSaveFileName(
|
|
780
|
+
self, 'Save config', filter='XML Files (*.xml);;'
|
|
781
|
+
)
|
|
782
|
+
|
|
783
|
+
if len(filename) > 0:
|
|
784
|
+
with self.cam.cam:
|
|
785
|
+
self.cam.cam.save_settings(filename, vb.PersistType.All)
|
|
786
|
+
|
|
787
|
+
QtWidgets.QMessageBox.information(self, 'Info', 'Config saved.')
|
|
788
|
+
else:
|
|
789
|
+
QtWidgets.QMessageBox.warning(self, 'Warning', 'Config not saved.')
|
|
790
|
+
|
|
791
|
+
def load_config(self):
|
|
792
|
+
filename, _ = getOpenFileName(
|
|
793
|
+
self, 'Load config', filter='XML Files (*.xml);;'
|
|
794
|
+
)
|
|
795
|
+
|
|
796
|
+
if len(filename) > 0:
|
|
797
|
+
with self.cam.cam:
|
|
798
|
+
self.cam.default()
|
|
799
|
+
|
|
800
|
+
# Load camera settings from file.
|
|
801
|
+
self.cam.cam.load_settings(filename, vb.PersistType.All)
|
|
802
|
+
|
|
803
|
+
w, h, x, y = self.cam.get_roi()
|
|
804
|
+
|
|
805
|
+
self.camera_options.set_roi_info(int(x), int(y), int(w), int(h))
|
|
806
|
+
|
|
807
|
+
self.cam_trigger_mode_cbox.setCurrentText(self.cam.get_trigger_mode())
|
|
808
|
+
|
|
809
|
+
self.camera_options.set_param_value(
|
|
810
|
+
CamParams.EXPOSURE, self.cam.get_exposure()
|
|
811
|
+
)
|
|
812
|
+
else:
|
|
813
|
+
QtWidgets.QMessageBox.warning(self, 'Warning', 'No file selected.')
|