Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
AmpScan
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Joshua Steer
AmpScan
Commits
2ba496ae
Commit
2ba496ae
authored
5 years ago
by
jack-parsons
Browse files
Options
Downloads
Patches
Plain Diff
Preventing crash when no file is selected.
Now just exits safely when no file is selected by file manager
parent
cb1bb43e
Branches
Branches containing commit
No related tags found
1 merge request
!23
Merge in Jack's changes
Pipeline
#879
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GUIs/AmpScanGUI.py
+53
-38
53 additions, 38 deletions
GUIs/AmpScanGUI.py
with
53 additions
and
38 deletions
GUIs/AmpScanGUI.py
+
53
−
38
View file @
2ba496ae
...
@@ -107,16 +107,19 @@ class AmpScanGUI(QMainWindow):
...
@@ -107,16 +107,19 @@ class AmpScanGUI(QMainWindow):
Numpy style docstring.
Numpy style docstring.
"""
"""
self
.
alCont
=
AlignControls
(
self
.
filesDrop
,
self
)
if
self
.
objectsReady
(
1
):
self
.
alCont
.
show
()
self
.
alCont
=
AlignControls
(
self
.
filesDrop
,
self
)
self
.
alCont
.
centre
.
clicked
.
connect
(
self
.
centreMesh
)
self
.
alCont
.
show
()
self
.
alCont
.
icp
.
clicked
.
connect
(
self
.
runICP
)
self
.
alCont
.
centre
.
clicked
.
connect
(
self
.
centreMesh
)
self
.
alCont
.
xrotButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
rotatex
)
self
.
alCont
.
icp
.
clicked
.
connect
(
self
.
runICP
)
self
.
alCont
.
yrotButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
rotatey
)
self
.
alCont
.
xrotButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
rotatex
)
self
.
alCont
.
zrotButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
rotatez
)
self
.
alCont
.
yrotButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
rotatey
)
self
.
alCont
.
xtraButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
transx
)
self
.
alCont
.
zrotButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
rotatez
)
self
.
alCont
.
ytraButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
transy
)
self
.
alCont
.
xtraButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
transx
)
self
.
alCont
.
ztraButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
transz
)
self
.
alCont
.
ytraButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
transy
)
self
.
alCont
.
ztraButton
.
buttonClicked
[
QAbstractButton
].
connect
(
self
.
transz
)
else
:
show_message
(
"
Must be at least 1 object loaded to run align
"
)
def
rotatex
(
self
,
button
):
def
rotatex
(
self
,
button
):
moving
=
str
(
self
.
alCont
.
moving
.
currentText
())
moving
=
str
(
self
.
alCont
.
moving
.
currentText
())
...
@@ -178,29 +181,31 @@ class AmpScanGUI(QMainWindow):
...
@@ -178,29 +181,31 @@ class AmpScanGUI(QMainWindow):
self
.
renWin
.
Render
()
self
.
renWin
.
Render
()
def
runICP
(
self
):
def
runICP
(
self
):
if
self
.
objectsReady
(
1
):
static
=
str
(
self
.
alCont
.
static
.
currentText
())
static
=
str
(
self
.
alCont
.
static
.
currentText
())
moving
=
str
(
self
.
alCont
.
moving
.
currentText
())
moving
=
str
(
self
.
alCont
.
moving
.
currentText
())
al
=
align
(
self
.
files
[
moving
],
self
.
files
[
static
],
al
=
align
(
self
.
files
[
moving
],
self
.
files
[
static
],
maxiter
=
10
,
method
=
'
linPoint2Plane
'
).
m
maxiter
=
10
,
method
=
'
linPoint2Plane
'
).
m
al
.
tform
=
vtk
.
vtkTransform
()
al
.
tform
=
vtk
.
vtkTransform
()
al
.
tform
.
PostMultiply
()
al
.
tform
.
PostMultiply
()
al
.
addActor
()
al
.
addActor
()
al
.
actor
.
SetUserTransform
(
al
.
tform
)
al
.
actor
.
SetUserTransform
(
al
.
tform
)
alName
=
moving
+
'
_al
'
alName
=
moving
+
'
_al
'
self
.
files
[
alName
]
=
al
self
.
files
[
alName
]
=
al
self
.
filesDrop
.
append
(
alName
)
self
.
filesDrop
.
append
(
alName
)
self
.
fileManager
.
addRow
(
alName
,
self
.
files
[
alName
])
self
.
fileManager
.
addRow
(
alName
,
self
.
files
[
alName
])
self
.
fileManager
.
setTable
(
static
,
[
1
,
0
,
0
],
0.5
,
2
)
self
.
fileManager
.
setTable
(
static
,
[
1
,
0
,
0
],
0.5
,
2
)
self
.
fileManager
.
setTable
(
moving
,
[
1
,
1
,
1
],
1
,
0
)
self
.
fileManager
.
setTable
(
moving
,
[
1
,
1
,
1
],
1
,
0
)
self
.
fileManager
.
setTable
(
alName
,
[
0
,
0
,
1
],
0.5
,
2
)
self
.
fileManager
.
setTable
(
alName
,
[
0
,
0
,
1
],
0.5
,
2
)
if
hasattr
(
self
,
'
alCont
'
):
if
hasattr
(
self
,
'
alCont
'
):
self
.
alCont
.
getNames
()
self
.
alCont
.
getNames
()
if
hasattr
(
self
,
'
regCont
'
):
if
hasattr
(
self
,
'
regCont
'
):
self
.
regCont
.
getNames
()
self
.
regCont
.
getNames
()
else
:
show_message
(
"
Must be at least 2 objects loaded to run ICP
"
)
def
runRegistration
(
self
):
def
runRegistration
(
self
):
if
len
(
self
.
files
)
>=
2
:
if
self
.
objectsReady
(
2
)
:
# Needs to be at least 2 files to run registration
# Needs to be at least 2 files to run registration
c1
=
[
31.0
,
73.0
,
125.0
]
c1
=
[
31.0
,
73.0
,
125.0
]
c3
=
[
170.0
,
75.0
,
65.0
]
c3
=
[
170.0
,
75.0
,
65.0
]
...
@@ -260,13 +265,15 @@ class AmpScanGUI(QMainWindow):
...
@@ -260,13 +265,15 @@ class AmpScanGUI(QMainWindow):
"""
"""
FEname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
FEname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
filter
=
"
FE results (*.npy)
"
)
filter
=
"
FE results (*.npy)
"
)
self
.
renWin
.
setnumViewports
(
1
)
if
FEname
[
0
]
!=
""
:
# Check that there was a file selected
self
.
FE
=
AmpObject
([
FEname
[
0
],],
stype
=
'
FE
'
)
print
(
FEname
)
self
.
AmpObj
.
lp_smooth
()
self
.
renWin
.
setnumViewports
(
1
)
self
.
AmpObj
.
addActor
(
CMap
=
self
.
AmpObj
.
CMap02P
,
bands
=
5
)
self
.
FE
=
AmpObject
([
FEname
[
0
],],
stype
=
'
FE
'
)
# TODO check this is correct - AmpObject expects dicts or strings
self
.
AmpObj
.
actor
.
setScalarRange
(
smin
=
0.0
,
smax
=
50
)
self
.
AmpObj
.
lp_smooth
()
self
.
renWin
.
renderActors
(
self
.
FE
.
actor
,
shading
=
True
)
self
.
AmpObj
.
addActor
(
CMap
=
self
.
AmpObj
.
CMap02P
,
bands
=
5
)
self
.
renWin
.
setScalarBar
(
self
.
FE
.
actor
)
self
.
AmpObj
.
actor
.
setScalarRange
(
smin
=
0.0
,
smax
=
50
)
self
.
renWin
.
renderActors
(
self
.
FE
.
actor
,
shading
=
True
)
self
.
renWin
.
setScalarBar
(
self
.
FE
.
actor
)
def
choosePress
(
self
):
def
choosePress
(
self
):
"""
"""
...
@@ -275,8 +282,12 @@ class AmpScanGUI(QMainWindow):
...
@@ -275,8 +282,12 @@ class AmpScanGUI(QMainWindow):
"""
"""
vName
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
vName
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
filter
=
"
Sensor vertices (*.csv)
"
)
filter
=
"
Sensor vertices (*.csv)
"
)
if
vName
[
0
]
==
""
:
# If no file selected, exit
return
pName
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
pName
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
filter
=
"
Sensor pressures (*.csv)
"
)
filter
=
"
Sensor pressures (*.csv)
"
)
if
pName
[
0
]
==
""
:
# If no file selected, exit
return
self
.
renWin
.
setnumViewports
(
1
)
self
.
renWin
.
setnumViewports
(
1
)
self
.
pSense
=
pressSense
()
self
.
pSense
=
pressSense
()
self
.
pSense
.
calcFaces
(
d
=
5
)
self
.
pSense
.
calcFaces
(
d
=
5
)
...
@@ -333,6 +344,10 @@ class AmpScanGUI(QMainWindow):
...
@@ -333,6 +344,10 @@ class AmpScanGUI(QMainWindow):
self
.
analyseMenu
.
addAction
(
self
.
analyse
)
self
.
analyseMenu
.
addAction
(
self
.
analyse
)
self
.
kineticMenu
=
self
.
menuBar
().
addMenu
(
"
&Kinetic Measurements
"
)
self
.
kineticMenu
=
self
.
menuBar
().
addMenu
(
"
&Kinetic Measurements
"
)
self
.
kineticMenu
.
addAction
(
self
.
openPress
)
self
.
kineticMenu
.
addAction
(
self
.
openPress
)
def
objectsReady
(
self
,
num
):
return
len
(
self
.
files
)
>=
num
class
fileManager
(
QMainWindow
):
class
fileManager
(
QMainWindow
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment