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,694 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from enum import Enum
|
|
4
|
+
from typing import Any, Optional
|
|
5
|
+
|
|
6
|
+
from pyqtgraph.parametertree import Parameter
|
|
7
|
+
from pyqtgraph.parametertree.parameterTypes import GroupParameter
|
|
8
|
+
|
|
9
|
+
from microEye.qt import QApplication, QtWidgets, Signal
|
|
10
|
+
from microEye.utils.parameter_tree import Tree
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CamParams(Enum):
|
|
14
|
+
'''
|
|
15
|
+
Enum class defining Camera parameters.
|
|
16
|
+
'''
|
|
17
|
+
|
|
18
|
+
ACQUISITION = 'Acquisition'
|
|
19
|
+
EXPERIMENT_NAME = 'Acquisition.Experiment Name'
|
|
20
|
+
FRAMES = 'Acquisition.Number of Frames'
|
|
21
|
+
SAVE_DATA = 'Acquisition.Save Data'
|
|
22
|
+
ACQ_SETTINGS = 'Acquisition Settings'
|
|
23
|
+
CAMERA_GPIO = 'GPIOs'
|
|
24
|
+
CAMERA_TIMERS = 'Timers'
|
|
25
|
+
EXPOSURE = 'Acquisition Settings.Exposure Time'
|
|
26
|
+
SAVE_DIRECTORY = 'Exports.Save Directory'
|
|
27
|
+
DARK_CALIBRATION = 'Exports.Dark Calibration'
|
|
28
|
+
IMAGE_FORMAT = 'Exports.Image Format'
|
|
29
|
+
TIFF_FORMAT = 'Exports.Tiff Format'
|
|
30
|
+
ZARR_FORMAT = 'Exports.Zarr Format'
|
|
31
|
+
BIGG_TIFF_FORMAT = 'Exports.BiggTiff Format'
|
|
32
|
+
FULL_METADATA = 'Exports.Full Metadata'
|
|
33
|
+
CAPTURE_STATS = 'Stats.Capture'
|
|
34
|
+
DISPLAY_STATS = 'Stats.Display'
|
|
35
|
+
SAVE_STATS = 'Stats.Save'
|
|
36
|
+
TEMPERATURE = 'Stats.Temperature'
|
|
37
|
+
ROI_X = 'Region of Interest (ROI).X'
|
|
38
|
+
ROI_Y = 'Region of Interest (ROI).Y'
|
|
39
|
+
ROI_WIDTH = 'Region of Interest (ROI).Width'
|
|
40
|
+
ROI_HEIGHT = 'Region of Interest (ROI).Height'
|
|
41
|
+
SET_ROI = 'Region of Interest (ROI).Set ROI'
|
|
42
|
+
RESET_ROI = 'Region of Interest (ROI).Reset ROI'
|
|
43
|
+
CENTER_ROI = 'Region of Interest (ROI).Center ROI'
|
|
44
|
+
SELECT_ROI = 'Region of Interest (ROI).Select ROI'
|
|
45
|
+
EXPORT_ROIS = 'Region of Interest (ROI).Export ROIs'
|
|
46
|
+
SELECT_EXPORT_ROIS = 'Region of Interest (ROI).Export ROIs.Select ROIs'
|
|
47
|
+
EXPORTED_ROIS = 'Region of Interest (ROI).Export ROIs.ROIs'
|
|
48
|
+
EXPORT_ROIS_SEPERATE = 'Region of Interest (ROI).Export ROIs.Seperate Files'
|
|
49
|
+
EXPORT_ROIS_FLIPPED = 'Region of Interest (ROI).Export ROIs.Flip Horizontally'
|
|
50
|
+
PREVIEW = 'Display.Preview'
|
|
51
|
+
DISPLAY_STATS_OPTION = 'Display.Display Stats'
|
|
52
|
+
AUTO_STRETCH = 'Display.Auto Stretch'
|
|
53
|
+
VIEW_OPTIONS = 'Display.View Options'
|
|
54
|
+
SINGLE_VIEW = 'Display.View Options.Single View'
|
|
55
|
+
DUAL_SIDE = 'Display.View Options.Dual Channel (Side by Side)'
|
|
56
|
+
DUAL_OVERLAID = 'Display.View Options.Dual Channel (Overlapped)'
|
|
57
|
+
ROIS_VIEW = 'Display.View Options.Export ROIs'
|
|
58
|
+
LINE_PROFILER = 'Display.Line Profiler'
|
|
59
|
+
LUT = 'Display.LUT'
|
|
60
|
+
LUT_NUMPY = 'Display.LUT Numpy (12bit)'
|
|
61
|
+
LUT_OPENCV = 'Display.LUT Opencv (8bit)'
|
|
62
|
+
RESIZE_DISPLAY = 'Display.Resize Display'
|
|
63
|
+
|
|
64
|
+
EXPORT_STATE = 'Export State'
|
|
65
|
+
IMPORT_STATE = 'Import State'
|
|
66
|
+
|
|
67
|
+
def __str__(self):
|
|
68
|
+
'''
|
|
69
|
+
Return the last part of the enum value (Param name).
|
|
70
|
+
'''
|
|
71
|
+
return self.value.split('.')[-1]
|
|
72
|
+
|
|
73
|
+
def get_path(self):
|
|
74
|
+
'''
|
|
75
|
+
Return the full parameter path.
|
|
76
|
+
'''
|
|
77
|
+
return self.value.split('.')
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class CameraOptions(Tree):
|
|
81
|
+
'''
|
|
82
|
+
Tree widget for editing camera parameters.
|
|
83
|
+
|
|
84
|
+
Attributes
|
|
85
|
+
----------
|
|
86
|
+
paramsChanged : Signal
|
|
87
|
+
Signal for parameter changed event.
|
|
88
|
+
'''
|
|
89
|
+
|
|
90
|
+
PARAMS = CamParams
|
|
91
|
+
|
|
92
|
+
setROI: Signal = Signal()
|
|
93
|
+
resetROI: Signal = Signal()
|
|
94
|
+
centerROI: Signal = Signal()
|
|
95
|
+
selectROI: Signal = Signal()
|
|
96
|
+
selectROIs: Signal = Signal()
|
|
97
|
+
directoryChanged: Signal = Signal(str)
|
|
98
|
+
viewOptionChanged: Signal = Signal()
|
|
99
|
+
|
|
100
|
+
def __init__(self, parent: Optional['QtWidgets.QWidget'] = None):
|
|
101
|
+
'''
|
|
102
|
+
Initialize the CameraOptions.
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
parent : QWidget, optional
|
|
107
|
+
The parent widget, by default None.
|
|
108
|
+
'''
|
|
109
|
+
super().__init__(parent=parent)
|
|
110
|
+
|
|
111
|
+
@classmethod
|
|
112
|
+
def combine_params(name, extra_params: Enum):
|
|
113
|
+
combined_members = {}
|
|
114
|
+
enum_classes: list[Enum] = [CameraOptions.PARAMS, extra_params]
|
|
115
|
+
for enum_class in enum_classes:
|
|
116
|
+
for member in enum_class:
|
|
117
|
+
combined_members[member.name] = member.value
|
|
118
|
+
|
|
119
|
+
sorted_members = dict(
|
|
120
|
+
sorted(combined_members.items(), key=lambda item: item[1].split('.')[0])
|
|
121
|
+
)
|
|
122
|
+
CameraOptions.PARAMS = Enum('CamParams', sorted_members)
|
|
123
|
+
|
|
124
|
+
def create_parameters(self):
|
|
125
|
+
'''
|
|
126
|
+
Create the parameter tree structure.
|
|
127
|
+
'''
|
|
128
|
+
params = [
|
|
129
|
+
{
|
|
130
|
+
'name': str(CamParams.ACQUISITION),
|
|
131
|
+
'type': 'group',
|
|
132
|
+
'expanded': True,
|
|
133
|
+
'children': [
|
|
134
|
+
{
|
|
135
|
+
'name': str(CamParams.EXPERIMENT_NAME),
|
|
136
|
+
'type': 'str',
|
|
137
|
+
'value': '001_Experiment',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
'name': str(CamParams.FRAMES),
|
|
141
|
+
'type': 'int',
|
|
142
|
+
'value': int(1e6),
|
|
143
|
+
'limits': [1, int(1e9)],
|
|
144
|
+
},
|
|
145
|
+
{'name': str(CamParams.SAVE_DATA), 'type': 'bool', 'value': False},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
'name': str(CamParams.ACQ_SETTINGS),
|
|
150
|
+
'type': 'group',
|
|
151
|
+
'expanded': False,
|
|
152
|
+
'children': [
|
|
153
|
+
{
|
|
154
|
+
'name': str(CamParams.EXPOSURE),
|
|
155
|
+
'type': 'float',
|
|
156
|
+
'value': 100.0,
|
|
157
|
+
'dec': False,
|
|
158
|
+
'decimals': 6,
|
|
159
|
+
'suffixes': [' ns', ' us', ' ms', ' s'],
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
'name': 'Exports',
|
|
165
|
+
'type': 'group',
|
|
166
|
+
'children': [
|
|
167
|
+
{
|
|
168
|
+
'name': str(CamParams.SAVE_DIRECTORY),
|
|
169
|
+
'type': 'file',
|
|
170
|
+
'directory': os.path.join(os.path.expanduser('~'), 'Desktop'),
|
|
171
|
+
'fileMode': 'Directory',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
'name': str(CamParams.DARK_CALIBRATION),
|
|
175
|
+
'type': 'bool',
|
|
176
|
+
'value': False,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
'name': str(CamParams.IMAGE_FORMAT),
|
|
180
|
+
'type': 'list',
|
|
181
|
+
'limits': [
|
|
182
|
+
str(CamParams.BIGG_TIFF_FORMAT),
|
|
183
|
+
str(CamParams.TIFF_FORMAT),
|
|
184
|
+
str(CamParams.ZARR_FORMAT),
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
'name': str(CamParams.FULL_METADATA),
|
|
189
|
+
'type': 'bool',
|
|
190
|
+
'value': True,
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
'name': 'Display',
|
|
196
|
+
'type': 'group',
|
|
197
|
+
'expanded': False,
|
|
198
|
+
'children': [
|
|
199
|
+
{'name': str(CamParams.PREVIEW), 'type': 'bool', 'value': True},
|
|
200
|
+
{
|
|
201
|
+
'name': str(CamParams.DISPLAY_STATS_OPTION),
|
|
202
|
+
'type': 'bool',
|
|
203
|
+
'value': False,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
'name': str(CamParams.AUTO_STRETCH),
|
|
207
|
+
'type': 'bool',
|
|
208
|
+
'value': True,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
'name': str(CamParams.LUT),
|
|
212
|
+
'type': 'list',
|
|
213
|
+
'limits': [str(CamParams.LUT_NUMPY), str(CamParams.LUT_OPENCV)],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
'name': str(CamParams.VIEW_OPTIONS),
|
|
217
|
+
'type': 'list',
|
|
218
|
+
'limits': [
|
|
219
|
+
str(CamParams.SINGLE_VIEW),
|
|
220
|
+
str(CamParams.DUAL_SIDE),
|
|
221
|
+
str(CamParams.DUAL_OVERLAID),
|
|
222
|
+
str(CamParams.ROIS_VIEW),
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
'name': str(CamParams.LINE_PROFILER),
|
|
227
|
+
'type': 'bool',
|
|
228
|
+
'value': False,
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
'name': str(CamParams.RESIZE_DISPLAY),
|
|
232
|
+
'type': 'float',
|
|
233
|
+
'value': 0.5,
|
|
234
|
+
'limits': [0.1, 4.0],
|
|
235
|
+
'step': 0.02,
|
|
236
|
+
'dec': False,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
'name': 'Stats',
|
|
242
|
+
'type': 'group',
|
|
243
|
+
'expanded': False,
|
|
244
|
+
'children': [
|
|
245
|
+
{
|
|
246
|
+
'name': str(CamParams.CAPTURE_STATS),
|
|
247
|
+
'type': 'str',
|
|
248
|
+
'value': '0 | 0.00 ms',
|
|
249
|
+
'readonly': True,
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
'name': str(CamParams.DISPLAY_STATS),
|
|
253
|
+
'type': 'str',
|
|
254
|
+
'value': '0 | 0.00 ms',
|
|
255
|
+
'readonly': True,
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
'name': str(CamParams.SAVE_STATS),
|
|
259
|
+
'type': 'str',
|
|
260
|
+
'value': '0 | 0.00 ms',
|
|
261
|
+
'readonly': True,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
'name': str(CamParams.TEMPERATURE),
|
|
265
|
+
'type': 'str',
|
|
266
|
+
'value': ' T -127.00 °C',
|
|
267
|
+
'readonly': True,
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
'name': 'Region of Interest (ROI)',
|
|
273
|
+
'type': 'group',
|
|
274
|
+
'expanded': False,
|
|
275
|
+
'children': [
|
|
276
|
+
{'name': str(CamParams.ROI_X), 'type': 'int', 'value': 0},
|
|
277
|
+
{'name': str(CamParams.ROI_Y), 'type': 'int', 'value': 0},
|
|
278
|
+
{'name': str(CamParams.ROI_WIDTH), 'type': 'int', 'value': 0},
|
|
279
|
+
{'name': str(CamParams.ROI_HEIGHT), 'type': 'int', 'value': 0},
|
|
280
|
+
{'name': str(CamParams.SET_ROI), 'type': 'action'},
|
|
281
|
+
{'name': str(CamParams.RESET_ROI), 'type': 'action'},
|
|
282
|
+
{'name': str(CamParams.CENTER_ROI), 'type': 'action'},
|
|
283
|
+
{'name': str(CamParams.SELECT_ROI), 'type': 'action'},
|
|
284
|
+
{
|
|
285
|
+
'name': str(CamParams.EXPORT_ROIS),
|
|
286
|
+
'type': 'group',
|
|
287
|
+
'children': [
|
|
288
|
+
{
|
|
289
|
+
'name': str(CamParams.SELECT_EXPORT_ROIS),
|
|
290
|
+
'type': 'action',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
'name': str(CamParams.EXPORTED_ROIS),
|
|
294
|
+
'type': 'group',
|
|
295
|
+
'children': [],
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
'name': str(CamParams.EXPORT_ROIS_SEPERATE),
|
|
299
|
+
'type': 'bool',
|
|
300
|
+
'value': False,
|
|
301
|
+
'tip': 'Export each ROI a Tiff file. (Not for Zarr)',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
'name': str(CamParams.EXPORT_ROIS_FLIPPED),
|
|
305
|
+
'type': 'bool',
|
|
306
|
+
'value': True,
|
|
307
|
+
'tip': 'Flip n-th ROIs horizontally for n > 1.',
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
'name': str(CamParams.CAMERA_GPIO),
|
|
315
|
+
'type': 'group',
|
|
316
|
+
'expanded': False,
|
|
317
|
+
'children': [],
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
'name': str(CamParams.CAMERA_TIMERS),
|
|
321
|
+
'type': 'group',
|
|
322
|
+
'expanded': False,
|
|
323
|
+
'children': [],
|
|
324
|
+
},
|
|
325
|
+
{'name': str(CamParams.EXPORT_STATE), 'type': 'action'},
|
|
326
|
+
{'name': str(CamParams.IMPORT_STATE), 'type': 'action'},
|
|
327
|
+
]
|
|
328
|
+
|
|
329
|
+
self.param_tree = Parameter.create(name='', type='group', children=params)
|
|
330
|
+
self.param_tree.sigTreeStateChanged.connect(self.change)
|
|
331
|
+
self.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.Stretch)
|
|
332
|
+
|
|
333
|
+
self.get_param(CamParams.SAVE_DIRECTORY).sigValueChanged.connect(
|
|
334
|
+
lambda: self.directoryChanged.emit(
|
|
335
|
+
self.get_param_value(CamParams.SAVE_DIRECTORY)
|
|
336
|
+
)
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
self.get_param(CamParams.SET_ROI).sigActivated.connect(
|
|
340
|
+
lambda: self.setROI.emit()
|
|
341
|
+
)
|
|
342
|
+
self.get_param(CamParams.RESET_ROI).sigActivated.connect(
|
|
343
|
+
lambda: self.resetROI.emit()
|
|
344
|
+
)
|
|
345
|
+
self.get_param(CamParams.CENTER_ROI).sigActivated.connect(
|
|
346
|
+
lambda: self.centerROI.emit()
|
|
347
|
+
)
|
|
348
|
+
self.get_param(CamParams.SELECT_ROI).sigActivated.connect(
|
|
349
|
+
lambda: self.selectROI.emit()
|
|
350
|
+
)
|
|
351
|
+
self.get_param(CamParams.SELECT_EXPORT_ROIS).sigActivated.connect(
|
|
352
|
+
lambda: self.selectROIs.emit()
|
|
353
|
+
)
|
|
354
|
+
self.get_param(CamParams.VIEW_OPTIONS).sigValueChanged.connect(
|
|
355
|
+
lambda: self.viewOptionChanged.emit()
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
self.get_param(CamParams.IMPORT_STATE).sigActivated.connect(self.load_json)
|
|
359
|
+
self.get_param(CamParams.EXPORT_STATE).sigActivated.connect(self.export_json)
|
|
360
|
+
|
|
361
|
+
def get_roi_info(self, vimba=False):
|
|
362
|
+
'''
|
|
363
|
+
Get the region of interest (ROI) information.
|
|
364
|
+
|
|
365
|
+
Parameters
|
|
366
|
+
----------
|
|
367
|
+
vimba : bool, optional
|
|
368
|
+
If True, returns ROI information suitable for Vimba API.
|
|
369
|
+
If False (default), returns ROI information in the default order.
|
|
370
|
+
|
|
371
|
+
Returns
|
|
372
|
+
-------
|
|
373
|
+
tuple
|
|
374
|
+
Tuple containing ROI X, ROI Y, ROI width, and ROI height.
|
|
375
|
+
If vimba is True, the order is (width, height, x, y).
|
|
376
|
+
If vimba is False, the order is (x, y, width, height).
|
|
377
|
+
'''
|
|
378
|
+
if not vimba:
|
|
379
|
+
info = [
|
|
380
|
+
self.get_param_value(CamParams.ROI_X),
|
|
381
|
+
self.get_param_value(CamParams.ROI_Y),
|
|
382
|
+
self.get_param_value(CamParams.ROI_WIDTH),
|
|
383
|
+
self.get_param_value(CamParams.ROI_HEIGHT),
|
|
384
|
+
]
|
|
385
|
+
return info
|
|
386
|
+
else:
|
|
387
|
+
info = [
|
|
388
|
+
self.get_param_value(CamParams.ROI_WIDTH),
|
|
389
|
+
self.get_param_value(CamParams.ROI_HEIGHT),
|
|
390
|
+
self.get_param_value(CamParams.ROI_X),
|
|
391
|
+
self.get_param_value(CamParams.ROI_Y),
|
|
392
|
+
]
|
|
393
|
+
return info
|
|
394
|
+
|
|
395
|
+
def set_roi_info(self, x: int, y: int, w: int, h: int):
|
|
396
|
+
'''
|
|
397
|
+
Set the region of interest (ROI) information.
|
|
398
|
+
|
|
399
|
+
Parameters
|
|
400
|
+
----------
|
|
401
|
+
x : int
|
|
402
|
+
X-coordinate of the ROI.
|
|
403
|
+
y : int
|
|
404
|
+
Y-coordinate of the ROI.
|
|
405
|
+
w : int
|
|
406
|
+
Width of the ROI.
|
|
407
|
+
h : int
|
|
408
|
+
Height of the ROI.
|
|
409
|
+
|
|
410
|
+
Returns
|
|
411
|
+
-------
|
|
412
|
+
None
|
|
413
|
+
'''
|
|
414
|
+
self.set_param_value(CamParams.ROI_X, x)
|
|
415
|
+
self.set_param_value(CamParams.ROI_Y, y)
|
|
416
|
+
self.set_param_value(CamParams.ROI_WIDTH, w)
|
|
417
|
+
self.set_param_value(CamParams.ROI_HEIGHT, h)
|
|
418
|
+
|
|
419
|
+
def set_roi_limits(
|
|
420
|
+
self,
|
|
421
|
+
x: tuple[int, int],
|
|
422
|
+
y: tuple[int, int],
|
|
423
|
+
w: tuple[int, int],
|
|
424
|
+
h: tuple[int, int],
|
|
425
|
+
):
|
|
426
|
+
'''
|
|
427
|
+
Set limits for the Region of Interest (ROI) parameters.
|
|
428
|
+
|
|
429
|
+
This function sets limits for the X-coordinate, Y-coordinate, width,
|
|
430
|
+
and height parameters of the Region of Interest (ROI).
|
|
431
|
+
|
|
432
|
+
Parameters
|
|
433
|
+
----------
|
|
434
|
+
x : tuple[int, int]
|
|
435
|
+
Tuple representing the minimum and maximum limits for the X-coordinate.
|
|
436
|
+
y : tuple[int, int]
|
|
437
|
+
Tuple representing the minimum and maximum limits for the Y-coordinate.
|
|
438
|
+
w : tuple[int, int]
|
|
439
|
+
Tuple representing the minimum and maximum limits for the width.
|
|
440
|
+
h : tuple[int, int]
|
|
441
|
+
Tuple representing the minimum and maximum limits for the height.
|
|
442
|
+
|
|
443
|
+
Returns
|
|
444
|
+
-------
|
|
445
|
+
None
|
|
446
|
+
'''
|
|
447
|
+
self.get_param(CamParams.ROI_X).setLimits(x)
|
|
448
|
+
self.get_param(CamParams.ROI_Y).setLimits(y)
|
|
449
|
+
self.get_param(CamParams.ROI_WIDTH).setLimits(w)
|
|
450
|
+
self.get_param(CamParams.ROI_WIDTH).setDefault(w[1])
|
|
451
|
+
self.get_param(CamParams.ROI_WIDTH).setValue(w[1])
|
|
452
|
+
self.get_param(CamParams.ROI_HEIGHT).setLimits(h)
|
|
453
|
+
self.get_param(CamParams.ROI_HEIGHT).setDefault(h[1])
|
|
454
|
+
self.get_param(CamParams.ROI_HEIGHT).setValue(h[1])
|
|
455
|
+
|
|
456
|
+
def get_export_rois(self):
|
|
457
|
+
'''
|
|
458
|
+
Get the export regions of interest (ROIs) information.
|
|
459
|
+
|
|
460
|
+
Returns
|
|
461
|
+
-------
|
|
462
|
+
list[list[int]]
|
|
463
|
+
list or ROIs with each being a list[int] of [x, y, w, h].
|
|
464
|
+
'''
|
|
465
|
+
rois_param = self.get_param(CamParams.EXPORTED_ROIS)
|
|
466
|
+
rois = []
|
|
467
|
+
|
|
468
|
+
if len(rois_param.children()) > 0:
|
|
469
|
+
for child in rois_param.children():
|
|
470
|
+
rois.append(list(map(int, child.value().split(', '))))
|
|
471
|
+
return rois
|
|
472
|
+
|
|
473
|
+
def setZoom(self, value: float):
|
|
474
|
+
'''
|
|
475
|
+
Set the zoom value.
|
|
476
|
+
'''
|
|
477
|
+
param = self.get_param(CamParams.RESIZE_DISPLAY)
|
|
478
|
+
|
|
479
|
+
if param and param.opts['enabled']:
|
|
480
|
+
param.setValue(value)
|
|
481
|
+
|
|
482
|
+
def change(self, param: Parameter, changes: list):
|
|
483
|
+
'''
|
|
484
|
+
Handle parameter changes as needed.
|
|
485
|
+
|
|
486
|
+
This method handles the changes made to the parameters in the parameter
|
|
487
|
+
tree.
|
|
488
|
+
|
|
489
|
+
Parameters
|
|
490
|
+
----------
|
|
491
|
+
param : Parameter
|
|
492
|
+
The parameter that triggered the change.
|
|
493
|
+
changes : list
|
|
494
|
+
List of changes.
|
|
495
|
+
|
|
496
|
+
Returns
|
|
497
|
+
-------
|
|
498
|
+
None
|
|
499
|
+
'''
|
|
500
|
+
# Handle parameter changes as needed
|
|
501
|
+
for p, _, data in changes:
|
|
502
|
+
path = self.param_tree.childPath(p)
|
|
503
|
+
|
|
504
|
+
self.paramsChanged.emit(
|
|
505
|
+
p, data)
|
|
506
|
+
|
|
507
|
+
@property
|
|
508
|
+
def isTiff(self):
|
|
509
|
+
'''
|
|
510
|
+
Check if the image format is TIFF.
|
|
511
|
+
|
|
512
|
+
Returns
|
|
513
|
+
-------
|
|
514
|
+
bool
|
|
515
|
+
True if the image format is TIFF, False otherwise.
|
|
516
|
+
'''
|
|
517
|
+
return self.get_param_value(CamParams.IMAGE_FORMAT) in [
|
|
518
|
+
str(CamParams.TIFF_FORMAT),
|
|
519
|
+
str(CamParams.BIGG_TIFF_FORMAT),
|
|
520
|
+
]
|
|
521
|
+
|
|
522
|
+
@property
|
|
523
|
+
def isBiggTiff(self):
|
|
524
|
+
'''
|
|
525
|
+
Check if the image format is BigTIFF.
|
|
526
|
+
|
|
527
|
+
Returns
|
|
528
|
+
-------
|
|
529
|
+
bool
|
|
530
|
+
True if the image format is BigTIFF, False otherwise.
|
|
531
|
+
'''
|
|
532
|
+
return self.get_param_value(CamParams.IMAGE_FORMAT) in [
|
|
533
|
+
str(CamParams.BIGG_TIFF_FORMAT)
|
|
534
|
+
]
|
|
535
|
+
|
|
536
|
+
@property
|
|
537
|
+
def isSingleView(self):
|
|
538
|
+
'''
|
|
539
|
+
Check if the view option is set to single view.
|
|
540
|
+
|
|
541
|
+
Returns
|
|
542
|
+
-------
|
|
543
|
+
bool
|
|
544
|
+
True if the view option is set to single view, False otherwise.
|
|
545
|
+
'''
|
|
546
|
+
return self.get_param_value(CamParams.VIEW_OPTIONS) in [
|
|
547
|
+
str(CamParams.SINGLE_VIEW)
|
|
548
|
+
]
|
|
549
|
+
|
|
550
|
+
@property
|
|
551
|
+
def isROIsView(self):
|
|
552
|
+
'''
|
|
553
|
+
Check if the view option is set to export ROIs view.
|
|
554
|
+
|
|
555
|
+
Returns
|
|
556
|
+
-------
|
|
557
|
+
bool
|
|
558
|
+
True if the view option is set to export ROIs view, False otherwise.
|
|
559
|
+
'''
|
|
560
|
+
return self.get_param_value(CamParams.VIEW_OPTIONS) in [
|
|
561
|
+
str(CamParams.ROIS_VIEW)
|
|
562
|
+
]
|
|
563
|
+
|
|
564
|
+
@property
|
|
565
|
+
def isOverlaidView(self):
|
|
566
|
+
'''
|
|
567
|
+
Check if the view option is set to overlaid view.
|
|
568
|
+
|
|
569
|
+
Returns
|
|
570
|
+
-------
|
|
571
|
+
bool
|
|
572
|
+
True if the view option is set to overlaid view, False otherwise.
|
|
573
|
+
'''
|
|
574
|
+
return self.get_param_value(CamParams.VIEW_OPTIONS) in [
|
|
575
|
+
str(CamParams.DUAL_OVERLAID)
|
|
576
|
+
]
|
|
577
|
+
|
|
578
|
+
@property
|
|
579
|
+
def isFullMetadata(self):
|
|
580
|
+
'''
|
|
581
|
+
Check if the metadata option is set to full.
|
|
582
|
+
|
|
583
|
+
Returns
|
|
584
|
+
-------
|
|
585
|
+
bool
|
|
586
|
+
True if the full metadata option is set, False otherwise.
|
|
587
|
+
'''
|
|
588
|
+
return self.get_param_value(CamParams.FULL_METADATA)
|
|
589
|
+
|
|
590
|
+
@property
|
|
591
|
+
def isDarkCalibration(self):
|
|
592
|
+
'''
|
|
593
|
+
Check if the dark calibration option is set.
|
|
594
|
+
|
|
595
|
+
Returns
|
|
596
|
+
-------
|
|
597
|
+
bool
|
|
598
|
+
True if the dark calibration option is set, False otherwise.
|
|
599
|
+
'''
|
|
600
|
+
return self.get_param_value(CamParams.DARK_CALIBRATION)
|
|
601
|
+
|
|
602
|
+
@property
|
|
603
|
+
def isSaveData(self):
|
|
604
|
+
'''
|
|
605
|
+
Check if the save data option is set.
|
|
606
|
+
|
|
607
|
+
Returns
|
|
608
|
+
-------
|
|
609
|
+
bool
|
|
610
|
+
True if the save data option is set, False otherwise.
|
|
611
|
+
'''
|
|
612
|
+
return self.get_param_value(CamParams.SAVE_DATA)
|
|
613
|
+
|
|
614
|
+
def toggleSaveData(self):
|
|
615
|
+
param = self.get_param(CamParams.SAVE_DATA)
|
|
616
|
+
if param:
|
|
617
|
+
param.setValue(not param.value())
|
|
618
|
+
|
|
619
|
+
@property
|
|
620
|
+
def isPreview(self):
|
|
621
|
+
'''
|
|
622
|
+
Check if the preview option is set.
|
|
623
|
+
|
|
624
|
+
Returns
|
|
625
|
+
-------
|
|
626
|
+
bool
|
|
627
|
+
True if the preview option is set, False otherwise.
|
|
628
|
+
'''
|
|
629
|
+
return self.get_param_value(CamParams.PREVIEW)
|
|
630
|
+
|
|
631
|
+
def togglePreview(self):
|
|
632
|
+
param = self.get_param(CamParams.PREVIEW)
|
|
633
|
+
if param:
|
|
634
|
+
param.setValue(not param.value())
|
|
635
|
+
|
|
636
|
+
@property
|
|
637
|
+
def isAutostretch(self):
|
|
638
|
+
'''
|
|
639
|
+
Check if the auto-stretch option is set.
|
|
640
|
+
|
|
641
|
+
Returns
|
|
642
|
+
-------
|
|
643
|
+
bool
|
|
644
|
+
True if the auto-stretch option is set, False otherwise.
|
|
645
|
+
'''
|
|
646
|
+
return self.get_param_value(CamParams.AUTO_STRETCH)
|
|
647
|
+
|
|
648
|
+
def toggleAutostretch(self):
|
|
649
|
+
param = self.get_param(CamParams.AUTO_STRETCH)
|
|
650
|
+
if param:
|
|
651
|
+
param.setValue(not param.value())
|
|
652
|
+
|
|
653
|
+
@property
|
|
654
|
+
def isDisplayStats(self):
|
|
655
|
+
'''
|
|
656
|
+
Check if the display stats option is set.
|
|
657
|
+
|
|
658
|
+
Returns
|
|
659
|
+
-------
|
|
660
|
+
bool
|
|
661
|
+
True if the display stats option is set, False otherwise.
|
|
662
|
+
'''
|
|
663
|
+
return self.get_param_value(CamParams.DISPLAY_STATS_OPTION)
|
|
664
|
+
|
|
665
|
+
@property
|
|
666
|
+
def isLineProfiler(self):
|
|
667
|
+
'''
|
|
668
|
+
Check if the line profiler option is set.
|
|
669
|
+
|
|
670
|
+
Returns
|
|
671
|
+
-------
|
|
672
|
+
bool
|
|
673
|
+
True if the line profiler option is set, False otherwise.
|
|
674
|
+
'''
|
|
675
|
+
return self.get_param_value(CamParams.LINE_PROFILER)
|
|
676
|
+
|
|
677
|
+
@property
|
|
678
|
+
def isNumpyLUT(self):
|
|
679
|
+
'''
|
|
680
|
+
Check if the LUT option is set to numpy lut.
|
|
681
|
+
|
|
682
|
+
Returns
|
|
683
|
+
-------
|
|
684
|
+
bool
|
|
685
|
+
True if the LUT option is set to numpy lut, False otherwise.
|
|
686
|
+
'''
|
|
687
|
+
return self.get_param_value(CamParams.LUT) in [str(CamParams.LUT_NUMPY)]
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
if __name__ == '__main__':
|
|
691
|
+
app = QApplication(sys.argv)
|
|
692
|
+
window = CameraOptions()
|
|
693
|
+
window.show()
|
|
694
|
+
sys.exit(app.exec())
|