Install dependencies the way Slicer expects, fix the failing self-test, add a real icon - #3
Merged
MarkDanielArndt merged 20 commits intoJul 28, 2026
Conversation
Drops the redundant queue list (already visible in the Gallery once loaded), moves Model and Scale bar ahead of Analysis to match the actual workflow order, expands the Model accordion by default, and hides the confidence threshold checkbox/slider (ported from the equivalent dev-branch change, issue #79 — the widgets stay wired into settings sync, just not shown).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses the feedback from the extension catalog review, fixes the self-test that is
currently failing on the build dashboard, and replaces the placeholder icon.
Dependency installation
The review raised two points: use
slicer.util.pip_installinstead of a custom installer,and obtain PyTorch from the PyTorch extension instead of installing it directly.
_pip_install— asubprocess.Popenwith a manual poll loop plus a hand-builtprogress dialog, roughly 120 lines — is removed.
slicer.util.pip_installprovides both.PyTorchUtils, so the build matching the user's hardware is selected. If that extension ismissing it is installed first and the required restart is communicated.
EXTENSION_DEPENDSis nowPyTorchinstead ofNA.a time let pip resolve each in isolation, so a later package could pull in a dependency
that broke an earlier one: scikit-image drags in tifffile, whose current release requires
numpy>=2.1, which replaced the numpy 1.x that the macOS torch build needs. Handing pipthe whole set at once lets it pick versions that fit together.
available there is compiled against the NumPy 1 C API. On Linux and Windows numpy is left
untouched. This matches how other PyTorch-based extensions handle the same platform limit.
Build dashboard
Testing/CMakeLists.txtpassed a relative script path toslicer_add_python_unittest. Thatmacro derives the directory it puts on
sys.pathfrom the script path and only falls back toCMAKE_CURRENT_SOURCE_DIRwhen that directory comes out empty — a relativePython/is notempty, so the fallback never fired and the test module could not be imported. It now passes an
absolute path.
The failure was retrieved from the dashboard and the path derivation reproduced with CMake
directly, so the cause is established. Whether the eight test methods then pass can only be
confirmed by the nightly build after this is merged.
First-use experience
Dependencies were installed when the module was opened. Now nothing happens on open, and each
action installs only what it needs:
Exporting a result table no longer offers a two-gigabyte torch install. A notice above the Run
button reports outstanding packages so the user learns about a pending install before loading
images and setting parameters.
A restart is now only required when it is genuinely needed. A package that was missing a moment
ago was never imported in this session and is usable immediately, so the action that triggered
the install simply continues. Only a replaced numpy — the macOS torch case — forces a restart.
The hand-built setup dialog and the custom restart dialog are replaced by
slicer.util.confirmOkCancelDisplay, with the package list in the dialog's detail area.Analysis errors are reported the same way: the message names the affected files and the full
text including tracebacks sits behind "Details", so the Python console is no longer needed to
find out why an image failed.
Loading images ran on the main thread without yielding to the event loop, freezing the
application until the last file was read. It now hands control back between images, so the
window stays usable and thumbnails appear one by one. The button that started the load reports
progress and doubles as Cancel while the load runs; cancelling keeps the thumbnails already
read and leaves the images queued, since the analysis reads the files itself.
Icon
The 128×128 placeholder is replaced by a 512×512 icon of a zebrafish larva with the curved
body path and the straight-line distance whose ratio the extension reports.
Verification
Automated: 508 tests pass.
Manual, in Slicer 5.13 on macOS: installation from a clean state, per-action package
selection, the restart behaviour, a full analysis run with plausible measurements, error
reporting for a corrupt image, and loading a large folder including cancelling it midway.
Not verified: the self-test fix, which needs a dashboard build. No Windows build has appeared
on the dashboard so far, independently of this change.
Follow-up after merging: one line in the catalog entry
EXTENSION_DEPENDSin the top-levelCMakeLists.txtchanges fromNAtoPyTorch. Tier 1requires the catalog entry to stay consistent with it, so
build_dependencieshas to namePyTorch as well. The catalog lives in a different repository, so this cannot happen
automatically — it needs a separate pull request there, after this one is merged.
The whole change is one line in
ZebrafishEmbryoAnalyzer.json:For reference, the file currently reads:
{ "$schema": "https://raw.githubusercontent.com/Slicer/Slicer/main/Schemas/slicer-extension-catalog-entry-schema-v1.0.1.json#", "category": "Analysis", "scm_url": "https://github.com/MarkDanielArndt/SlicerZebrafishEmbryoAnalyzer.git", "scm_revision": "main", "scm_type": "git", "build_dependencies": [], "build_subdirectory": ".", "enabled": true, "tier": 1 }Quickest way, entirely in the browser and taking about a minute:
ZebrafishEmbryoAnalyzer.jsonin the extension catalog repositoryAdd PyTorch build dependency for ZebrafishEmbryoAnalyzerNothing else in the entry changes.
scm_revisionis a branch name, so every other change inthis pull request reaches the build without any catalog edit at all.