-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Make rotate available #213
Conversation
cc @m-albert (in case this is of interest 🙂) |
@martinschorb Thanks a lot for sharing your It's great that you added tests. I'm copying some of your comments from #210 here to address them in this thread.
I had a look at the code and think that the problem regarding the timeouts is the following: These two ways of going ahead would come to my mind:
I'd tend to the second option, as anyways the
I looked into the tests and found that the problem comes from I fixed this behaviour here #216 and improved the |
Hi Marvin,
The reason why there is no way of explicitly setting Probably we could deal with both options and also enable What is the proper way of doing this? I change it in my repo and create a new PR? Cheers |
Hi Martin,
True that
I agree that the best would probably be to have both arguments there and functional. Of course, conflicting parameters such as
Any changes and commits to your branch One thing I'm wondering about is whether the testing strategy is the most convenient like this. Given that a large part of the tests actually tests the functionality of Cheers! |
I am still getting slightly wrong results when comparing an image that is transformed with the from scipy import misc
from dask_image.ndinterp import rotate
img = da.from_array(misc.ascent())
img = img[::4,::4]
im2 = rotate(img,angle)
output_shape = (9,9)
cx=img.shape[0]/2
cy=img.shape[1]/2
rx=output_shape[0]/2
ry=output_shape[1]/2
im3 = rotate(img,angle,output_shape = output_shape)
im4 = im2[cx-np.floor(rx):cx+np.ceil(rx),cy-np.floor(ry):cy+np.ceil(ry)] these have clearly different values and it is not just a translation of pixels... I'd love to have this checked by a test as well, but first need to understand where this difference comes from. |
Hey @martinschorb, I just found back our conversation here :) It seems that back then I was a bit confused on what was going on with the |
Can one of the admins verify this patch? Admins can comment |
I just ran your nice code example and realised that in the case of even values for |
add to allowlist |
I've resolved some minor conflicts between this PR branch and the dask-image main branch. |
Thanks a lot @GenevieveBuckley! I'll try to have a look at what's up with the failing tests in the next days. |
Hi all, thanks for this, it looks great, and I'm already using it in my workflow :) I see that not passing the Any thoughts about adding: if output_chunks is None:
output_chunks = input_arr.chunksize |
@gcaria I think that's a good idea! In the case of @martinschorb How's your availability and willingness to continue working on this PR? I think we're not far from finishing a useful addition to |
Hi @m-albert , |
# Conflicts: # docs/coverage.rst
Now it needs 5 more tests to get everything covered. Very simple cases, working on it ... |
Great to see all the progress on this :) Just FYI I'm traveling this week and will be happy to give feedback beginning of next week. |
these details are still not perfect:
|
I have no idea what is the problem with the GPU CI...
This line/file was never touched in any of the commits. |
I wonder if that CI failure is related to the change in versions here: In the commits there I don't see the gpuCI build check... |
Thanks for all your work here @martinschorb.
I think the GPU CI problems are unrelated to this PR and might relate to the intermittent failures observed by @GenevieveBuckley here. I tested this PR branch with cupy installed and all tests are passing locally for me. I think we can ignore this GPU CI failure in the context of this PR. Regarding the code:
Supporting an output array into which the result is directly written is probably of limited use here and I'm not sure if it's even feasible. I think you're right in that determining an output dtype is related to this. However, since 1) conversion to a different dtype can be easily achieved by casting the output array and 2) to be consistent with Another parameter we can remove is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment next to the code
dask_image/ndinterp/__init__.py
Outdated
if not all([isinstance(ax, Number) for ax in axes]): | ||
raise TypeError('axes should contain only integer values') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason for why you extend here on the scipy.ndimage.rotate
implementation?
@martinschorb, if you'd like I could work on my comments above. Would you agree to collaborate on this PR? If you agree I'd push related changes here directly and combine them with your work. We're almost there to get this through :) |
Yes, let's get this done. |
…s. Improved docstring. Modified prefilter test in rotate (and removed one for affine_transform which was testing for an unrelated UserWarning)
Alright, I took out the parameters discussed above and outsourced others to All tests are passing (the failing doc test is unrelated to this PR) and in my view we're ready to go. |
Merging now 🎉 Thank you for your wonderful contribution to Also thank you to @gcaria for your feedback and a great suggestion regarding output chunks. |
This adds the rotate function to ndimage.
I am struggling with the tests.
#210