Upgrade WhipperSnapPy from 1.3 to 2.1, simplify and streamline integration#795
Upgrade WhipperSnapPy from 1.3 to 2.1, simplify and streamline integration#795m-reuter merged 7 commits intoDeep-MI:devfrom
Conversation
|
I just remembered that some other files might also need version bumps besides pyproject.toml like mac requirements. I think the other files are auto-generated? |
345c0bb to
84e3bdf
Compare
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the whippersnappy dependency from version 1.3 to 2.0, which introduces native EGL headless rendering capabilities. This eliminates the need for xvfb (virtual framebuffer) orchestration, simplifies the codebase, and reduces Docker image size by removing X11-related dependencies.
Changes:
- Upgraded whippersnappy version requirement from >=1.3.1 to >=2.0 across all dependency files
- Removed xvfb orchestration logic and replaced with whippersnappy version validation in run_fastsurfer.sh
- Refactored mesh snapshot generation to use whippersnappy 2.0's in-memory API instead of disk-based I/O
- Reduced Docker runtime dependencies by removing xvfb and X11-related libraries (libglib2.0-0, libxkbcommon-x11-0, libdbus-1-3)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updated whippersnappy version constraint in qc optional dependencies |
| requirements.mac.txt | Updated whippersnappy version constraint for macOS builds |
| tools/Docker/Dockerfile | Removed X11 dependencies and renamed variable to reflect EGL-based rendering |
| run_fastsurfer.sh | Replaced xvfb orchestration with version validation logic, added error handling for version mismatches |
| CorpusCallosum/shape/mesh.py | Updated API to use whippersnappy 2.0's direct data passing, added version check, updated imports |
| CorpusCallosum/shape/postprocessing.py | Simplified mesh processing and updated error messages for EGL rendering |
| CorpusCallosum/cc_visualization.py | Updated version references and adapted to new API signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cfd458e to
2e42cff
Compare
2e42cff to
4a694e3
Compare
7615cc9 to
94bd496
Compare
|
Note, in version 2.1 we will turn around again to using EGL. This is currently being tested in fsqc. My testing is complete. The reasons:
So here we need to update Docker to add only these three libraries for Whippersnappy: Depending on the base image, one needs additional settings when enabling https://github.com/Deep-MI/WhipperSnapPy/blob/main/Dockerfile But this is not necessary as it will fall back to EGL CPU based rendering. Singularity |
38b0f39 to
4fa1bbc
Compare
…o 2.1:
1. pyproject.toml — Version pin updated
whippersnappy>=1.3.1 → whippersnappy>=2.1
2. requirements.mac.txt — Version pin updated
whippersnappy>=1.3.1 → whippersnappy>=2.1
3. run_fastsurfer.sh — Removed xvfb orchestration (lines 767–794 removed, line 1184 simplified)
Removed the entire maybe_xvfb block: xvfb-run detection, the glfw/OpenGL/whippersnappy.core import test, and all associated warning messages. Whippersnappy 2.1 renders headlessly via native EGL — no virtual framebuffer needed.
Removed "${maybe_xvfb[@]}" prefix from the CC module command invocation.
Removed the obsolete comment about xvfb-run wrapping.
4. tools/Docker/Dockerfile — Slimmed runtime dependencies
whippersnappy_opengl_deps="xvfb libglib2.0-0 libxkbcommon-x11-0 libgl1 libegl1 libfontconfig1 libdbus-1-3" → whippersnappy_egl_deps="libegl1 libgl1 libfontconfig1"
Removed: xvfb (virtual framebuffer, replaced by native EGL), libglib2.0-0 (X11/GUI stack), libxkbcommon-x11-0 (X11 keyboard), libdbus-1-3 (D-Bus, X11-related)
Kept: libegl1 (EGL rendering), libgl1 (OpenGL), libfontconfig1 (font rendering for captions/colorbars)
5. CorpusCallosum/shape/mesh.py — Updated import and API call
Removed import OpenGL.GL pre-check (whippersnappy 2.1 manages its own GL context)
Changed from whippersnappy.core import snap1 → from whippersnappy import snap1 (new top-level import)
Removed the except Exception handler about xvfb (no longer relevant with EGL)
Updated snap1() call: positional first arg → mesh=, overlaypath= → overlay= (new API parameter names)
6. CorpusCallosum/cc_visualization.py — Updated version references
Help text and warning messages: whippersnappy>=1.3.1 → whippersnappy>=2.1
7. CorpusCallosum/shape/postprocessing.py — Updated error messages
ImportError message: removed "glfw or OpenGL" (whippersnappy handles these internally)
Generic Exception message: replaced xvfb guidance with EGL/libegl1 guidance
4fa1bbc to
207e722
Compare
◦ Detects if --thickness_image flag is present in cc_flags (which is set when the user uses --qc_snap) ◦ Checks whether the whippersnappy Python package is installed and >2.1 ◦ Raises an error and gives instruction if this is not the case.
…face and overlay files. Use direct passing of the surface and overlay data instead of writing the files to disc first. Remove and simplify commands, arguments and the like that are a relict of older whippersnappy versions, now fully requiring whippersnappy 2.
replace libegl with libmesa in docker for no-gpu rendering
- Pass the correct segmentation file into fastsurfer_cc - Make reduce_to_aseg in reduce_to_aseg.py NOT be silently an inplace operation - Clean up typing in CorpusCallosum/paint_into_pred.py
207e722 to
02140a4
Compare
These is 1 thing that we currently do not have in FastSurfer:
|
Without it, my Docker would not recognise the GPUs (am using python slim as base) |
Overview
Upgrade to whippersnappy 2.0 with native EGL headless rendering, eliminating xvfb dependency and reducing Docker image size.
Changes
Detailed Changes
pyproject.toml — Version pin updated
whippersnappy>=1.3.1→whippersnappy>=2.1requirements.mac.txt — Version pin updated
whippersnappy>=1.3.1→whippersnappy>=2.1run_fastsurfer.sh — Removed xvfb orchestration
maybe_xvfbblock (lines 767–794)"${maybe_xvfb[@]}"prefix from CC module command invocationtools/Docker/Dockerfile — Slimmed runtime dependencies
xvfb libglib2.0-0 libxkbcommon-x11-0 libgl1 libegl1 libfontconfig1 libdbus-1-3libegl1 libgl1 libfontconfig1xvfb(virtual framebuffer, replaced by native EGL)libglib2.0-0(X11/GUI stack)libxkbcommon-x11-0(X11 keyboard)libdbus-1-3(D-Bus, X11-related)libgl1(OpenGL),libegl1(EGL rendering),libfontconfig1(font rendering for captions/colorbars)CorpusCallosum/shape/mesh.py — Updated import and API call
import OpenGL.GLpre-check (whippersnappy 2.0 manages its own GL context)from whippersnappy.core import snap1→from whippersnappy import snap1(new top-level import)except Exceptionhandler about xvfb (no longer relevant with MESA)snap1()call:mesh=overlaypath=→overlay=(new API parameter names)viewmat=-->view=(API change)CorpusCallosum/cc_visualization.py — Updated version references
whippersnappy>=1.3.1→whippersnappy>=2.1CorpusCallosum/shape/postprocessing.py — Updated error messages