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

axis length regionprops is incorrect for 3D data #5993

Closed
grlee77 opened this issue Oct 28, 2021 · 0 comments · Fixed by #6013
Closed

axis length regionprops is incorrect for 3D data #5993

grlee77 opened this issue Oct 28, 2021 · 0 comments · Fixed by #6013

Comments

@grlee77
Copy link
Contributor

grlee77 commented Oct 28, 2021

Description

The formula in returning the major and minor axis lengths seems to be specific to 2D ellipses, but there is no restriction on the user calling this function on 3D data.

https://forum.image.sc/t/scikit-image-regionprops-minor-axis-length-in-3d-gives-first-minor-radius-regardless-of-whether-it-is-actually-the-shortest/59273/2

In my response in the forum post, I gave an algorithm based on the description here for an ImageJ tool:
https://imagejdocu.list.lu/tutorial/plugins/3d_ellipsoid

Way to reproduce

import numpy as np

from skimage.measure import regionprops
from skimage import draw

e = draw.ellipsoid(20, 10, 50).astype(int)
stats = regionprops(e)

print(stats[0]['minor_axis_length'])
print(stats[0]['major_axis_length'])

39.96593417262304
96.4629444283893

The major axis length is close to the expected value of 100, but the minor axis length of 40 reported here is much larger than the expected value of 20.

With the function I gave in the forum, the result is:

ellipsoid_axis_lengths(stats[0]['moments_central'])

(100.15219508248649, 40.01140312339376, 19.891769352179885)

Version information

skimage 0.19.dev0 development branch

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 a pull request may close this issue.

1 participant