Skip to content

Make regionprops._slice a user-facing property - #2838

Merged
stefanv merged 1 commit into
scikit-image:masterfrom
jni:regionprop-slice
May 28, 2018
Merged

stefanv merged 1 commit into
scikit-image:masterfrom
jni:regionprop-slice

Conversation

@jni

@jni jni commented Oct 13, 2017

Copy link
Copy Markdown
Member

Currently, _slice is hidden from the user, even though it would be
a useful property in many instances (for example, extracting objects
from one channel based on the regionprops of another). In fact there
was a discussion about this when we were talking about the bounding box
property, but that went nowhere.

Checklist

[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]

For reviewers

(Don't remove the checklist below.)

  • 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.

@pep8speaks

pep8speaks commented Oct 13, 2017 •

Copy link
Copy Markdown

Hello @jni! Thanks for updating the PR.

Line 165:27: E226 missing whitespace around arithmetic operator
Line 165:45: E226 missing whitespace around arithmetic operator

Comment last updated on May 22, 2018 at 07:05 Hours UTC

@ahojnnes ahojnnes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM and seems to be a useful property.

@@ -101,6 +102,7 @@ def __init__(self, slice, label, label_image, intensity_image,
self.label = label

self._slice = slice

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we remove _slice then?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, isn't it confusing to use a reserved word here in several places?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@stefanv I'm all ears for an alternative attribute name. Note that the slice in the __init__ is old, and annoying to deprecate. self.slice is not very confusing, though, only a little bit confusing.

@soupault even though ._slice is private, I'm concerned some of our users might have accessed it. So I thought we might as well keep it around, because it's not very costly to do so.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@jni I see.
As for the name, maybe something like region_slice or slice_region?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

self.slice is probably OK. I'm more concerned with cases where the built-in gets clobbered. region_slice or slice_ work for me.

@stefanv

stefanv commented May 1, 2018

Copy link
Copy Markdown
Member

@jni Did you want to modify this further, or should we get it in?

Currently, `_slice` is hidden from the user, even though it would be
a useful property in many instances (for example, extracting objects
from one channel based on the regionprops of another). In fact there
was a discussion about this when we were talking about the bounding box
property, but that went nowhere.
@jni
jni force-pushed the regionprop-slice branch from 45bcdd9 to 12f4087 Compare May 22, 2018 07:05
@jni

jni commented May 22, 2018

Copy link
Copy Markdown
Member Author

@stefanv I'm happy with it as-is. Rebased.

@codecov-io

codecov-io commented May 22, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #2838 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2838      +/-   ##
==========================================
+ Coverage   85.91%   85.91%   +<.01%     
==========================================
  Files         336      336              
  Lines       27305    27315      +10     
==========================================
+ Hits        23459    23469      +10     
  Misses       3846     3846
Impacted Files Coverage Δ
skimage/measure/tests/test_regionprops.py 100% <100%> (ø) ⬆️
skimage/measure/_regionprops.py 97.82% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 255b4d5...12f4087. Read the comment docs.

@stefanv
stefanv merged commit ad9f839 into scikit-image:master May 28, 2018
@soupault soupault mentioned this pull request Sep 12, 2019
9 tasks
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 this pull request may close these issues.

6 participants