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
GitLab 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
7a2eee7f
Commit
7a2eee7f
authored
May 3, 2018
by
Joshua Steer
Browse files
Options
Downloads
Patches
Plain Diff
Implementation of new AmpObj structure into GUI, and created file to execute the GUI
parent
ebd02fa2
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
AmpScan/AmpScanGUI.py
+9
-9
9 additions, 9 deletions
AmpScan/AmpScanGUI.py
AmpScan/ampVis.py
+37
-25
37 additions, 25 deletions
AmpScan/ampVis.py
AmpScan/core.py
+1
-0
1 addition, 0 deletions
AmpScan/core.py
AmpScan/runAmpScanGUI.py
+15
-0
15 additions, 0 deletions
AmpScan/runAmpScanGUI.py
with
62 additions
and
34 deletions
AmpScan/AmpScanGUI.py
+
9
−
9
View file @
7a2eee7f
...
@@ -37,13 +37,13 @@ class AmpScanGUI(QMainWindow):
...
@@ -37,13 +37,13 @@ class AmpScanGUI(QMainWindow):
self
.
fname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
self
.
fname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
filter
=
"
Meshes (*.stl)
"
)
filter
=
"
Meshes (*.stl)
"
)
if
self
.
AmpObj
is
not
None
:
if
self
.
AmpObj
is
not
None
:
self
.
renWin
.
renderActors
(
self
.
AmpObj
.
actor
s
,
[
])
self
.
renWin
.
renderActors
(
[
self
.
AmpObj
.
actor
,
])
self
.
AmpObj
=
AmpObject
(
self
.
fname
[
0
],
'
limb
'
)
self
.
AmpObj
=
AmpObject
(
self
.
fname
[
0
],
'
limb
'
)
self
.
AmpObj
.
addActor
(
stype
=
'
limb
'
)
self
.
AmpObj
.
addActor
()
self
.
AmpObj
.
lp_smooth
(
stype
=
'
limb
'
)
self
.
AmpObj
.
lp_smooth
()
self
.
renWin
.
setnumViewports
(
1
)
self
.
renWin
.
setnumViewports
(
1
)
self
.
renWin
.
setProjection
()
self
.
renWin
.
setProjection
()
self
.
renWin
.
renderActors
(
self
.
AmpObj
.
actor
s
,
[
'
limb
'
,])
self
.
renWin
.
renderActors
(
[
self
.
AmpObj
.
actor
,])
def
chooseSocket
(
self
):
def
chooseSocket
(
self
):
self
.
sockfname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
self
.
sockfname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
...
@@ -148,8 +148,8 @@ class AmpScanGUI(QMainWindow):
...
@@ -148,8 +148,8 @@ class AmpScanGUI(QMainWindow):
self
.
kineticMenu
=
self
.
menuBar
().
addMenu
(
"
&Kinetic Measurements
"
)
self
.
kineticMenu
=
self
.
menuBar
().
addMenu
(
"
&Kinetic Measurements
"
)
self
.
kineticMenu
.
addAction
(
self
.
openPress
)
self
.
kineticMenu
.
addAction
(
self
.
openPress
)
if
__name__
==
"
__main__
"
:
#if __name__ == "__main__":
app
=
QApplication
(
sys
.
argv
)
# app = QApplication(sys.argv)
mainWin
=
AmpScanGUI
()
# mainWin = AmpScanGUI()
mainWin
.
show
()
# mainWin.show()
sys
.
exit
(
app
.
exec_
())
# sys.exit(app.exec_())
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
AmpScan/ampVis.py
+
37
−
25
View file @
7a2eee7f
...
@@ -226,13 +226,21 @@ class visMixin(object):
...
@@ -226,13 +226,21 @@ class visMixin(object):
win
.
Render
()
win
.
Render
()
def
addActor
(
self
,
CMap
=
None
,
bands
=
128
):
def
addActor
(
self
,
CMap
=
None
,
bands
=
128
,
sRange
=
[
0
,
8
]
):
"""
"""
Function to insert a vtk actor into the actors dictionary within
Function to insert a vtk actor into the actors dictionary within
the AmpObject
the AmpObject
"""
"""
self
.
actor
=
self
.
ampActor
(
data
,
CMap
=
CMap
,
bands
=
bands
)
self
.
actor
=
self
.
ampActor
()
self
.
actor
.
setVert
(
self
.
vert
)
self
.
actor
.
setFaces
(
self
.
faces
)
if
self
.
values
is
not
None
:
self
.
actor
.
setValues
(
self
.
values
)
self
.
actor
.
setCMap
(
CMap
,
bands
)
self
.
actor
.
setScalarRange
(
sRange
)
self
.
actor
.
Mapper
.
SetLookupTable
(
self
.
lut
)
self
.
actor
.
setNorm
()
class
ampActor
(
vtk
.
vtkActor
):
class
ampActor
(
vtk
.
vtkActor
):
"""
"""
...
@@ -241,47 +249,51 @@ class visMixin(object):
...
@@ -241,47 +249,51 @@ class visMixin(object):
from numpy arrays
from numpy arrays
"""
"""
def
__init__
(
self
,
data
,
CMap
=
None
,
bands
=
128
):
def
__init__
(
self
,
CMap
=
None
,
bands
=
128
):
self
.
mesh
=
vtk
.
vtkPolyData
()
self
.
mesh
=
vtk
.
vtkPolyData
()
self
.
points
=
vtk
.
vtkPoints
()
self
.
points
=
vtk
.
vtkPoints
()
self
.
polys
=
vtk
.
vtkCellArray
()
self
.
polys
=
vtk
.
vtkCellArray
()
self
.
setVert
(
data
[
'
vert
'
])
self
.
norm
=
vtk
.
vtkPolyDataNormals
()
self
.
setFaces
(
data
[
'
faces
'
])
self
.
setNorm
()
if
CMap
is
not
None
:
self
.
setRect
(
data
[
'
values
'
])
self
.
setCMap
(
CMap
,
bands
)
self
.
Mapper
=
vtk
.
vtkPolyDataMapper
()
self
.
Mapper
=
vtk
.
vtkPolyDataMapper
()
#self.setVert(data['vert'])
#self.setFaces(data['faces'])
#self.setNorm()
#if CMap is not None:
# self.setRect(data['values'])
# self.setCMap(CMap, bands)
self
.
Mapper
.
InterpolateScalarsBeforeMappingOn
()
self
.
Mapper
.
InterpolateScalarsBeforeMappingOn
()
self
.
Mapper
.
SetInputData
(
self
.
mesh
)
self
.
Mapper
.
SetInputData
(
self
.
mesh
)
if
CMap
is
not
None
:
#
if CMap is not None:
self
.
setScalarRange
()
#
self.setScalarRange()
self
.
Mapper
.
SetLookupTable
(
self
.
lut
)
#
self.Mapper.SetLookupTable(self.lut)
self
.
SetMapper
(
self
.
Mapper
)
self
.
SetMapper
(
self
.
Mapper
)
def
setVert
(
self
,
vert
):
def
setVert
(
self
,
vert
,
deep
=
0
):
self
.
points
.
SetData
(
numpy_support
.
numpy_to_vtk
(
vert
,
deep
=
1
))
self
.
_v
=
numpy_support
.
numpy_to_vtk
(
vert
,
deep
=
deep
)
self
.
points
.
SetData
(
self
.
_v
)
self
.
mesh
.
SetPoints
(
self
.
points
)
self
.
mesh
.
SetPoints
(
self
.
points
)
def
setFaces
(
self
,
faces
):
def
setFaces
(
self
,
faces
,
deep
=
0
):
f
=
np
.
c_
[
np
.
tile
(
faces
.
shape
[
1
],
faces
.
shape
[
0
]),
self
.
_faces
=
np
.
c_
[
np
.
tile
(
faces
.
shape
[
1
],
faces
.
shape
[
0
]),
faces
].
flatten
().
astype
(
np
.
int64
)
faces
].
flatten
().
astype
(
np
.
int64
)
self
.
polys
.
SetCells
(
len
(
faces
)
,
self
.
_f
=
numpy_support
.
numpy_to_vtkIdTypeArray
(
self
.
_
faces
,
deep
=
deep
)
numpy_support
.
numpy_to_vtkIdTypeArray
(
f
,
deep
=
1
)
)
self
.
polys
.
SetCells
(
len
(
faces
),
self
.
_f
)
self
.
mesh
.
SetPolys
(
self
.
polys
)
self
.
mesh
.
SetPolys
(
self
.
polys
)
def
setNorm
(
self
,
split
=
False
):
def
setNorm
(
self
,
split
=
False
):
self
.
norm
=
vtk
.
vtkPolyDataNormals
()
"""
Check if deepcopy is neededin this function
"""
self
.
norm
.
SetInputData
(
self
.
mesh
)
self
.
norm
.
SetInputData
(
self
.
mesh
)
self
.
norm
.
SetFeatureAngle
(
30.0
)
self
.
norm
.
SetFeatureAngle
(
30.0
)
self
.
norm
.
Update
()
self
.
norm
.
Update
()
self
.
mesh
.
DeepCopy
(
self
.
norm
.
GetOutput
())
self
.
mesh
.
DeepCopy
(
self
.
norm
.
GetOutput
())
self
.
GetProperty
().
SetInterpolationToGouraud
()
self
.
GetProperty
().
SetInterpolationToGouraud
()
def
set
Rect
(
self
,
rect
):
def
set
Values
(
self
,
values
,
deep
=
0
):
self
.
scalar
s
=
numpy_support
.
numpy_to_vtk
(
rect
,
deep
=
1
)
self
.
_value
s
=
numpy_support
.
numpy_to_vtk
(
values
,
deep
=
0
)
self
.
mesh
.
GetPointData
().
SetScalars
(
self
.
scalar
s
)
self
.
mesh
.
GetPointData
().
SetScalars
(
self
.
_value
s
)
def
setOpacity
(
self
,
opacity
=
1.0
):
def
setOpacity
(
self
,
opacity
=
1.0
):
self
.
GetProperty
().
SetOpacity
(
opacity
)
self
.
GetProperty
().
SetOpacity
(
opacity
)
...
@@ -289,8 +301,8 @@ class visMixin(object):
...
@@ -289,8 +301,8 @@ class visMixin(object):
def
setColor
(
self
,
color
=
[
1.0
,
1.0
,
1.0
]):
def
setColor
(
self
,
color
=
[
1.0
,
1.0
,
1.0
]):
self
.
GetProperty
().
SetColor
(
color
)
self
.
GetProperty
().
SetColor
(
color
)
def
setScalarRange
(
self
,
s
min
=-
8.0
,
smax
=
8.0
):
def
setScalarRange
(
self
,
s
Range
):
self
.
Mapper
.
SetScalarRange
(
s
min
,
smax
)
self
.
Mapper
.
SetScalarRange
(
s
Range
[
0
],
sRange
[
1
]
)
def
setCMap
(
self
,
CMap
,
bands
=
128
):
def
setCMap
(
self
,
CMap
,
bands
=
128
):
...
...
This diff is collapsed.
Click to expand it.
AmpScan/core.py
+
1
−
0
View file @
7a2eee7f
...
@@ -54,6 +54,7 @@ class AmpObject(trimMixin, smoothMixin, analyseMixin,
...
@@ -54,6 +54,7 @@ class AmpObject(trimMixin, smoothMixin, analyseMixin,
self
.
CMapN2P
=
np
.
transpose
(
CMap
)
/
255.0
self
.
CMapN2P
=
np
.
transpose
(
CMap
)
/
255.0
self
.
CMap02P
=
np
.
flip
(
np
.
transpose
(
CMap1
)
/
255.0
,
axis
=
0
)
self
.
CMap02P
=
np
.
flip
(
np
.
transpose
(
CMap1
)
/
255.0
,
axis
=
0
)
self
.
stype
=
stype
self
.
stype
=
stype
self
.
values
=
None
if
stype
is
'
FE
'
:
if
stype
is
'
FE
'
:
self
.
addFE
([
Data
,])
self
.
addFE
([
Data
,])
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
AmpScan/runAmpScanGUI.py
0 → 100644
+
15
−
0
View file @
7a2eee7f
# -*- coding: utf-8 -*-
"""
Created on Wed May 2 20:21:07 2018
@author: Josh
"""
import
AmpScan
as
ampS
from
PyQt5.QtWidgets
import
QApplication
import
sys
if
__name__
==
"
__main__
"
:
app
=
QApplication
(
sys
.
argv
)
mainWin
=
ampS
.
AmpScanGUI
()
mainWin
.
show
()
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
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