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 traits using DicotPipeline #66

Closed
linwang9926 opened this issue Sep 22, 2023 · 0 comments
Closed

Extract traits using DicotPipeline #66

linwang9926 opened this issue Sep 22, 2023 · 0 comments

Comments

@linwang9926
Copy link
Collaborator

linwang9926 commented Sep 22, 2023

Error when extracting traits for canola and soybean.
Error message: GEOSException: IllegalArgumentException: point array must contain 0 or >1 elements

Code to reproduce the error:

import sleap_roots as sr
import os

###### TODO: change the final_datasets folder #####
os.chdir("C:/Work/4_Plant_Phenomics_SLEAP/6_SLEAP_github/final_datasets") 
#%% canola
data_folders = """
Canola_subset/subset_h5files_predictions_proofread
""".strip().split()

# Primary root prediction file ending: {barcode}.{primary_name}.predictions.slp 
primary_name = "primary_multi_day"
# Lateral root prediction file ending: {barcode}.{lateral_name}.predictions.slp 
lateral_name = "lateral_3_nodes"
# When `write_csv = True` a csv with the root traits will be saved at the `csv_path`
write_csv = True
dir_name = "./Canola_subset"
csv_path = f"{dir_name}/canola_subset_proofread_traits.csv"

# Each series is expected to have 72 images. Series with a different number of frames will be excluded from the analysis.
n_imgs_expected = 72

# Find all of the plants in the `data_folders`
plants = sr.find_all_series(data_folders)

# Load series
all_series = [sr.Series.load(p, primary_name=primary_name, lateral_name=lateral_name) for p in plants]
print(f"Loaded {len(all_series)} series.")

# Filter by expected images
all_series = [series for series in all_series if len(series) == n_imgs_expected]
print(f"Kept {len(all_series)} series after filtering by number of images ({n_imgs_expected} expected).")

# Compute the traits using the `DicotPipeline`
pipeline = sr.DicotPipeline()
# Dataframe with summary statistics of root traits for all of the plants found in the `data_folders`
all_traits_df = pipeline.compute_batch_traits(all_series, write_csv=write_csv, csv_path=csv_path)

Detailed information on the error:
"
Cell In[55], line 1
all_traits_df = pipeline.compute_batch_traits(all_series, write_csv=write_csv, csv_path=csv_path)

File C:\Work\4_Plant_Phenomics_SLEAP\6_SLEAP_github\sleap-roots\sleap_roots\trait_pipelines.py:361 in compute_batch_traits
plant_traits = self.compute_plant_traits(plant)

File C:\Work\4_Plant_Phenomics_SLEAP\6_SLEAP_github\sleap-roots\sleap_roots\trait_pipelines.py:306 in compute_plant_traits
frame_traits = self.compute_frame_traits(initial_traits)

File C:\Work\4_Plant_Phenomics_SLEAP\6_SLEAP_github\sleap-roots\sleap_roots\trait_pipelines.py:254 in compute_frame_traits
traits[trait_name] = trait_def.fn(

File C:\Work\4_Plant_Phenomics_SLEAP\6_SLEAP_github\sleap-roots\sleap_roots\networklength.py:201 in get_network_distribution
root_poly = LineString(root)

File ~\Anaconda3\envs\sleap_roots_v0922\lib\site-packages\shapely\geometry\linestring.py:73 in new
geom = shapely.linestrings(coordinates)

File ~\Anaconda3\envs\sleap_roots_v0922\lib\site-packages\shapely\decorators.py:77 in wrapped
return func(*args, **kwargs)

File ~\Anaconda3\envs\sleap_roots_v0922\lib\site-packages\shapely\creation.py:120 in linestrings
return lib.linestrings(coords, out=out, **kwargs)

GEOSException: IllegalArgumentException: point array must contain 0 or >1 elements
"

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

No branches or pull requests

2 participants