1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Description: cast masks to np.int8.
This fixes test failures with numpy 2.3.0.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1117755
Forwarded: https://github.com/nipy/nipy/pull/590
Last-Update: 2025-10-24
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- nipy.orig/nipy/labs/viz_tools/coord_tools.py
+++ nipy/nipy/labs/viz_tools/coord_tools.py
@@ -91,7 +91,7 @@
map = np.asarray(map)
my_map = map.copy()
if mask is not None:
- slice_x, slice_y, slice_z = ndimage.find_objects(mask)[0]
+ slice_x, slice_y, slice_z = ndimage.find_objects(np.int8(mask))[0]
my_map = my_map[slice_x, slice_y, slice_z]
mask = mask[slice_x, slice_y, slice_z]
my_map *= mask
@@ -104,7 +104,7 @@
np.abs(my_map[my_map !=0]).ravel(), 80)
mask = np.abs(my_map) > activation_threshold-1.e-15
mask = largest_cc(mask)
- slice_x, slice_y, slice_z = ndimage.find_objects(mask)[0]
+ slice_x, slice_y, slice_z = ndimage.find_objects(np.int8(mask))[0]
my_map = my_map[slice_x, slice_y, slice_z]
mask = mask[slice_x, slice_y, slice_z]
my_map *= mask
@@ -132,7 +132,7 @@
The affine should be diagonal or diagonal-permuted.
"""
(xmin, xmax), (ymin, ymax), (zmin, zmax) = get_bounds(mask.shape, affine)
- slices = ndimage.find_objects(mask)
+ slices = ndimage.find_objects(np.int8(mask))
if len(slices) == 0:
warnings.warn("empty mask", stacklevel=2)
else:
|