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

WIP: Overhaul transform module #3148

Closed
wants to merge 1 commit into from
Closed

Conversation

kne42
Copy link
Contributor

@kne42 kne42 commented Jun 3, 2018

Refactorizations & Deprecations

  • refactor transform module to transform_xy
  • create new transform_rc module
  • create wrapper transform module around transform_xy with automatic deprecation messages

Changes (implemented in transform_rc)

  • switch to numpy-style coordinates (row, column)
  • add nD support
  • improve transformation machinery using scipy's LowLevelCallables

Other

@pep8speaks
Copy link

pep8speaks commented Jun 3, 2018

Hello @kne42! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 221:80: E501 line too long (86 > 79 characters)
Line 354:80: E501 line too long (80 > 79 characters)
Line 391:48: W504 line break after binary operator
Line 392:49: W504 line break after binary operator
Line 414:49: W504 line break after binary operator

Line 105:80: E501 line too long (80 > 79 characters)
Line 172:24: E226 missing whitespace around arithmetic operator

Line 27:1: E305 expected 2 blank lines after class or function definition, found 1

Line 6:80: E501 line too long (80 > 79 characters)
Line 7:80: E501 line too long (80 > 79 characters)

Line 86:34: E241 multiple spaces after ','
Line 87:22: E241 multiple spaces after ','
Line 87:39: E241 multiple spaces after ','

Comment last updated at 2019-04-06 00:49:31 UTC

@kne42
Copy link
Contributor Author

kne42 commented Jun 3, 2018

cc @jni

@jni
Copy link
Member

jni commented Jun 12, 2018

@kne42 Since this is going to touch so many files, it's important for the commit messages to be extremely thorough, and for the commits to be nicely separated. Specifically, I suggest making one commit for moving transform/ to transform_xy/, another for creating the alias for transform -> transform_xy, together with a deprecation message, and another for creating transform_rc.

Also, for the initial transform_rc "port", you could simply use the existing warps functions, but transpose the coordinates. This would let us actually merge this and then add nD capabilities little by little.

What do you think?

@kne42
Copy link
Contributor Author

kne42 commented Jun 12, 2018

@jni

Since this is going to touch so many files, it's important for the commit messages to be extremely thorough, and for the commits to be nicely separated. Specifically, I suggest making one commit for moving transform/ to transform_xy/, another for creating the alias for transform -> transform_xy, together with a deprecation message, and another for creating transform_rc.

While I do agree on making the commit messages thorough, I typically prefer to group commits together with message prefixes and then squash them prior to a merge. However, I suppose that this, being the massive change that it is, warrants individual commit messages for each task at hand.

Also, for the initial transform_rc "port", you could simply use the existing warps functions, but transpose the coordinates. This would let us actually merge this and then add nD capabilities little by little.

Oooh yes I like this idea! Cleans up PR history too :P

@kne42
Copy link
Contributor Author

kne42 commented Jun 15, 2018

Oopsies, that was an accident!

Anyways, @jni lmk if you spot me missing anything! This is a pretty large change so I'm not quite sure if I covered everything necessary/went too far.

Also, for the functions that are already nD/take in full-on images instead of just coordinates, do you think that we should put them in skimage.transform and just import them into skimage.transform_xy and skimage.transform_rc?

@kne42 kne42 reopened this Jun 15, 2018
Copy link
Member

@jni jni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kne42 Unless I missed it, this doesn't yet handle the transform deprecation or the creation of transform_rc?

And, to answer your question, yes, I think I was too optimistic in recommending the wholesale move of transform->transform_xy. I think only the parts depending on _warp need to be moved...

@@ -36,7 +36,7 @@
from sklearn.metrics import roc_auc_score

from skimage.data import lfw_subset
from skimage.transform import integral_image
from skimage.transform_xy import integral_image
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm kinda thinking that the examples should be updated to use transform_rc...

@@ -37,7 +37,7 @@ def resize(image, output_shape, order=1, mode='reflect', cval=0, clip=True,
Performs interpolation to up-size or down-size images. Note that anti-
aliasing should be enabled when down-sizing images to avoid aliasing
artifacts. For down-sampling N-dimensional images with an integer factor
also see `skimage.transform.downscale_local_mean`.
also see `skimage.transform_xy.downscale_local_mean`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite my initial suggestion, I think I'd like to apply a bit of smarts to this migration... Specifically, transforms that don't rely on coordinate conventions, such as this one, should not be deprecated/migrated.

In other words, to answer your question: yes I think we should only migrate the transforms that rely on x/y coordinates. I think that's a large proportion, but maybe I'm wrong...

@@ -208,7 +208,7 @@ def rescale(image, scale, order=1, mode='reflect', cval=0, clip=True,
----------------
order : int, optional
The order of the spline interpolation, default is 1. The order has to
be in the range 0-5. See `skimage.transform.warp` for detail.
be in the range 0-5. See `skimage.transform_xy.warp` for detail.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned about the documentation. Generally, when we deprecate, we want to point to the new way of doing things. The only reason to keep the old way hanging around is for backwards compatibility. But anyone new who checks the docs should be pointed to the One True Way of doing things, and that's the new way.

@kne42 kne42 mentioned this pull request May 4, 2019
8 tasks
Base automatically changed from master to main February 18, 2021 18:23
@lagru
Copy link
Member

lagru commented Feb 16, 2023

Hey everyone, what is the status of this PR? Is this something you or we as a team want to pick at some point? I'm asking because I'm preparing a proposal for an Outreachy project that would focus on our transform module.

@jni
Copy link
Member

jni commented Apr 3, 2023

@lagru I would say that this should at this point get subsumed into the skimage2 plans, so we can close this.

@jni jni closed this Apr 3, 2023
Registration and warping automation moved this from In progress to Done Apr 3, 2023
@lagru
Copy link
Member

lagru commented Apr 3, 2023

Fine by me. I added it to https://hackmd.io/@mkcor/HyYOmLnaO so that it's not forgotten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants