diff --git a/README.md b/README.md index 5ee5ab1..f301581 100644 --- a/README.md +++ b/README.md @@ -6,42 +6,14 @@ Run the analysis tools of your LabConstrictor apps from inside [QuPath](https:// *The StarDist2D app's "Segment nuclei (H&E / RGB)" tool, run from QuPath: the nuclei it found are annotations on the open image.* -It works with QuPath 0.7 (older QuPath versions are not supported) and has been tested on Linux, Windows and macOS. Please [tell us](https://github.com/CellMigrationLab/LabConstrictor-QuPath/issues) what you find. - ## Install -Drag the jar from the [Releases page](https://github.com/CellMigrationLab/LabConstrictor-QuPath/releases) onto QuPath and restart it. Every step, what you need first and what to do when something goes wrong: [QuPath guide](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/qupath/). - -## Apps that work in QuPath - -| App | What it does | -|---|---| -| [StarDist2D](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/stardist2d/) | Segment nuclei and cells in 2D images with StarDist | -| [NucleiSky](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/nucleisky/) | Align microscopy images by matching the pattern of their nuclei | -| [Guess the Condition](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/guessthecondition/) | A blinded test of whether conditions can be told apart by eye | -| [Playground](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/labconstrictor-playground/) | Check your computer and try every feature of the extension | - -Any LabConstrictor app that declares QuPath as one of its hosts appears in the window; no extra extension is needed per app. The [App Centre](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/?host=qupath) has the current list. - -## Getting help +Needs QuPath 0.7. Drag the jar from the [Releases page](https://github.com/CellMigrationLab/LabConstrictor-QuPath/releases) onto QuPath and restart it. Every step, and what to do when something goes wrong: [QuPath guide](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/qupath/). -- **Something does not work?** The [QuPath guide](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/qupath/#if-something-does-not-work) lists the common problems and what to do. -- **Guides:** the [LabConstrictor website](https://cellmigrationlab.github.io/LabConstrictor-Site/) and its [guides](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/). -- **Bugs and questions:** the [issue tracker](https://github.com/CellMigrationLab/LabConstrictor-QuPath/issues). +Any LabConstrictor app that declares QuPath as a host appears in the window. The [App Centre](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/?host=qupath) lists them. -## More detail +## More -- [Technical reference](docs/REFERENCE.md): every rule the extension follows (large images and the Image area, pixel size, channels, annotations, number limits) and what is not done yet. +- [QuPath extension reference](docs/REFERENCE.md): how the extension behaves rule by rule, and how to build and test it. +- Bugs and questions: the [issue tracker](https://github.com/CellMigrationLab/LabConstrictor-QuPath/issues). - The same apps also run in [napari](https://github.com/CellMigrationLab/LabConstrictor-napari) and [Fiji](https://github.com/CellMigrationLab/LabConstrictor-Fiji). To make your own app, start at the [LabConstrictor website](https://cellmigrationlab.github.io/LabConstrictor-Site/). - -## For developers - -Build the jar with JDK 25 (QuPath 0.7 is built with Java 25), then run a GUI test on a virtual screen (Linux): - -```bash -QUPATH=/path/to/QuPath JAVA_HOME=/path/to/jdk-25 ./build.sh -tests/ci_setup_apps.sh /tmp/lc main # test apps and a private registry -QUPATH=/path/to/QuPath LC_HOME=/tmp/lc/home tests/run_gui_ci.sh # every GUI test -``` - -The GUI tests change the QuPath installation they are pointed at, so use a disposable copy. What each test covers, and the lint: [technical reference](docs/REFERENCE.md#build-from-source-and-test). diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 0535f49..ffea757 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -1,218 +1,198 @@ -# Technical reference: the QuPath extension +# QuPath extension reference -Details for developers and curious users: every rule the extension follows, large images, calibration, the intended fallbacks, how to build it and how to test it. To install and use the extension, read the [QuPath guide](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/qupath/). +How the QuPath extension behaves, rule by rule, and how to build and test it. To install and use it, read the [QuPath guide](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/qupath/). -The form is generated from the tool's declared schema ([LabConstrictor-Tools](https://github.com/CellMigrationLab/LabConstrictor-Tools), `docs/PROTOCOL.md`); the tool runs in the app's own Python environment through the LabConstrictor worker (JSON lines on stdin/stdout), -so QuPath never imports the app's packages and needs no Python of its own. +The extension builds a form from the schema an app's tools declare and runs the tool in the app's own Python environment through the LabConstrictor worker (JSON lines on stdin/stdout). QuPath never imports the app's packages and needs no Python of its own. The schema, the worker protocol and the rules every host shares are in the [protocol reference](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/protocol/); this page says how QuPath applies them. -## Install and supported systems -How to install, open and check the extension, and what to do when something does not work: [QuPath guide](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/qupath/). Installing an app is a separate step: [install an app](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/install/). +The extension is a Groovy script split into the part files listed in `src/main/resources/org/cellmigrationlab/labconstrictor/qupath/parts.txt`. A small Java class (`LabConstrictorExtension`) adds the menu entry **Extensions > LabConstrictor tools...** and runs the parts joined into one script. The part files do not run on their own in the Script Editor; use the all-in-one `LabConstrictorTools-all.groovy` of a release instead. -For developers, about the install without the jar that the guide mentions: the Script Editor needs the all-in-one file `LabConstrictorTools-all.groovy` of a release, because the script in the repository is split into the part files listed in `parts.txt`, and those do not run on their own in the Script Editor (the jar joins them itself). +## Requirements and compatibility -Apps declare which hosts list them (`hosts:` in their `labconstrictor-app.yaml`; Tools feature `app_hosts_v1`, PROTOCOL.md section App hosts). Apps without a declaration (installed with an older installer) are listed in every host and the Log says so ("declares no hosts"). Intended for QuPath: Playground, NucleiSky, Guess the Condition and StarDist2D. **VLab4Mic is not listed in QuPath** (it is for Napari and Fiji), and CellTracksColab is notebook-only. Report problems in the [issue tracker](https://github.com/CellMigrationLab/LabConstrictor-QuPath/issues). +- **QuPath 0.7.** The jar is built against QuPath 0.7.0, which runs on Java 25. Older QuPath versions cannot load it; other 0.7.x versions are not tested. +- **Systems.** Tested on Linux, Windows and macOS. Every pull request runs the full GUI test suite on Linux; the release workflow also tries the release jar on Windows and macOS (Apple silicon). +- **labconstrictor-tools 0.3.0a1 or newer** in the app's environment, with the features `app_hosts_v1`, `reserved_inputs_v1` and `retention_prune`. The check runs when the registry is read (at start and at **Rescan apps**) and again when Run is pressed. An app that fails it is not offered and is listed under "skipped" with one sentence, for example `this app's labconstrictor-tools 0.2.0rc1 is older than the 0.3.0a1 this host needs: update it`. An app whose version text cannot be read is offered with a warning. The rules are those of the protocol's "Compatibility rules for hosts", written in Groovy (`LcCompat`). +- **Which apps are listed.** QuPath lists an app only when its `hosts` declaration names `qupath`, as the protocol's "App hosts" section says (`LcAppHosts`). An app without a declaration (installed with an older installer) is listed, and the log says so each time the registry is read. Sentences for skipped apps go to the log and to the "skipped" list in the status line. +- **Apps that need a newer extension.** An app can declare the oldest QuPath extension it needs (the protocol's "Host requirements"; `LcHostRequirements`). The extension's own version is the jar's `Implementation-Version`. When it is too old the app stays listed with a warning, or is skipped when the app marks the requirement `required: true`. +- **Trust checks.** Every registry entry is checked before it is listed, with the same rules as the Python registry and the Fiji script: the entry has its text fields, the app name and tool and parameter names are plain names, the interpreter lies inside the install prefix, the entry and its schema are owned by you (or root in a shared folder) and not writable by group or others, and nothing on the interpreter's path is writable by everybody. An entry that fails is listed under "skipped" with its reason and never started. On Windows the owner and permission checks do not apply. -Every release lists the QuPath version it was built against and the minimum Tools version in its notes; `SHA256SUMS` holds the checksums of the files. +Every release lists in its notes the QuPath version it was built against and the minimum Tools version; `SHA256SUMS` holds the checksums of its files. -**QuPath versions and systems.** Built against QuPath **0.7.0**; QuPath 0.7 is built with Java 25 and the jar needs it, so older QuPath versions are not supported, and other 0.7.x versions are not tested. The extension has been tested on Linux, Windows and macOS. What runs automatically: -* **Linux**: the whole GUI test suite in CI on every pull request (QuPath 0.7.0 on a virtual screen), and the smoke test of the exact release jar before a release is published; a broken jar is not published. -* **macOS (Apple silicon) and Windows**: the release workflow also tries the same jar in the QuPath 0.7.0 build of that system (menu entry, dialog, a registered app in the list, quoting, trust checks, results folders, clean-up). These runs never block a release; see the job summary of the "release" workflow for the latest result. On Windows three of the test bodies fail because they use POSIX tools or POSIX file permissions (the owner/mode checks of the registry do not exist on Windows, so a group-writable entry is accepted; the clean-up test needs `chmod`), so that run does not check the clean-up while a results folder is in use. +## The form -The log is `~/.labconstrictor/logs/labconstrictor.log` (or `$LC_HOME/logs/`); the status line and **Details** of the window show what failed. +- Numbers (with range and unit), choices, checkboxes, text, files and folders become fields. Parameters of a group sit under a heading, a `Collapsed` group is a folded section, advanced parameters are in a collapsed section at the end, and the order is the one napari and Fiji use. +- An optional parameter without a default has a "set" box; unticked, the tool gets nothing. `enabled_when` greys fields out and follows text, number, choice, yes/no and "set" drivers. +- An input with a description has an **ⓘ** after its label. Hover over it (or the label) to read the description, click it to keep it open, or move into the input with Tab to see it below. +- `choices_from` makes a dropdown filled by another tool of the app (see [Dynamic choices and workers](#dynamic-choices-and-workers)). `clear_after_run` resets a field after a successful run. `Replace()` on an output reuses the tool's results window and replaces its earlier annotations. +- An image input with `PickChannel()` gets a **Channel** chooser; the tool receives only that channel. +- Two tools with the same label are listed as `label (id)`; apps are sorted by name. A tool with a parameter type this host does not know is refused on its own: `this tool cannot be shown: ...`. +- **Copy as command** puts a terminal command or a Python snippet on the clipboard. On Windows, words are quoted by the C runtime rules (the cases are in `tests/quote_vectors.json`, copied from labconstrictor-tools); cmd.exe still expands `%NAME%` inside quotes and PowerShell has its own quoting, so use the Python snippet there. -Needs **labconstrictor-tools 0.3.0a1 or newer** in the app's environment (the run record and the clean-up use its helpers and its `prune` command). A run of an app with an older one is refused with `this app's labconstrictor-tools 0.2.0rc1 is older than the 0.3.0a1 this host needs: update it`. +### Number limits -## What it does -* Pick an app and a tool. Numbers (range, unit), choices, checkboxes, text, files and folders become fields; parameters of a group sit under a heading, advanced ones in a collapsed section, optional ones without a default have a "set" box (unticked = the tool gets nothing), and `enabled_when` greys fields out. -* **Input help (ⓘ)**: an input with a description has an ⓘ after its label. Hover over the ⓘ (or the label) to read the description; click the ⓘ to keep it open (it closes at a click elsewhere or Escape). Moving into the input with Tab shows it under the input. An input without a description has no ⓘ. -* **Image inputs**: the image open in QuPath, any image of the open project, or a file. QuPath's image is exported losslessly as TIFF (the whole image, or the part chosen under **Image area**, see below). The pixel size of the chosen image or typed file fills the tool's pixel-size field (see **Pixel size** below). -* Results open in a window: values, tables (as a table: the first 100 000 rows, then "table 'name' (N rows, first M shown; the full table is in P)", the Napari wording; cells with commas, quotes and line breaks are read as CSV says, by one reader (`LcCsv`) for tables and points: a record is one row or one point however many lines it spans, and a malformed file, a points file without `y` and `x` columns or with a coordinate that is not a finite number is said in one sentence naming the record, never shown or placed partly), images (a preview, the path and an "Open in QuPath" button), alignment matrices, files, messages (also shown under the status line) and points. -* **Interaction hints** of the manifest: a `choices_from` parameter is a dropdown filled by another tool of the app (a text field when that tool cannot answer), `clear_after_run` parameters are reset after a successful run, a `Collapsed` group is a folded section, and an output with `Replace()` reuses the results window of the tool instead of opening a new one. -* **Channel selector**: an image input declared with `PickChannel()` gets a Channel chooser (the channel names of the chosen image, or of a file); the tool receives only that channel. -* **Points** found in the image that is open in QuPath become a point annotation named `:` (replaced by the next run when the output declares `Replace()`); points of any other image are shown as a table. -* **Outlines** found in the image that is open in QuPath become annotations of classification `:` with their numeric properties as measurements, named `: