From ebd14e279a5753ebd4d7a499c7856e3ea134d1c0 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Sat, 25 Jan 2020 12:22:23 +0000
Subject: [PATCH] BF: Force mesh indices to be integers. Remove unnecessary
 Mesh.__new__.

---
 fsl/data/mesh.py | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/fsl/data/mesh.py b/fsl/data/mesh.py
index 383afcb17..30b4548f5 100644
--- a/fsl/data/mesh.py
+++ b/fsl/data/mesh.py
@@ -154,14 +154,6 @@ class Mesh(notifier.Notifier, meta.Meta):
     """
 
 
-    def __new__(cls, *args, **kwargs):
-        """Create a ``Mesh``. We must override ``__new__``, otherwise the
-        :class:`Meta` and :class:`Notifier` ``__new__`` methods will not be
-        called correctly.
-        """
-        return super(Mesh, cls).__new__(cls, *args, **kwargs)
-
-
     def __init__(self,
                  indices,
                  name='mesh',
@@ -189,7 +181,7 @@ class Mesh(notifier.Notifier, meta.Meta):
 
         self.__name       = name
         self.__dataSource = dataSource
-        self.__nvertices  = indices.max() + 1
+        self.__nvertices  = int(indices.max()) + 1
         self.__selected   = None
 
         # We potentially store two copies of
@@ -197,7 +189,7 @@ class Mesh(notifier.Notifier, meta.Meta):
         # orders. The vindices dict stores refs
         # to one or the other for each vertex
         # set.
-        self.__indices      = np.asarray(indices).reshape((-1, 3))
+        self.__indices      = np.asarray(indices, dtype=np.int32).reshape((-1, 3))
         self.__fixedIndices = None
         self.__vindices     = collections.OrderedDict()
 
-- 
GitLab