| Title: | Quantitative Analysis of Gray Leaf Spot Colonies from Plate Images |
|---|---|
| Description: | Quantitative phenotyping of gray leaf spot (Cercospora zeae-maydis) fungal colonies grown on petri dishes. The package segments colonies from time-lapse plate photographs using a bundled SmallUNet deep-learning model, extracts morphometric and texture features (area, eccentricity, crack coverage, radial profile), and provides tidy result objects together with template ggplot2 visualisations. Python dependencies are managed automatically through basilisk; no manual environment setup is required. |
| Authors: | Rohan R [aut, cre, cph] |
| Maintainer: | Rohan R <[email protected]> |
| License: | Apache License (>= 2.0) | file LICENSE |
| Version: | 0.99.0 |
| Built: | 2026-05-27 11:01:39 UTC |
| Source: | https://github.com/rotsl/grayleafspotr |
Extracts the results table from a grayleafspot_run object and normalises
column aliases so that downstream plotting helpers see a consistent schema.
as_grayleafspot_growth_data(x)as_grayleafspot_growth_data(x)
x |
A |
A tibble::tibble() with one row per image.
Returns the small example run shipped with the package under
inst/extdata/example/. Useful for exploring the plotting helpers without
needing to run the analysis pipeline.
example_grayleafspot_results()example_grayleafspot_results()
A grayleafspot_run object.
Calls the bundled Python pipeline, performs dish detection and SmallUNet
segmentation on each image, and returns a grayleafspot_run object with
tidy results and template plots.
grayleafspot_analyze( input_dir, output_dir = "outputs", filenames = NULL, plate_diameter_mm = 90, run_name = NULL, save_outputs = TRUE, verbose = TRUE, python = NULL, engine_model = "localunet" )grayleafspot_analyze( input_dir, output_dir = "outputs", filenames = NULL, plate_diameter_mm = 90, run_name = NULL, save_outputs = TRUE, verbose = TRUE, python = NULL, engine_model = "localunet" )
input_dir |
Character. Path to the folder containing plate images
(JPEG, PNG, BMP, TIFF, or WEBP). Images must include a day token in their
filename (e.g. |
output_dir |
Character. Base output directory. A timestamped sub-folder
is created for each run. Defaults to |
filenames |
Optional character vector. Names of specific image files
inside |
plate_diameter_mm |
Numeric. Known petri dish diameter in mm (default 90). |
run_name |
Optional character. Human-readable suffix appended to the timestamped run folder name. |
save_outputs |
Logical. If |
verbose |
Logical. Print the saved run path to the console. |
python |
Optional character. Advanced override: path to a specific
Python executable. Overrides |
engine_model |
Character. Must be |
Python dependencies are managed automatically through basilisk. No manual
Python environment setup is required for normal use. The first call will
download and configure the required packages (this may take a few minutes on
a fresh installation). Subsequent calls use the cached environment.
Developers who maintain a local Python environment can bypass basilisk by
setting the GRAYLEAFSPOTR_PYTHON environment variable to the path of
their Python interpreter; this is not required for normal users.
A grayleafspot_run S3 object with elements $run (manifest
metadata), $results (per-image data frame), and $raw_results.
grayleafspot_run() for a simpler entry point returning raw JSON.
Fetches best_area_w_0.7.pt from HuggingFace and caches it on disk. On
subsequent calls the cached file is returned immediately without re-downloading.
grayleafspot_download_model(force = FALSE, quiet = FALSE)grayleafspot_download_model(force = FALSE, quiet = FALSE)
force |
Logical. Re-download even if a cached copy already exists. |
quiet |
Logical. Suppress progress messages. |
The function looks for the model in this order:
models/best_area_w_0.7.pt relative to the package root (development).
The per-user R cache directory (tools::R_user_dir("grayleafspotr", "cache")).
Downloads from HuggingFace and saves to the user cache directory.
Invisible character string: absolute path to the downloaded model file.
When the default basilisk-managed environment is in use, this function
returns TRUE as long as basilisk is installed (the environment is
set up lazily on first pipeline run). When an explicit Python interpreter
is configured via GRAYLEAFSPOTR_PYTHON or the python argument, the
function probes that interpreter directly.
grayleafspot_python_available(python = NULL, engine_model = "localunet")grayleafspot_python_available(python = NULL, engine_model = "localunet")
python |
Optional character. Path to a specific Python executable.
If |
engine_model |
Character. Currently only |
Logical TRUE if the pipeline can run, FALSE otherwise.
This function is intended for advanced use only. Normal users do not need
to call it — the pipeline resolves its Python environment automatically via
basilisk.
grayleafspot_python_executable(python = NULL, engine_model = "localunet")grayleafspot_python_executable(python = NULL, engine_model = "localunet")
python |
Optional character. Path to a Python executable. |
engine_model |
Character. Reserved for future use; currently only
|
Resolves the Python interpreter in this priority order: the python
argument, the GRAYLEAFSPOTR_PYTHON environment variable, the
grayleafspotr.python option, and finally python3 / python from PATH.
Character string: absolute path to the resolved Python executable.
A streamlined wrapper around the SmallUNet pipeline. Python dependencies
are resolved automatically via basilisk — no manual environment setup is
required.
grayleafspot_run( input_dir, output_dir, run_name = "run", engine_model = "localunet", plate_diameter_mm = 90 )grayleafspot_run( input_dir, output_dir, run_name = "run", engine_model = "localunet", plate_diameter_mm = 90 )
input_dir |
Character. Path to the folder containing plate images. |
output_dir |
Character. Directory to write outputs into (created if absent). |
run_name |
Character. Human-readable label for the run (default
|
engine_model |
Character. Must be |
plate_diameter_mm |
Numeric. Known petri dish diameter in mm (default 90). |
library(grayleafspotr) res <- grayleafspot_run( input_dir = "path/to/images", output_dir = "outputs", run_name = "trial_01" ) res$results # per-image feature table
Set GRAYLEAFSPOTR_PYTHON in ~/.Rprofile to use a specific interpreter
(e.g. a local rvenv_arm_311). This is not needed for normal use.
# ~/.Rprofile — developer only Sys.setenv(GRAYLEAFSPOTR_PYTHON = "/path/to/rvenv_arm_311/bin/python")
A named list parsed from the pipeline JSON output, containing
$results (per-image feature records) and $run (manifest metadata).
grayleafspot_analyze() for the full-featured interface returning
a grayleafspot_run S3 object with plotting helpers.
Opens an interactive dashboard for running analyses, loading saved results, and exploring all visualizations provided by the package.
launch_grayleafspotr(...)launch_grayleafspotr(...)
... |
Arguments passed to |
Called for its side effect. Starts a Shiny app.
## Not run: launch_grayleafspotr() ## End(Not run)## Not run: launch_grayleafspotr() ## End(Not run)
Draws equivalent colony radius (mm) against time (days) as a line + point
plot using the ggplot2 theme_minimal style.
plot_colony_expansion(x)plot_colony_expansion(x)
x |
A |
A ggplot2 object.
Pearson correlation heatmap of numeric morphology features
plot_feature_heatmap(x)plot_feature_heatmap(x)
x |
A |
A ggplot2 object.
Plot relative growth rate and edge roughness
plot_growth_roughness(x)plot_growth_roughness(x)
x |
A |
A ggplot2 object.
Produces a faceted panel with colony area (mm) on one facet and
radial growth rate (mm/day) on the other. When each plate appears only once
in the data, points from all plates are connected in day order.
plot_radial_growth_area(x)plot_radial_growth_area(x)
x |
A |
A ggplot2 object.
Reads the radialProfile field from raw_results. When called with a plain
data frame, the function auto-discovers the most recent analysis.json under
outputs/ in the working directory.
plot_radial_profile(x)plot_radial_profile(x)
x |
A |
A ggplot2 object.
Plots eccentricity against crack coverage percentage, with point size proportional to colony diameter and colour encoding time (day).
plot_shape_vs_stress(x)plot_shape_vs_stress(x)
x |
A |
A ggplot2 object.
Plot crack coverage and crack count over time
plot_stress_remodeling(x)plot_stress_remodeling(x)
x |
A |
A ggplot2 object.
Plot texture entropy and center-to-edge intensity delta over time
plot_texture_organization(x)plot_texture_organization(x)
x |
A |
A ggplot2 object.
Loads a run directory (containing analysis.json, analysis.csv, and
manifest.json) or a single JSON / CSV file and returns a
grayleafspot_run object.
read_grayleafspot_results(path)read_grayleafspot_results(path)
path |
Character. Path to a run directory or to an individual
|
A grayleafspot_run object with elements $run, $results, and
$raw_results.
Serialises a list of result records to analysis.json, analysis.csv, and
manifest.json under output_dir and returns a grayleafspot_run object.
write_grayleafspot_results( results, output_dir, engine = "python-local", engine_model = "packaged-python-pipeline", run_name = NULL )write_grayleafspot_results( results, output_dir, engine = "python-local", engine_model = "packaged-python-pipeline", run_name = NULL )
results |
A list of per-image result records (as produced by the Python
pipeline or |
output_dir |
Character. Directory to write outputs into (created if absent). |
engine |
Character. Engine label stored in the manifest. |
engine_model |
Character. Engine-model label stored in the manifest. |
run_name |
Optional character. Human-readable run name for the manifest. |
A grayleafspot_run object.