Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
7f0385d0
Commit
7f0385d0
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Trimesh doesn't need to be memoized anymore - internal vertex set cache is
used
parent
0467986e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/mesh.py
+10
-7
10 additions, 7 deletions
fsl/data/mesh.py
with
10 additions
and
7 deletions
fsl/data/mesh.py
+
10
−
7
View file @
7f0385d0
...
@@ -38,7 +38,6 @@ import numpy as np
...
@@ -38,7 +38,6 @@ import numpy as np
import
fsl.utils.meta
as
meta
import
fsl.utils.meta
as
meta
import
fsl.utils.notifier
as
notifier
import
fsl.utils.notifier
as
notifier
import
fsl.utils.memoize
as
memoize
import
fsl.utils.transform
as
transform
import
fsl.utils.transform
as
transform
...
@@ -54,7 +53,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -54,7 +53,7 @@ class Mesh(notifier.Notifier, meta.Meta):
A ``Mesh`` instance has the following attributes:
A ``Mesh`` instance has the following attributes:
============== ====================================================
============== ====================================================
==
``name`` A name, typically the file name sans-suffix.
``name`` A name, typically the file name sans-suffix.
``dataSource`` Full path to the mesh file (or ``None`` if there is
``dataSource`` Full path to the mesh file (or ``None`` if there is
...
@@ -74,7 +73,11 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -74,7 +73,11 @@ class Mesh(notifier.Notifier, meta.Meta):
``vnormals`` A ``(n, 3)`` array containing vertex normals for the
``vnormals`` A ``(n, 3)`` array containing vertex normals for the
the current vertices.
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**
**Vertex sets**
...
@@ -476,7 +479,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -476,7 +479,7 @@ class Mesh(notifier.Notifier, meta.Meta):
return
list
(
self
.
__vertexData
.
keys
())
return
list
(
self
.
__vertexData
.
keys
())
@
memoize.Instanceify
(
memoize
.
memoize
)
@
property
def
trimesh
(
self
):
def
trimesh
(
self
):
"""
Reference to a ``trimesh.Trimesh`` object which can be used for
"""
Reference to a ``trimesh.Trimesh`` object which can be used for
geometric operations on the mesh.
geometric operations on the mesh.
...
@@ -528,7 +531,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -528,7 +531,7 @@ class Mesh(notifier.Notifier, meta.Meta):
``n`` rays.
``n`` rays.
"""
"""
trimesh
=
self
.
trimesh
()
trimesh
=
self
.
trimesh
if
trimesh
is
None
:
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,))
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,))
...
@@ -567,7 +570,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -567,7 +570,7 @@ class Mesh(notifier.Notifier, meta.Meta):
point to the nearest vertex.
point to the nearest vertex.
"""
"""
trimesh
=
self
.
trimesh
()
trimesh
=
self
.
trimesh
if
trimesh
is
None
:
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,
)),
np
.
zeros
((
0
,
))
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,
)),
np
.
zeros
((
0
,
))
...
@@ -607,7 +610,7 @@ class Mesh(notifier.Notifier, meta.Meta):
...
@@ -607,7 +610,7 @@ class Mesh(notifier.Notifier, meta.Meta):
triangle.
triangle.
"""
"""
trimesh
=
self
.
trimesh
()
trimesh
=
self
.
trimesh
if
trimesh
is
None
:
if
trimesh
is
None
:
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,
3
))
return
np
.
zeros
((
0
,
3
)),
np
.
zeros
((
0
,
3
))
...
...
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