Skip to content

major_axis_len

Compute the major axis length of a geometry.

Note

The major axis is the (x,y) endpoints of the longest line that can be drawn through the object. Major axis length is the pixel distance between the major-axis endpoints - Wirth

Parameters:

Name Type Description Default
geom Polygon

Input shapely polygon object.

required

Returns:

Name Type Description
float float

The length of the major axis.

Source code in src/histolytics/spatial_geom/morphometrics.py
def major_axis_len(geom: Polygon) -> float:
    """Compute the major axis length of a geometry.

    Note:
        The major axis is the (x,y) endpoints of the longest line that
        can be drawn through the object. Major axis length is the pixel
        distance between the major-axis endpoints
        - [Wirth](http://www.cyto.purdue.edu/cdroms/micro2/content/education/wirth10.pdf)

    Parameters:
        geom (Polygon):
            Input shapely polygon object.

    Returns:
        float:
            The length of the major axis.
    """
    return axis_len(geom, "major")