Scanline¶
Overview¶
Count root intersections with horizontal scan lines for distribution analysis.
Key functions:
- count_scanline_intersections - Count intersections at given y-coordinates
- get_scanline_first_ind - First intersection index
- get_scanline_last_ind - Last intersection index
Quick Example¶
import sleap_roots as sr
import numpy as np
series = sr.Series.load("plant", primary_path="primary.slp")
pts = series.get_primary_points()
# Count intersections at y=100
intersections = sr.count_scanline_intersections(pts, y=100)
print(f"Intersections at y=100: {intersections}")
API Reference¶
count_scanline_intersections¶
count_scanline_intersections ¶
count_scanline_intersections(
pts_list: List[ndarray],
height: int = 1080,
n_line: int = 50,
) -> ndarray
Count intersections of roots with a series of horizontal scanlines.
This function calculates the number of intersections between the provided primary and lateral root points and a set of horizontal scanlines. The scanlines are equally spaced across the specified height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pts_list
|
List[ndarray]
|
A list of arrays, each having shape |
required |
height
|
int
|
The height of the image or cylinder. Defaults to 1080. |
1080
|
n_line
|
int
|
Number of scanlines to use. Defaults to 50. |
50
|
Returns:
| Type | Description |
|---|---|
ndarray
|
An array with shape |
Source code in sleap_roots/scanline.py
get_scanline_first_ind¶
get_scanline_first_ind ¶
Get the index of count_scanline_interaction for the first interaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scanline_intersection_counts
|
ndarray
|
An array with shape of |
required |
Return
Scalar of count_scanline_interaction index for the first interaction.
Source code in sleap_roots/scanline.py
get_scanline_last_ind¶
get_scanline_last_ind ¶
Get the index of count_scanline_interaction for the last interaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scanline_intersection_counts
|
ndarray
|
An array with shape of |
required |
Return
Scalar of count_scanline_interaction index for the last interaction.
Source code in sleap_roots/scanline.py
Related Modules¶
- Network Length - Network metrics