From 1b97e99aa43044cae33c0c22c351615a3a20fd62 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Sun, 21 Jan 2018 12:38:05 +0000
Subject: [PATCH] Mesh.__init__ accepts fixWinding for initial vertex set.

---
 fsl/data/mesh.py | 10 +++++++++-
 fsl/data/vtk.py  |  9 ++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/fsl/data/mesh.py b/fsl/data/mesh.py
index 2bc563b87..ee0681a21 100644
--- a/fsl/data/mesh.py
+++ b/fsl/data/mesh.py
@@ -136,7 +136,12 @@ class Mesh(notifier.Notifier, meta.Meta):
     """
 
 
-    def __init__(self, indices, name='mesh', dataSource=None, vertices=None):
+    def __init__(self,
+                 indices,
+                 name='mesh',
+                 dataSource=None,
+                 vertices=None,
+                 fixWinding=False):
         """Create a ``Mesh`` instance.
 
         Before a ``Mesh`` can be used, some vertices must be added via the
@@ -151,6 +156,9 @@ class Mesh(notifier.Notifier, meta.Meta):
 
         :arg vertices:   Initial vertex set to add - given the key
                          ``'default'``.
+
+        :arg fixWinding: Ignored if ``vertices is None``. Passed through to the
+                         :meth:`addVertices` method along with ``vertices``.
         """
 
         self.__name       = name
diff --git a/fsl/data/vtk.py b/fsl/data/vtk.py
index 1a05070ee..e34d4146d 100644
--- a/fsl/data/vtk.py
+++ b/fsl/data/vtk.py
@@ -60,9 +60,12 @@ class VTKMesh(fslmesh.Mesh):
             raise RuntimeError('All polygons in VTK file must be '
                                'triangles ({})'.format(infile))
 
-        fslmesh.Mesh.__init__(self, indices, name, dataSource)
-
-        self.addVertices(data, 'default', fixWinding=fixWinding)
+        fslmesh.Mesh.__init__(self,
+                              indices,
+                              name,
+                              dataSource,
+                              vertices=data,
+                              fixWinding=fixWinding)
 
 
 def loadVTKPolydataFile(infile):
-- 
GitLab