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
b915b42d
Commit
b915b42d
authored
6 years ago
by
Joshua Steer
Browse files
Options
Downloads
Patches
Plain Diff
Updates to trim
parent
09df22ef
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
AmpScan/ampVis.py
+6
-3
6 additions, 3 deletions
AmpScan/ampVis.py
AmpScan/trim.py
+22
-21
22 additions, 21 deletions
AmpScan/trim.py
with
28 additions
and
24 deletions
AmpScan/ampVis.py
+
6
−
3
View file @
b915b42d
...
@@ -289,7 +289,7 @@ class visMixin(object):
...
@@ -289,7 +289,7 @@ class visMixin(object):
def
genIm
(
self
,
size
=
[
512
,
512
],
views
=
[[
0
,
-
1
,
0
]],
def
genIm
(
self
,
size
=
[
512
,
512
],
views
=
[[
0
,
-
1
,
0
]],
background
=
[
1.0
,
1.0
,
1.0
],
projection
=
True
,
background
=
[
1.0
,
1.0
,
1.0
],
projection
=
True
,
shading
=
True
,
mag
=
10
,
out
=
'
im
'
,
fh
=
'
test.tiff
'
,
shading
=
True
,
mag
=
10
,
out
=
'
im
'
,
fh
=
'
test.tiff
'
,
zoom
=
1.0
,
az
=
0
,
crop
=
False
):
zoom
=
1.0
,
az
=
0
,
crop
=
False
,
cam
=
None
):
r
"""
r
"""
Creates a temporary off screen vtkRenWin which is then either returned
Creates a temporary off screen vtkRenWin which is then either returned
as a numpy array or saved as a .png file
as a numpy array or saved as a .png file
...
@@ -326,6 +326,7 @@ class visMixin(object):
...
@@ -326,6 +326,7 @@ class visMixin(object):
self
.
addActor
()
self
.
addActor
()
# Generate a renderer window
# Generate a renderer window
win
=
vtkRenWin
()
win
=
vtkRenWin
()
win
.
OffScreenRenderingOn
()
# Set the number of viewports
# Set the number of viewports
win
.
setnumViewports
(
len
(
views
))
win
.
setnumViewports
(
len
(
views
))
# Set the background colour
# Set the background colour
...
@@ -334,13 +335,15 @@ class visMixin(object):
...
@@ -334,13 +335,15 @@ class visMixin(object):
win
.
setProjection
(
projection
)
win
.
setProjection
(
projection
)
win
.
SetSize
(
size
[
0
],
size
[
1
])
win
.
SetSize
(
size
[
0
],
size
[
1
])
win
.
Modified
()
win
.
Modified
()
win
.
OffScreenRenderingOn
()
for
i
,
view
in
enumerate
(
views
):
for
i
,
view
in
enumerate
(
views
):
# win.addAxes([self.actor,], color=[0.0, 0.0, 0.0], viewport=i)
# win.addAxes([self.actor,], color=[0.0, 0.0, 0.0], viewport=i)
win
.
setView
(
view
,
i
)
win
.
setView
(
view
,
i
)
# win.setProjection(projection, viewport=i)
# win.setProjection(projection, viewport=i)
win
.
renderActors
([
self
.
actor
,],
zoom
=
zoom
)
win
.
renderActors
([
self
.
actor
,],
zoom
=
zoom
)
win
.
rens
[
0
].
GetActiveCamera
().
Azimuth
(
az
)
win
.
rens
[
0
].
GetActiveCamera
().
Azimuth
(
az
)
if
cam
is
not
None
:
win
.
rens
[
0
].
SetActiveCamera
(
cam
)
win
.
Render
()
win
.
Render
()
if
out
==
'
im
'
:
if
out
==
'
im
'
:
im
=
win
.
getImage
()
im
=
win
.
getImage
()
...
@@ -351,7 +354,7 @@ class visMixin(object):
...
@@ -351,7 +354,7 @@ class visMixin(object):
mask
=
np
.
all
(
im
==
1
,
axis
=
2
)
mask
=
np
.
all
(
im
==
1
,
axis
=
2
)
mask
=
~
np
.
all
(
mask
,
axis
=
0
)
mask
=
~
np
.
all
(
mask
,
axis
=
0
)
im
=
im
[:,
mask
,
:]
im
=
im
[:,
mask
,
:]
return
im
return
im
,
win
elif
out
==
'
fh
'
:
elif
out
==
'
fh
'
:
win
.
getScreenshot
(
fh
)
win
.
getScreenshot
(
fh
)
return
return
...
...
This diff is collapsed.
Click to expand it.
AmpScan/trim.py
+
22
−
21
View file @
b915b42d
...
@@ -30,7 +30,7 @@ class trimMixin(object):
...
@@ -30,7 +30,7 @@ class trimMixin(object):
>>>
amp
.
planarTrim
(
100
,
2
)
>>>
amp
.
planarTrim
(
100
,
2
)
"""
"""
if
typ
e
(
height
)
==
float
:
#
if
isinstanc
e(height
,
float
)
:
# planar values for each vert on face
# planar values for each vert on face
fv
=
self
.
vert
[
self
.
faces
,
plane
]
fv
=
self
.
vert
[
self
.
faces
,
plane
]
# Number points on each face are above cut plane
# Number points on each face are above cut plane
...
@@ -49,6 +49,7 @@ class trimMixin(object):
...
@@ -49,6 +49,7 @@ class trimMixin(object):
self
.
faces
=
self
.
faces
[
fvlogic
!=
3
,
:]
self
.
faces
=
self
.
faces
[
fvlogic
!=
3
,
:]
self
.
faces
=
vInd
[
self
.
faces
]
self
.
faces
=
vInd
[
self
.
faces
]
self
.
vert
=
self
.
vert
[
~
delv
,
:]
self
.
vert
=
self
.
vert
[
~
delv
,
:]
self
.
values
=
self
.
values
[
~
delv
]
self
.
calcStruct
()
self
.
calcStruct
()
else
:
# else:
raise
TypeError
(
"
height arg must be a float
"
)
# raise TypeError("height arg must be a float")
\ No newline at end of file
\ 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