Writes a QuPath program directory: a declarative run.json (schema
segmantR-qupath-run-v1), the readable Groovy templates, the resources
they bind (a neutral interchange bundle or a hashed model copy), a
run_export.json for the way back, checksums.sha256 and a README.md
with the interactive and command-line invocations. segmantR never starts
QuPath, Java or Groovy itself.
Usage
sg_export_qupath(
x,
destination,
...,
image = NULL,
image_name = NULL,
model = NULL,
region_policy = c("whole_image", "selected_annotations", "all_annotations"),
save_policy = c("none", "project"),
object_type = c("detection", "annotation", "cell"),
require_calibration = TRUE,
min_qupath_version = "0.5.0",
allow_unsupported = FALSE,
overwrite = FALSE
)Arguments
- x
An
sg_mask,sg_run, list withmask/image, or a StarDist protocol id /sg_protocol.- destination
Output directory (must not exist or be empty).
- ...
Protocol parameter overrides for the
stardisttask.- image
sg_imagedescribing the QuPath image (size, pixel size, plane, channels). Required for thestardisttask.- image_name
Name of the image in the QuPath project (checked by the templates);
NULLskips the name check.- model
StarDist model file/directory or
sg_trained_modelfor thestardisttask.- region_policy
"whole_image","selected_annotations"or"all_annotations".- save_policy
"none"(default) or"project".- object_type
QuPath object type for imported or exported objects.
- require_calibration
Logical; templates refuse uncalibrated images.
- min_qupath_version
Minimum QuPath version written to
run.json.- allow_unsupported
Logical; allow non-default parameters that the QuPath extension cannot honour (they are still listed).
- overwrite
Logical; replace an existing program directory created by segmantR.
Value
An sg_qupath_program (invisibly) with path, task, run
(parsed run.json) and commands (headless command lines).
Details
For an
sg_mask,sg_runor list with a mask, the task isimport: the mask is exported withsg_export_interchange()intobundle/(integer TIFF, exact GeoJSON with object ids, legend, measurements) andsegmantR_import.groovyadds the objects to the open image after checking size, calibration, plane, SHA-256 and id collisions.For a StarDist protocol (
"stardist.2d.v1"or ansg_protocol), the task isstardist: parameters are mapped withsg_stardist_parameter_map()(unsupported non-default options are errors unlessallow_unsupported = TRUE, and are always listed inrun.json), the model is copied intomodels/and its digest is recorded for verification by the template.
Examples
m <- sg_example_mask("fluorescence_nuclei")
img <- sg_example_image("fluorescence_nuclei")
prog <- sg_export_qupath(m, tempfile("qupath"), image = img,
require_calibration = FALSE)
prog$commands[["import"]]
#> [1] "QuPath script --project=<project.qpproj> --image=\"<image name>\" --args=run.json segmantR_import.groovy"