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

extract_points_from_geometry needs to allow more geometry types #88

Closed
eberrigan opened this issue Oct 22, 2024 · 0 comments · Fixed by #91
Closed

extract_points_from_geometry needs to allow more geometry types #88

eberrigan opened this issue Oct 22, 2024 · 0 comments · Fixed by #91

Comments

@eberrigan
Copy link
Collaborator

eberrigan commented Oct 22, 2024

When running the OlderMonocotPipeline on this 10 day-old rice sample with nothing but contamination/gel deformities we get the following error

2024-10-18 17:05:49,097 - ERROR -   File "/opt/conda/lib/python3.11/site-packages/sleap_roots/points.py", line 46, in extract_points_from_geometry
2024-10-18 17:05:49,099 - ERROR - raise TypeError(f"Unsupported geometry type: {type(geometry).__name__}")
2024-10-18 17:05:49,099 - ERROR - TypeError
2024-10-18 17:05:49,100 - ERROR - :
2024-10-18 17:05:49,101 - ERROR - Unsupported geometry type: MultiLineString

because the predictions are
Image

and our current helper function does not allow for the possibility of MultiLineString.
https://github.com/talmolab/sleap-roots/blob/e5dde883ae7136161e441436f346c34420194b32/sleap_roots/points.py#L11C1-L46C81

We should consider each of the geometry types here and have tests for each geometry type.

def test_extract_from_unsupported_type():

The MultiLineString object is created since we are calling extract_points_from_geometry on the intersection with convex hull which in this case are the predictions as LineString objects.

2024-10-18 17:05:49,040 - ERROR -   File "/opt/conda/lib/python3.11/site-packages/sleap_roots/convhull.py", line 551, in get_chull_intersection_vectors
2024-10-18 17:05:49,042 - ERROR - intersect_points = extract_points_from_geometry(intersection)

# Create the extended line
extended_line = LineString(
[(x_min_extended, y_min_extended), (x_max_extended, y_max_extended)]
)
# Create a LineString that represents the perimeter of the convex hull
hull_perimeter = LineString(
hull.points[hull.vertices].tolist() + [hull.points[hull.vertices[0]].tolist()]
)
# Find the intersection between the hull perimeter and the extended line
intersection = extended_line.intersection(hull_perimeter)
# Get the intersection points
if not intersection.is_empty:
intersect_points = extract_points_from_geometry(intersection)

@eberrigan eberrigan linked a pull request Oct 29, 2024 that will close this issue
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