diff --git a/fsl/data/mesh.py b/fsl/data/mesh.py index 713cd463d5aa57614f9230afa2414f4bf44559ec..5e9856dfa145c95d3c4d2188963deda06fae292b 100644 --- a/fsl/data/mesh.py +++ b/fsl/data/mesh.py @@ -27,6 +27,8 @@ import numpy as np import six +import trimesh + import fsl.utils.transform as transform from . import image as fslimage @@ -121,6 +123,11 @@ class TriangleMesh(object): if fixWinding: self.__fixWindingOrder() + self.__trimesh = trimesh.Trimesh(self.__vertices, + self.__indices, + process=False, + validate=False) + def __repr__(self): """Returns a string representation of this ``TriangleMesh`` instance. @@ -147,6 +154,14 @@ class TriangleMesh(object): return self.__indices + @property + def trimesh(self): + """Reference to a ``trimesh.Trimesh`` object which can be used for + geometric operations on the mesh. + """ + return self.__trimesh + + def __fixWindingOrder(self): """Called by :meth:`__init__` if ``fixWinding is True``. Fixes the mesh triangle winding order so that all face normals are facing