From 48b09f6507b056807917a076cc79646240ac4cf4 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 19 Feb 2021 11:06:05 +0000
Subject: [PATCH] MNT: Silence numpy deprecation warnings

---
 fsl/data/imagewrapper.py    | 2 +-
 fsl/data/mesh.py            | 2 +-
 fsl/transform/affine.py     | 4 ++--
 fsl/utils/image/resample.py | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fsl/data/imagewrapper.py b/fsl/data/imagewrapper.py
index b7d5b3577..771f288a2 100644
--- a/fsl/data/imagewrapper.py
+++ b/fsl/data/imagewrapper.py
@@ -733,7 +733,7 @@ def isValidFancySliceObj(sliceobj, shape):
     # We only support boolean numpy arrays
     # which have the same shape as the image
     return (isinstance(sliceobj, np.ndarray) and
-            sliceobj.dtype == np.bool        and
+            sliceobj.dtype == bool           and
             np.prod(sliceobj.shape) == np.prod(shape))
 
 
diff --git a/fsl/data/mesh.py b/fsl/data/mesh.py
index 30b4548f5..b03a628e2 100644
--- a/fsl/data/mesh.py
+++ b/fsl/data/mesh.py
@@ -701,7 +701,7 @@ def calcVertexNormals(vertices, indices, fnormals):
                    the mesh.
     """
 
-    vnormals = np.zeros((vertices.shape[0], 3), dtype=np.float)
+    vnormals = np.zeros((vertices.shape[0], 3), dtype=float)
 
     # TODO make fast. I can't figure
     # out how to use np.add.at to
diff --git a/fsl/transform/affine.py b/fsl/transform/affine.py
index 47bdd4b37..119c5335f 100644
--- a/fsl/transform/affine.py
+++ b/fsl/transform/affine.py
@@ -627,8 +627,8 @@ def rescale(oldShape, newShape, origin=None):
     if origin is None:
         origin = 'centre'
 
-    oldShape = np.array(oldShape, dtype=np.float)
-    newShape = np.array(newShape, dtype=np.float)
+    oldShape = np.array(oldShape, dtype=float)
+    newShape = np.array(newShape, dtype=float)
     ndim     = len(oldShape)
 
     if len(oldShape) != len(newShape):
diff --git a/fsl/utils/image/resample.py b/fsl/utils/image/resample.py
index f5918fad2..9f82be659 100644
--- a/fsl/utils/image/resample.py
+++ b/fsl/utils/image/resample.py
@@ -209,7 +209,7 @@ def resample(image,
        np.all(np.isclose(matrix, np.eye(len(newShape) + 1))):
         return data, image.voxToWorldMat
 
-    newShape = np.array(np.round(newShape), dtype=np.int)
+    newShape = np.array(np.round(newShape), dtype=int)
 
     # Apply smoothing if requested,
     # and if not using nn interp
-- 
GitLab