Skip to content

Commit f91e0c8

Browse files
authored
fix: numpy 2.0 compatybility (#150)
1 parent 3b2171f commit f91e0c8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

mahotas/features/texture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def haralick(f,
132132
nr_dirs = len(_3d_deltas)
133133
else:
134134
raise ValueError('mahotas.texture.haralick: Can only handle 2D and 3D images.')
135-
fm1 = f.max() + 1
135+
fm1 = int(f.max()) + 1
136136
cmat = np.empty((fm1, fm1), np.int32)
137137
def all_cmatrices():
138138
for dir in range(nr_dirs):

mahotas/tests/test_texture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def test_4d_image():
171171
def rand_haralick():
172172
f = 255*np.random.random((128,128))
173173
f = f.astype(np.uint8)
174+
f[0, 0] = 255
174175
f = mh.features.haralick(f)
175176
return f.mean(0)
176177
def test_feature_non_zero():

0 commit comments

Comments
 (0)