medpy icon indicating copy to clipboard operation
medpy copied to clipboard

Anisotropic Diffusion Numpy Warning (+ solution ?)

Open StenSipma opened this issue 6 years ago • 1 comments

The current implementation of Anisotropic Diffusion gives two FutureWarnings (from numpy):

FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  matrices[i][slicer] = numpy.diff(matrices[i], axis=i)

This occurs at both usages of slicer. The solution seems to be to change slicer to a tuple. I changed both slicers like this: from slicer = [slice(1, None) if j == i else slice(None) for j in range(out.ndim)] to slicer = tuple([slice(1, None) if j == i else slice(None) for j in range(out.ndim)])

Hope it helps!

StenSipma avatar May 29 '19 10:05 StenSipma

Thanks for the notice!

loli avatar Jun 03 '19 17:06 loli

Solved in new release.

loli avatar Dec 15 '23 16:12 loli