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

Question about coverting outputs json to csv after following multi plant image processing tutorial #1459

Open
tatum-milana opened this issue Feb 20, 2024 · 1 comment

Comments

@tatum-milana
Copy link

Good afternoon everyone,
I followed the tutorial for multi plant image processing located at this link (https://plantcv.readthedocs.io/en/stable/tutorials/multi-plant_tutorial/) .

At the end of the code, it runs
analysis_image = pcv.analyze.size(img=rotate_img, labeled_mask=labeled_objects2, n_labels=n_obj2)
pcv.outputs.save_results(filename=args.result)

From here, I want to save the resulting json file as a csv file, but I have been running into many issues.
I have tried running plantcv.utils.json2csv; but was met with an error saying that the json was not properly formatted , so I tried running plantcv.parallel.process_results before the conversion command and I got errors saying the json file was missing a metadata key.
Any ideas on the best way to convert to CSV file after following the multi plant image processing tutorial?

thank you in advance!

@nfahlgren
Copy link
Member

Hi @tatum-milana, in principle the process_results approach should have worked, I am not certain why it produced an error about a metadata key. The intermediate JSON files (produced by pcv.outputs.save_results are not compatible with json2csv because it works on the JSON file produced at the end of a batch analysis using the tool plantcv-run-workflow.

What could work for you instead is to directly output CSV, which can only be done in Jupyter or a single script analysis (not in batch/parallel). To do that you would change the save results command to:

pcv.outputs.save_results(filename=args.result, outformat="csv")

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