Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Evan Edmond
fslpy
Commits
7f0385d0
Commit
7f0385d0
authored
Jan 23, 2018
by
Paul McCarthy
🚵
Browse files
Trimesh doesn't need to be memoized anymore - internal vertex set cache is
used
parent
0467986e
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl/data/mesh.py
View file @
7f0385d0
...
...
@@ -38,7 +38,6 @@ import numpy as np
import
fsl.utils.meta
as
meta
import
fsl.utils.notifier
as
notifier
import
fsl.utils.memoize
as
memoize
import
fsl.utils.transform
as
transform
...
...
@@ -54,7 +53,7 @@ class Mesh(notifier.Notifier, meta.Meta):
A ``Mesh`` instance has the following attributes:
============== ====================================================
============== ====================================================
==
``name`` A name, typically the file name sans-suffix.
``dataSource`` Full path to the mesh file (or ``None`` if there is
...
...
@@ -74,7 +73,11 @@ class Mesh(notifier.Notifier, meta.Meta):
``vnormals`` A ``(n, 3)`` array containing vertex normals for the
the current vertices.
============== ====================================================
``trimesh`` (if the `trimesh <https://github.com/mikedh/trimesh>`_
library is present) A ``trimesh.Trimesh`` object which
can be used for geometric queries on the mesh.
============== ======================================================
**Vertex sets**
...
...
@@ -476,7 +479,7 @@ class Mesh(notifier.Notifier, meta.Meta):
return
list
(
self
.
__vertexData
.
keys
())
@
memoize
.
Instanceify
(
memoize
.
memoize
)
@
property
def
trimesh
(
self
):
"""Reference to a ``trimesh.Trimesh`` object which can be used for
geometric operations on the mesh.
...
...
@@ -528,7 +531,7 @@ class Mesh(notifier.Notifier, meta.Meta):
``n`` rays.
"""
trimesh
=
self
.
trimesh
()
trimesh
=
self
.
trimesh
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,))
...
...
@@ -567,7 +570,7 @@ class Mesh(notifier.Notifier, meta.Meta):
point to the nearest vertex.
"""
trimesh
=
self
.
trimesh
()
trimesh
=
self
.
trimesh
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,
)),
np
.
zeros
((
0
,
))
...
...
@@ -607,7 +610,7 @@ class Mesh(notifier.Notifier, meta.Meta):
triangle.
"""
trimesh
=
self
.
trimesh
()
trimesh
=
self
.
trimesh
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,
3
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment