Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anisotropic Diffusion Numpy Warning (+ solution ?) #90

Closed
StenSipma opened this issue May 29, 2019 · 2 comments
Closed

Anisotropic Diffusion Numpy Warning (+ solution ?) #90

StenSipma opened this issue May 29, 2019 · 2 comments
Assignees

Comments

@StenSipma
Copy link

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!

@loli loli self-assigned this Jun 3, 2019
@loli loli added this to the MedPy1.0.0 milestone Jun 3, 2019
@loli
Copy link
Owner

loli commented Jun 3, 2019

Thanks for the notice!

@loli
Copy link
Owner

loli commented Dec 15, 2023

Solved in new release.

@loli loli closed this as completed Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants