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

Introduce a consistent naming scheme for measure.regionprops #5254

Merged
merged 9 commits into from
Aug 16, 2021

Conversation

maxfrei750
Copy link
Contributor

Description

Closes #5213.

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@maxfrei750 maxfrei750 changed the title Introduce a conistent naming scheme for measure.regionprops Introduce a consistent naming scheme for measure.regionprops Mar 3, 2021
@emmanuelle
Copy link
Member

@maxfrei750 thanks for the PR! Is the PR a proof of concept that should be merged for 1.0 or do you intend to have it merged ASAP? In the latter case we should keep the old names as well for compatibility (and just return the new prop of course).

@maxfrei750
Copy link
Contributor Author

@emmanuelle In #5213 @jni proposed to merge this in version 1.0, so I'd keep it that way, if you agree.

@maxfrei750
Copy link
Contributor Author

@emmanuelle Does this PR need any changes to be merged in 1.0?

@grlee77
Copy link
Contributor

grlee77 commented Mar 11, 2021

The code here looks good to me and I think the naming scheme is better than before. I think the question is whether we want to provide a transition period in 0.19 where the old names still work, but warn users that the names will change in 1.0. @scikit-image/core what do you think?

If we do just switch the names in 1.0, we should add a summary table somewhere in the release notes to help users with the transition. Most likely we can write a short guide to the main API changes in 1.0 outside of this PR.

@grlee77 grlee77 added this to In progress in skimage2 API Mar 11, 2021
@grlee77 grlee77 added the 📜 type: API Involves API change(s) label Mar 11, 2021
@grlee77
Copy link
Contributor

grlee77 commented Apr 21, 2021

This was a related naming change discussed in #4821. While we are already changing things here, wouldn't it make sense to do this at the same time?

@maxfrei750
Copy link
Contributor Author

@grlee77 Good point. If the renaming proposed in #4821 is wanted, then I can add this here. So the question is: Is it wanted?

@VolkerH
Copy link
Contributor

VolkerH commented Apr 22, 2021

If we do just switch the names in 1.0, we should add a summary table somewhere in the release notes to help users with the transition. Most likely we can write a short guide to the main API changes in 1.0 outside of this PR.

Maybe a utililty function that can translate old names to new names would be useful for transitioning old code.

@stefanv
Copy link
Member

stefanv commented Apr 23, 2021

If we do just switch the names in 1.0, we should add a summary table somewhere in the release notes to help users with the transition. Most likely we can write a short guide to the main API changes in 1.0 outside of this PR.

Maybe a utililty function that can translate old names to new names would be useful for transitioning old code.

It may be easiest to just leave the old names in place as well, but hide them (or not advertise them).

@grlee77
Copy link
Contributor

grlee77 commented May 10, 2021

Hi @maxfrei750, the naming scheme used here looks great and I want to try and help get this in for a 0.19 release (assuming we are going to also maintain the older snake case names in an undocumented fashion (as @stefanv suggested in the prior comment))

Actually, looking at this more closely, I think the current PROPS dictionary's purpose was to maintain compatibility with an even older set of CamelCase names used in scikit-image<=0.8. So, we should not change any keys in that PROPS dictionary or we will break that backwards compatibility. I will make a PR against your branch with what I think this needs to look like to keep everything happy for old code across versions!

fix mistake made during merge from main branch in __getattr__

add comment on PROPS dictionary purpose
@grlee77
Copy link
Contributor

grlee77 commented May 10, 2021

@maxfrei750: Please see maxfrei750#1 which updates the PROPS dict in the suggested fashion and fixes a test failure that may have been introduced when I merged main here. (If you merge that PR in your fork the commits will automatically show up here).

Keep all legacy names in PROPS dictionary
@maxfrei750
Copy link
Contributor Author

@grlee77 Thanks for your contribution and especially for catching my mistake with the PROPS dictionary. That definitively could have caused some mayhem for people using older versions. 😅

@grlee77 grlee77 added this to the 0.19 milestone Jun 18, 2021
@grlee77
Copy link
Contributor

grlee77 commented Jun 26, 2021

I see that #4821 also suggested equivalent_diameter -> equivalent_diameter_area. If we are going to make that change (seems reasonable to me), then let's do it here as well.

@maxfrei750
Copy link
Contributor Author

@grlee77 Good point! Thanks for pointing that out. Feel free to incorporate this change, or I will do it myself, as soon as I find the time.

@grlee77
Copy link
Contributor

grlee77 commented Jun 26, 2021

@grlee77 Good point! Thanks for pointing that out. Feel free to incorporate this change, or I will do it myself, as soon as I find the time.

I will go ahead and add it now

@maxfrei750
Copy link
Contributor Author

@grlee77 Thanks!

@grlee77
Copy link
Contributor

grlee77 commented Jul 8, 2021

Note that when recently discussing various API-related things, there was a point brought up that "max intensity", etc. read as more clearly than "intensity max", etc. While this is true, I don't personally think that outweighs the benefit of the more coherent organization proposed here (see also discussion in #5213)

@scikit-image/core, please speak out in the next week or so if there are still any strong objections to making this change. If we are going to do it, let's get it in for 0.19.

We had also discussed whether or not to drop the undocumented legacy property names at some point, but that is more suited to a separate PR if we decide to go that route.

@stefanv
Copy link
Member

stefanv commented Jul 8, 2021

I agree that the more logical/hierarchical organization is worth the slight reduction in "intuitive" readability here. I.e., intensity_max better than max_intensity.

I am -0 on removing the legacy names—not a big deal.

@mkcor
Copy link
Member

mkcor commented Aug 10, 2021

Hi @grlee77,

Thanks for the reminder through #5169 (comment). I don't have strong objections either way. So I'm happy to follow @stefanv on this one.

@@ -397,36 +421,36 @@ def intensity_image(self):
)
return self._intensity_image[self.slice] * image

def _intensity_image_double(self):
return self.intensity_image.astype(np.double)
def _image_intensity_double(self):
Copy link
Member

Choose a reason for hiding this comment

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

Since this is an internal function, I guess the renaming wasn't necessary... Fine, though.

Copy link
Member

Choose a reason for hiding this comment

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

For example, function get_intensity_image and attribute _intensity_image are not being renamed here...

@mkcor mkcor merged commit 2692f54 into scikit-image:main Aug 16, 2021
grlee77 added a commit to grlee77/scikit-image that referenced this pull request Aug 19, 2021
…able

Follow up to scikit-imagegh-5254. This should have been deprecated in that PR
instead of removed.
grlee77 added a commit to grlee77/scikit-image that referenced this pull request Aug 19, 2021
…able

Follow up to scikit-imagegh-5254. This should have been deprecated in that PR
instead of removed.
@grlee77 grlee77 moved this from In progress to Done in skimage2 API Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📜 type: API Involves API change(s)
Projects
Development

Successfully merging this pull request may close these issues.

regionprops: consistent naming scheme
6 participants