Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
total_control_app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Drechsler
total_control_app
Commits
edbb4267
Commit
edbb4267
authored
May 13, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Roi saveable
parent
63fbc7da
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
28 deletions
+84
-28
cameraGui.py
cameraGui.py
+15
-8
controlGui.py
controlGui.py
+1
-1
cameraParameterFrame.py
subclasses/cameraParameterFrame.py
+20
-12
cameraParameterTree.py
subclasses/cameraParameterTree.py
+3
-2
pyqtgraph_subclasses.py
subclasses/pyqtgraph_subclasses.py
+44
-4
zylaCameraWorker.py
zylaCameraWorker.py
+1
-1
No files found.
cameraGui.py
View file @
edbb4267
...
@@ -59,9 +59,9 @@ class CameraGuiMainWindow(QMainWindow):
...
@@ -59,9 +59,9 @@ class CameraGuiMainWindow(QMainWindow):
self
.
area
.
addDock
(
self
.
dCameraView
)
self
.
area
.
addDock
(
self
.
dCameraView
)
self
.
area
.
addDock
(
self
.
dCameraScanAnal
,
"left"
,
self
.
dCameraView
)
self
.
area
.
addDock
(
self
.
dCameraScanAnal
,
"left"
,
self
.
dCameraView
)
self
.
area
.
addDock
(
self
.
dCameraTimeAnal
,
"
above
"
,
self
.
dCameraScanAnal
)
self
.
area
.
addDock
(
self
.
dCameraTimeAnal
,
"
below
"
,
self
.
dCameraScanAnal
)
self
.
area
.
addDock
(
self
.
dCameraControl
,
"right"
,
self
.
dCameraView
)
self
.
area
.
addDock
(
self
.
dCameraControl
,
"right"
,
self
.
dCameraView
)
self
.
area
.
addDock
(
self
.
dConsole
,
"
bottom
"
,
self
.
dCameraControl
)
self
.
area
.
addDock
(
self
.
dConsole
,
"
right
"
,
self
.
dCameraControl
)
self
.
area
.
addDock
(
self
.
dMeasurement
,
"above"
,
self
.
dConsole
)
self
.
area
.
addDock
(
self
.
dMeasurement
,
"above"
,
self
.
dConsole
)
#measurement frame
#measurement frame
...
@@ -87,7 +87,6 @@ class CameraGuiMainWindow(QMainWindow):
...
@@ -87,7 +87,6 @@ class CameraGuiMainWindow(QMainWindow):
self
.
timeAnalysisLayout
=
pg
.
GraphicsLayoutWidget
()
self
.
timeAnalysisLayout
=
pg
.
GraphicsLayoutWidget
()
self
.
scanAnalysisLayout
=
pg
.
GraphicsLayoutWidget
()
self
.
scanAnalysisLayout
=
pg
.
GraphicsLayoutWidget
()
# image layout
# image layout
self
.
img
=
pg
.
ImageItem
(
border
=
"w"
)
self
.
img
=
pg
.
ImageItem
(
border
=
"w"
)
self
.
imv
=
pg
.
ImageView
(
imageItem
=
self
.
img
,
view
=
self
.
imageView
)
self
.
imv
=
pg
.
ImageView
(
imageItem
=
self
.
img
,
view
=
self
.
imageView
)
...
@@ -153,6 +152,15 @@ class CameraGuiMainWindow(QMainWindow):
...
@@ -153,6 +152,15 @@ class CameraGuiMainWindow(QMainWindow):
)
)
self
.
measurementFrame
.
abortMeasureButton
.
clicked
.
connect
(
backend
.
abort_measurement
)
self
.
measurementFrame
.
abortMeasureButton
.
clicked
.
connect
(
backend
.
abort_measurement
)
for
roi
in
self
.
rois
:
self
.
cameraParamFrame
.
saveRoiButton
.
clicked
.
connect
(
lambda
:
roi
.
save
(
current_binning
=
self
.
cameraParamFrame
.
paramTree
.
p
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()
))
self
.
cameraParamFrame
.
loadRoiButton
.
clicked
.
connect
(
lambda
:
roi
.
load
(
current_binning
=
self
.
cameraParamFrame
.
paramTree
.
p
.
child
(
'Basic acq parameters'
)
.
child
(
'Pixel Binning'
)
.
value
()
))
def
camera_button_pressed
(
self
):
def
camera_button_pressed
(
self
):
if
self
.
isCameraAcquiring
:
if
self
.
isCameraAcquiring
:
...
@@ -160,9 +168,9 @@ class CameraGuiMainWindow(QMainWindow):
...
@@ -160,9 +168,9 @@ class CameraGuiMainWindow(QMainWindow):
self
.
cameraButton
.
setText
(
'Start Acquisition'
)
self
.
cameraButton
.
setText
(
'Start Acquisition'
)
self
.
measurementFrame
.
startMeasureButton
.
setEnabled
(
True
)
self
.
measurementFrame
.
startMeasureButton
.
setEnabled
(
True
)
self
.
isCameraAcquiring
=
False
self
.
isCameraAcquiring
=
False
self
.
cameraParamFrame
.
paramTree
.
t
.
setEnabled
(
True
)
else
:
else
:
self
.
repositionRoi
()
self
.
repositionRoi
(
self
.
current_image_size
)
self
.
scanROIdataX
=
np
.
linspace
(
0
,
1
,
2000
)
self
.
scanROIdataX
=
np
.
linspace
(
0
,
1
,
2000
)
self
.
scanROIdataY
=
np
.
zeros
(
2000
)
self
.
scanROIdataY
=
np
.
zeros
(
2000
)
self
.
timeROIdataY
=
np
.
zeros
(
2000
)
self
.
timeROIdataY
=
np
.
zeros
(
2000
)
...
@@ -173,6 +181,7 @@ class CameraGuiMainWindow(QMainWindow):
...
@@ -173,6 +181,7 @@ class CameraGuiMainWindow(QMainWindow):
self
.
previous_frame_index
=
0
self
.
previous_frame_index
=
0
self
.
frames_checker_timer
.
start
(
1000
)
self
.
frames_checker_timer
.
start
(
1000
)
self
.
isCameraAcquiring
=
True
self
.
isCameraAcquiring
=
True
self
.
cameraParamFrame
.
paramTree
.
t
.
setEnabled
(
False
)
def
_initialize_image
(
self
):
def
_initialize_image
(
self
):
# lock the aspect ratio so pixels are always square
# lock the aspect ratio so pixels are always square
...
@@ -197,9 +206,7 @@ class CameraGuiMainWindow(QMainWindow):
...
@@ -197,9 +206,7 @@ class CameraGuiMainWindow(QMainWindow):
self
.
timeCurve
.
setData
(
self
.
timeROIdataY
)
self
.
timeCurve
.
setData
(
self
.
timeROIdataY
)
self
.
scanCurve
.
setData
(
self
.
scanROIdataX
,
self
.
scanROIdataY
)
self
.
scanCurve
.
setData
(
self
.
scanROIdataX
,
self
.
scanROIdataY
)
def
repositionRoi
(
self
):
def
repositionRoi
(
self
,
old_size
):
old_size
=
self
.
current_image_size
aux_dict
=
{
'1x1'
:
2048
,
'2x2'
:
1024
,
'4x4'
:
512
,
'8x8'
:
256
}
aux_dict
=
{
'1x1'
:
2048
,
'2x2'
:
1024
,
'4x4'
:
512
,
'8x8'
:
256
}
new_size
=
aux_dict
[
new_size
=
aux_dict
[
self
.
cameraParamFrame
.
paramTree
.
p
.
child
(
'Basic acq parameters'
)
self
.
cameraParamFrame
.
paramTree
.
p
.
child
(
'Basic acq parameters'
)
...
...
controlGui.py
View file @
edbb4267
...
@@ -103,7 +103,7 @@ class ControlGui(QtGui.QFrame):
...
@@ -103,7 +103,7 @@ class ControlGui(QtGui.QFrame):
backend
.
scanEndSignal
.
connect
(
scan_layout
.
scan_end
)
backend
.
scanEndSignal
.
connect
(
scan_layout
.
scan_end
)
#%%
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
=
QtGui
.
QApplication
([])
app
=
QtGui
.
QApplication
([])
controlGui
=
ControlGui
()
controlGui
=
ControlGui
()
...
...
subclasses/cameraParameterFrame.py
View file @
edbb4267
...
@@ -34,28 +34,36 @@ class CameraParameterFrame(QtWidgets.QFrame):
...
@@ -34,28 +34,36 @@ class CameraParameterFrame(QtWidgets.QFrame):
self
.
grid
.
addWidget
(
self
.
saveToButton
,
2
,
0
)
self
.
grid
.
addWidget
(
self
.
saveToButton
,
2
,
0
)
self
.
grid
.
addWidget
(
self
.
loadFromButton
,
2
,
1
)
self
.
grid
.
addWidget
(
self
.
loadFromButton
,
2
,
1
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
' ROI Position and Size'
),
3
,
0
,
1
,
2
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi X Position'
),
3
,
0
)
'Roi X Position'
),
4
,
0
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi Y Position'
),
3
,
1
)
'Roi Y Position'
),
4
,
1
)
self
.
RoiXPosSb
=
pg
.
SpinBox
()
self
.
RoiXPosSb
=
pg
.
SpinBox
()
self
.
RoiYPosSb
=
pg
.
SpinBox
()
self
.
RoiYPosSb
=
pg
.
SpinBox
()
self
.
grid
.
addWidget
(
self
.
RoiXPosSb
,
4
,
0
)
self
.
grid
.
addWidget
(
self
.
RoiXPosSb
,
5
,
0
)
self
.
grid
.
addWidget
(
self
.
RoiYPosSb
,
4
,
1
)
self
.
grid
.
addWidget
(
self
.
RoiYPosSb
,
5
,
1
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi X Size'
),
5
,
0
)
'Roi X Size'
),
6
,
0
)
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
self
.
grid
.
addWidget
(
QtWidgets
.
QLabel
(
'Roi Y Size'
),
5
,
1
)
'Roi Y Size'
),
6
,
1
)
self
.
RoiXPosSb
=
pg
.
SpinBox
()
self
.
RoiXPosSb
=
pg
.
SpinBox
()
self
.
RoiYPosSb
=
pg
.
SpinBox
()
self
.
RoiYPosSb
=
pg
.
SpinBox
()
self
.
grid
.
addWidget
(
self
.
RoiXPosSb
,
6
,
0
)
self
.
grid
.
addWidget
(
self
.
RoiXPosSb
,
7
,
0
)
self
.
grid
.
addWidget
(
self
.
RoiYPosSb
,
6
,
1
)
self
.
grid
.
addWidget
(
self
.
RoiYPosSb
,
7
,
1
)
self
.
roiLayout
=
QtWidgets
.
QHBoxLayout
()
self
.
saveRoiButton
=
QtWidgets
.
QPushButton
(
'Save Roi'
)
self
.
saveToRoiButton
=
QtWidgets
.
QPushButton
(
'Save Roi As'
)
self
.
loadRoiButton
=
QtWidgets
.
QPushButton
(
'Load Roi'
)
self
.
grid
.
addWidget
(
self
.
saveRoiButton
,
8
,
0
)
self
.
grid
.
addWidget
(
self
.
loadRoiButton
,
8
,
1
)
self
.
grid
.
addWidget
(
self
.
saveToRoiButton
,
9
,
1
)
#self.grid.addWidget(self.roiLayout, 7, 0, 1, 2)
self
.
make_connections
()
self
.
make_connections
()
self
.
show
()
self
.
show
()
...
...
subclasses/cameraParameterTree.py
View file @
edbb4267
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
"""
"""
from
pyqtgraph.Qt
import
QtCore
,
QtGui
from
pyqtgraph.Qt
import
QtCore
,
QtGui
import
pyqtgraph.parametertree.parameterTypes
as
pTypes
import
pyqtgraph.parametertree.parameterTypes
as
pTypes
from
pyqtgraph.parametertree
import
Parameter
,
ParameterTree
from
pyqtgraph.parametertree
import
Parameter
,
ParameterTree
...
@@ -90,13 +88,16 @@ class CameraParameterTree(ParameterTree):
...
@@ -90,13 +88,16 @@ class CameraParameterTree(ParameterTree):
for
p
in
self
.
p
.
child
(
'Basic acq parameters'
)
.
children
():
for
p
in
self
.
p
.
child
(
'Basic acq parameters'
)
.
children
():
print
(
p
.
name
(),
p
.
value
())
print
(
p
.
name
(),
p
.
value
())
@
QtCore
.
pyqtSlot
()
def
save
(
self
,
location
=
'config.ini'
):
def
save
(
self
,
location
=
'config.ini'
):
settings
=
QSettings
(
str
(
location
),
QSettings
.
IniFormat
)
settings
=
QSettings
(
str
(
location
),
QSettings
.
IniFormat
)
settings
.
beginGroup
(
'Camera'
)
settings
.
beginGroup
(
'Camera'
)
for
parameter
in
self
.
p
.
child
(
'Basic acq parameters'
)
.
children
():
for
parameter
in
self
.
p
.
child
(
'Basic acq parameters'
)
.
children
():
settings
.
setValue
(
parameter
.
name
(),
parameter
.
value
())
settings
.
setValue
(
parameter
.
name
(),
parameter
.
value
())
settings
.
endGroup
()
settings
.
endGroup
()
print
(
'Tree saved'
)
@
QtCore
.
pyqtSlot
()
def
load
(
self
,
location
=
'config.ini'
):
def
load
(
self
,
location
=
'config.ini'
):
settings
=
QSettings
(
str
(
location
),
QSettings
.
IniFormat
)
settings
=
QSettings
(
str
(
location
),
QSettings
.
IniFormat
)
settings
.
beginGroup
(
'Camera'
)
settings
.
beginGroup
(
'Camera'
)
...
...
subclasses/pyqtgraph_subclasses.py
View file @
edbb4267
...
@@ -4,7 +4,8 @@ Some sub-classes from pyqtgraph.
...
@@ -4,7 +4,8 @@ Some sub-classes from pyqtgraph.
"""
"""
from
pyqtgraph
import
ROI
from
pyqtgraph
import
ROI
from
PyQt5.QtCore
import
QSettings
,
pyqtSlot
from
PyQt5.QtWidgets
import
QFileDialog
class
CustomRectangularROI
(
ROI
):
class
CustomRectangularROI
(
ROI
):
...
@@ -40,8 +41,7 @@ class CustomRectangularROI(ROI):
...
@@ -40,8 +41,7 @@ class CustomRectangularROI(ROI):
self
.
addScaleHandle
([
1
,
1
],
[
0
,
0
])
self
.
addScaleHandle
([
1
,
1
],
[
0
,
0
])
self
.
addScaleHandle
([
0
,
0
],
[
1
,
1
])
self
.
addScaleHandle
([
0
,
0
],
[
1
,
1
])
self
.
current_binning
=
''
#self.sigRegionChangeFinished.connect(self.correct_scaling)
def
correct_scaling
(
self
):
def
correct_scaling
(
self
):
x
,
y
=
self
.
pos
()[
0
],
self
.
pos
()[
1
]
x
,
y
=
self
.
pos
()[
0
],
self
.
pos
()[
1
]
...
@@ -51,4 +51,44 @@ class CustomRectangularROI(ROI):
...
@@ -51,4 +51,44 @@ class CustomRectangularROI(ROI):
sx
,
sy
=
self
.
size
()[
0
],
self
.
size
()[
1
]
sx
,
sy
=
self
.
size
()[
0
],
self
.
size
()[
1
]
if
sx
%
8
!=
0
or
sy
%
8
!=
0
:
if
sx
%
8
!=
0
or
sy
%
8
!=
0
:
self
.
setSize
((
sx
//
8
)
*
8
,
(
sy
//
8
)
*
8
)
self
.
setSize
((
sx
//
8
)
*
8
,
(
sy
//
8
)
*
8
)
\ No newline at end of file
@
pyqtSlot
()
def
save
(
self
,
current_binning
=
''
,
location
=
'config.ini'
):
settings
=
QSettings
(
str
(
location
),
QSettings
.
IniFormat
)
settings
.
beginGroup
(
'Roi'
)
settings
.
setValue
(
'Binning'
,
current_binning
)
settings
.
setValue
(
'PositionX'
,
self
.
pos
()[
0
])
settings
.
setValue
(
'PositionY'
,
self
.
pos
()[
1
])
settings
.
setValue
(
'SizeX'
,
self
.
size
()[
0
])
settings
.
setValue
(
'SizeY'
,
self
.
size
()[
1
])
settings
.
endGroup
()
print
(
'roi saved'
)
@
pyqtSlot
()
def
load
(
self
,
current_binning
=
''
,
location
=
'config.ini'
):
settings
=
QSettings
(
str
(
location
),
QSettings
.
IniFormat
)
settings
.
beginGroup
(
'Roi'
)
saved_binning
=
settings
.
value
(
'Binning'
)
posX
=
settings
.
value
(
'PositionX'
)
posY
=
settings
.
value
(
'PositionY'
)
sizeX
=
settings
.
value
(
'SizeX'
)
sizeY
=
settings
.
value
(
'SizeY'
)
settings
.
endGroup
()
self
.
setPos
([
posX
,
posY
])
self
.
setSize
([
sizeX
,
sizeY
])
self
.
repositionRoi
(
saved_binning
,
current_binning
)
def
repositionRoi
(
self
,
old_binning
,
new_binning
):
aux_dict
=
{
'1x1'
:
2048
,
'2x2'
:
1024
,
'4x4'
:
512
,
'8x8'
:
256
}
old_size
=
aux_dict
[
old_binning
]
new_size
=
aux_dict
[
new_binning
]
x
,
y
,
sx
,
sy
=
self
.
pos
()[
0
],
self
.
pos
()[
1
],
self
.
size
()[
0
],
self
.
size
()[
1
]
new_x
,
new_y
=
new_size
/
old_size
*
x
,
new_size
/
old_size
*
y
new_sx
,
new_sy
=
new_size
/
old_size
*
sx
,
new_size
/
old_size
*
sy
self
.
setPos
([
new_x
,
new_y
])
self
.
setSize
([
new_sx
,
new_sy
])
\ No newline at end of file
zylaCameraWorker.py
View file @
edbb4267
...
@@ -38,7 +38,7 @@ class CameraWorker(QtCore.QObject):
...
@@ -38,7 +38,7 @@ class CameraWorker(QtCore.QObject):
def
make_connections
(
self
,
frontend
):
def
make_connections
(
self
,
frontend
):
# frontend connections
# frontend connections
live_acq_params
=
frontend
.
param_t
ree
.
p
live_acq_params
=
frontend
.
cameraParamFrame
.
paramT
ree
.
p
frontend
.
cameraButton
.
clicked
.
connect
(
lambda
:
self
.
run
(
live_acq_params
))
frontend
.
cameraButton
.
clicked
.
connect
(
lambda
:
self
.
run
(
live_acq_params
))
frontend
.
signalWithMeasurementParameters
.
connect
(
self
.
simple_scan_measurement_start
)
frontend
.
signalWithMeasurementParameters
.
connect
(
self
.
simple_scan_measurement_start
)
frontend
.
roiDataReadySignal
.
connect
(
self
.
save_data_from_scan_step
)
frontend
.
roiDataReadySignal
.
connect
(
self
.
save_data_from_scan_step
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment