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

Slicing issue in TV-denoising gradient #3

Open
lesaintjerome opened this issue Jul 6, 2023 · 0 comments · May be fixed by #4
Open

Slicing issue in TV-denoising gradient #3

lesaintjerome opened this issue Jul 6, 2023 · 0 comments · May be fixed by #4

Comments

@lesaintjerome
Copy link

The gradient function in the reconstruction/tv_denoising.py file fails due to slicing problem.

Cell In[60], line 23, in gradient(img)
     21 slice_all = [0, slice(None, -1),]
     22 for d in range(img.ndim):
---> 23     gradient[slice_all] = np.diff(img, axis=d)
     24     slice_all[0] = d + 1
     25     slice_all.insert(1, slice(None))

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Converting the list to a tuple gradient[tuple(slice_all)] = np.diff(x, axis=d) seems to work fine.

@lesaintjerome lesaintjerome linked a pull request Jul 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant