-
Notifications
You must be signed in to change notification settings - Fork 67
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
ENH Add crop pipeline #247
Conversation
I'll put a slicerator release on my todo list for next week unless you can get to it sooner. |
@danielballan I'll do the release now |
I would like to start adding some more pipelines, but this has to go in first |
What is the current state of this? |
Hi @caspervdw, we'd like to add this very old PR to the new pims release! Do you have time to update the PR or should we do it? |
@rbnvrw I merged master and attempted to fix an incompatibility with numpy |
@rbnvrw It seems that slicerator has become incompatible with the newest numpy. |
Thanks @caspervdw ! I'm not sure the problem is the newest numpy—our "legacy" Travis environment uses the ancient numpy 1.8.2 and still had similar errors as the other environments, such as this:
I may be able to take a closer look myself. Worst case, we can just hold this PR until a minor release. |
@caspervdw I think your commits fixed everything, except for a small mistake. The tests pass now. Could you please check that I got this right? |
Thanks for spotting that! Everything is ok now. |
Great! Thanks @caspervdw for writing such a useful and logical feature! I'm glad it will get released. |
This adds a cropping pipeline that correctly changes the
frame_shape
attribute. I decided to keep the API the same as that ofskimage.util.crop
. There are many other pipelines that we could implement (for instance, rewritenormalize
andto_rgb
frompims.display
, but I think it is a good idea to stay close to skimage and where possible, just import the functions instead of redoing it.A general approach for that would be testing the function on the first frame at
__init__
, recording the changed attributes, and exposing them automatically. That might save us a fair amount of work, and the performance loss would be not too bad. This would be apims
functionality, as it would be specific to images (frame_shape
,pixel_type
, etc.).In this case of
crop
, I did end up copying over the code.As it makes use of soft-matter/slicerator#21 , we need a slicerator release to get the tests working.