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

New feature: circularity #1011

Closed
lidakanari opened this issue Mar 23, 2022 · 1 comment
Closed

New feature: circularity #1011

lidakanari opened this issue Mar 23, 2022 · 1 comment
Assignees

Comments

@lidakanari
Copy link
Contributor

This feature needs to be implemented on the 2D projection of a morphology and it will describe the circularity in the projected plane i.e. x-y. We will therefore need to compute this in all three projections at the morphology level.

Circularity is defined as 4 * pi * area / (perimeter)^2

def circularity(pts):
    """Computes circularity as 4 pi A / P^2"""
    hull = nm.geom.ConvexHull(pts)
    area = hull.volume
    perimeter = hull.area
    return (4 * np.pi * area) / (perimeter * perimeter)
@lidakanari
Copy link
Contributor Author

For the same dataset:
TestData.zip

The expected circularity is:

circularity(circle) == 0.9878344238311306
circularity(square) == 0.8166489559832344
circularity(rectangle) == 0.6109332086629591
circularity(oval) == 0.8102300985964894

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

No branches or pull requests

2 participants