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
3a85bbc2
Commit
3a85bbc2
authored
7 years ago
by
Joshua Steer
Browse files
Options
Downloads
Patches
Plain Diff
Modified AmpObject so any changes to arrays continue to ampActor
parent
57b90d01
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
+12
-7
12 additions, 7 deletions
AmpScan/AmpScanGUI.py
AmpScan/ampVis.py
+16
-7
16 additions, 7 deletions
AmpScan/ampVis.py
AmpScan/core.py
+6
-5
6 additions, 5 deletions
AmpScan/core.py
AmpScan/smooth.py
+1
-1
1 addition, 1 deletion
AmpScan/smooth.py
with
35 additions
and
20 deletions
AmpScan/AmpScanGUI.py
+
12
−
7
View file @
3a85bbc2
import
sys
import
numpy
as
np
from
vtk.util
import
numpy_support
from
.core
import
AmpObject
from
.registration
import
registration
from
.ampVis
import
qtVtkWindow
...
...
@@ -79,18 +80,22 @@ class AmpScanGUI(QMainWindow):
self
.
renWin
.
setScalarBar
(
self
.
RegObj
.
actor
)
def
analyse
(
self
):
self
.
RegObj
.
plot_slices
()
#self.RegObj.plot_slices()
self
.
AmpObj
.
rotate
([
50
,
50
,
10
],
ang
=
'
deg
'
)
self
.
vtkWidget
.
render
()
#self.AmpObj.vert[0,0] = 1
#self.AmpObj._v = numpy_support.numpy_to_vtk(self.AmpObj.vert)
def
chooseFE
(
self
):
FEname
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
filter
=
"
FE results (*.npy)
"
)
self
.
renWin
.
setnumViewports
(
1
)
self
.
AmpObj
.
addFE
([
FEname
[
0
],])
self
.
AmpObj
.
lp_smooth
(
'
FE
'
,
n
=
1
)
self
.
AmpObj
.
addActor
(
stype
=
'
FE
'
,
CMap
=
self
.
AmpObj
.
CMap02P
,
bands
=
5
)
self
.
AmpObj
.
actor
s
[
'
FE
'
]
.
setScalarRange
(
smin
=
0.0
,
smax
=
50
)
self
.
renWin
.
renderActors
(
self
.
AmpObj
.
actors
,
[
'
FE
'
,]
,
shading
=
True
)
self
.
renWin
.
setScalarBar
(
self
.
AmpObj
.
actors
[
'
FE
'
]
)
self
.
FE
=
AmpObj
ect
([
FEname
[
0
],]
,
stype
=
'
FE
'
)
self
.
AmpObj
.
lp_smooth
()
self
.
AmpObj
.
addActor
(
CMap
=
self
.
AmpObj
.
CMap02P
,
bands
=
5
)
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
):
vName
=
QFileDialog
.
getOpenFileName
(
self
,
'
Open file
'
,
...
...
This diff is collapsed.
Click to expand it.
AmpScan/ampVis.py
+
16
−
7
View file @
3a85bbc2
...
...
@@ -233,14 +233,16 @@ class visMixin(object):
"""
self
.
actor
=
self
.
ampActor
()
#self._v = numpy_support.numpy_to_vtk(self.vert, deep=0)
self
.
actor
.
setVert
(
self
.
vert
)
self
.
actor
.
setFaces
(
self
.
faces
)
#self.actor.setNorm()
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
.
actor
.
lut
)
self
.
actor
.
setNorm
()
class
ampActor
(
vtk
.
vtkActor
):
"""
...
...
@@ -253,7 +255,6 @@ class visMixin(object):
self
.
mesh
=
vtk
.
vtkPolyData
()
self
.
points
=
vtk
.
vtkPoints
()
self
.
polys
=
vtk
.
vtkCellArray
()
self
.
norm
=
vtk
.
vtkPolyDataNormals
()
self
.
Mapper
=
vtk
.
vtkPolyDataMapper
()
#self.setVert(data['vert'])
#self.setFaces(data['faces'])
...
...
@@ -272,6 +273,7 @@ class visMixin(object):
def
setVert
(
self
,
vert
,
deep
=
0
):
self
.
_v
=
numpy_support
.
numpy_to_vtk
(
vert
,
deep
=
deep
)
self
.
points
.
SetData
(
self
.
_v
)
# self.points.SetData(vert)
self
.
mesh
.
SetPoints
(
self
.
points
)
def
setFaces
(
self
,
faces
,
deep
=
0
):
...
...
@@ -281,12 +283,19 @@ class visMixin(object):
self
.
polys
.
SetCells
(
len
(
faces
),
self
.
_f
)
self
.
mesh
.
SetPolys
(
self
.
polys
)
def
setNorm
(
self
,
split
=
False
):
def
setNorm
(
self
,
split
=
False
,
norm
=
None
,
deep
=
0
):
"""
Check if deepcopy is neededin this function
"""
self
.
norm
.
SetInputData
(
self
.
mesh
)
if
norm
is
not
None
:
self
.
_n
=
numpy_support
.
numpy_to_vtk
(
norm
,
deep
=
deep
)
self
.
mesh
.
GetPointData
().
SetNormals
(
self
.
_n
)
else
:
self
.
norm
=
vtk
.
vtkPolyDataNormals
()
self
.
norm
.
ComputePointNormalsOn
()
self
.
norm
.
ComputeCellNormalsOff
()
self
.
norm
.
SetFeatureAngle
(
30.0
)
self
.
norm
.
SetInputData
(
self
.
mesh
)
self
.
norm
.
Update
()
self
.
mesh
.
DeepCopy
(
self
.
norm
.
GetOutput
())
self
.
GetProperty
().
SetInterpolationToGouraud
()
...
...
This diff is collapsed.
Click to expand it.
AmpScan/core.py
+
6
−
5
View file @
3a85bbc2
...
...
@@ -116,7 +116,7 @@ class AmpObject(trimMixin, smoothMixin, analyseMixin,
self
.
calcStruct
()
def
calcStruct
(
self
,
norm
=
True
,
edges
=
True
,
edgeFaces
=
True
,
faceEdges
=
True
,
vNorm
=
Tru
e
):
edgeFaces
=
True
,
faceEdges
=
True
,
vNorm
=
Fals
e
):
if
norm
is
True
:
self
.
calcNorm
()
if
edges
is
True
:
...
...
@@ -196,6 +196,7 @@ class AmpObject(trimMixin, smoothMixin, analyseMixin,
def
calcVNorm
(
self
):
"""
Function to compute the vertex normals
Not required for the AmpActor but may be needed for ICP
"""
f
=
self
.
faces
.
flatten
()
o_idx
=
f
.
argsort
()
...
...
@@ -242,7 +243,7 @@ class AmpObject(trimMixin, smoothMixin, analyseMixin,
trans: array-like
1x3 array of the tranlation in [x, y, z]
"""
self
.
vert
+=
trans
self
.
vert
[:]
+=
trans
def
centre
(
self
):
"""
...
...
@@ -250,9 +251,9 @@ class AmpObject(trimMixin, smoothMixin, analyseMixin,
"""
self
.
translate
(
-
self
.
vert
.
mean
(
axis
=
0
))
def
rotate
(
self
,
rot
):
R
=
rotMatrix
(
rot
)
self
.
vert
=
np
.
dot
(
self
.
vert
,
np
.
transpose
(
R
))
def
rotate
(
self
,
rot
,
ang
=
'
rad
'
):
R
=
rotMatrix
(
rot
,
ang
)
self
.
vert
[:,
:]
=
np
.
dot
(
self
.
vert
,
np
.
transpose
(
R
))
def
man_rot
(
self
,
rot
):
"""
...
...
This diff is collapsed.
Click to expand it.
AmpScan/smooth.py
+
1
−
1
View file @
3a85bbc2
...
...
@@ -38,6 +38,6 @@ class smoothMixin(object):
# Get average of each array
vert
=
[
vert
.
mean
(
axis
=
0
)
for
vert
in
spl
]
# Write to the AmpObj
self
.
vert
=
np
.
array
(
vert
)
self
.
vert
[:,
:]
=
np
.
array
(
vert
)
\ 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