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

Add "roundness" property to regionprops #5261

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AlexanderSvan
Copy link

Description

This is adds a property to regionprops which calculates the roundness of a particle, similart to what is done in the following paper: 1. Abu-Qasmieh I (2018) Novel and Efficient Approach for Automated Separation, Segmentation, and Detection of Overlapped Elliptical Red Blood Cells. Pattern Recognit Image Anal 28:792–804. doi: 10.1134/S1054661818040156

For cell based imaging of nuclei and red blood cells this is a usefull parameter for stratification of objects into single objects/multiple objects.

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.

@pep8speaks
Copy link

pep8speaks commented Mar 8, 2021

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

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-03-08 16:59:03 UTC

@jni jni changed the title Update _regionprops.py Add "roundness" property to regionprops Mar 9, 2021
@jni
Copy link
Member

jni commented Mar 9, 2021

Hi @AlexanderSvan! 👋 And welcome.

Looking up the paper, it doesn't seem to have much traction in the community, with just one citation. We try to provide reference algorithms with proven widespread use in the community. It also appears to be a simple variant/combination of "equivalent diameter"/"major axis length". So I'm not sure whether we would want to expand the API for this. We'll have to have a discussion with @scikit-image/core.

I'll point you to the fact that regionprops allows you to define custom properties, so you can always define a function roundness and compute it. See the extra_properties argument in the regionprops documentation.

Regardless of whether we end up merging this, thank you for the contribution!

@stefanv
Copy link
Member

stefanv commented Mar 9, 2021

I didn't look too carefully, but this may be closely related to "circularity", for which there are a whole bunch of published definitions out there.

@stefanv
Copy link
Member

stefanv commented Mar 9, 2021

It's such a commonly used measure that it would be worth our while to do some research and implement the most commonly used one (or the best one, if there's a difference).

@AlexanderSvan
Copy link
Author

I have seen it used a few places and was one thing i found lacking for some of the cell segmentation pipelines i have been using skimage for, so i thought it might be a nice addition. I am not experienced with github contribution to established packages, but i though to try to make the addition as a learning task for myself, and then see if you thought it would be useful or not.

The implementation i opted for was one that relied on the parameters already present in regionprops.

@jni
Copy link
Member

jni commented Mar 10, 2021

Great @AlexanderSvan! We love that attitude here at scikit-image! 😊 Like @stefanv said, it makes sense to find e.g. the n-dimensional equivalent function to the most commonly-seen implementations in the literature. n-dimensional so that "circularity" becomes "sphericity" in 3D and so on. =)

@AlexanderSvan
Copy link
Author

I would love to try to read up on it and see if i can come up with an implementation that might solve that, though that would take some time as it happens on the side of my regular studies. What is the routine with this then. We close this one, right and then i can make a new request once i manage the better approach?

@stefanv
Copy link
Member

stefanv commented Mar 11, 2021

Excellent, thanks for taking this on! You can just keep improving this PR. Every time you make an adjustment and push up a commit into the same branch, the PR will update automatically.

@AlexanderSvan
Copy link
Author

AlexanderSvan commented Mar 11, 2021

I have a quick question i hope i can ask you. I have been looking up the best ways of implementing sphericity/circularity calculations. Implementations are simple relations between surface area and volume, with perfect circles/spheres returning 1.
For 2D objects it is easily managed as all parameters is already calculated in the regionprops class, however the 3D surface area seems to be an outstanding issue which i see other people are still working on.
From the difficulty of implementing a 3D surface area measurement, would it be worthwile making a stand alone 2D implementation, which we can change to 3D once the marching cube or another approach is implemented into regionprops for surface assessment? specifically i was looking at #3797 and #4121

@grlee77 grlee77 added the ⏩ type: Enhancement Improve existing features label Mar 11, 2021
@jni
Copy link
Member

jni commented Jan 25, 2023

@AlexanderSvan man, I'm sorry that we dropped the ball on this one and you never got a response to your question. If you are still interested in this, I would be happy to have a video chat with you next month and get this across the line. Hopefully you can find a time that works for you at https://meet.jni.codes. Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⏩ type: Enhancement Improve existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants