Skip to main content

A package to plot and capture FastSurfer and FreeSurfer-style surface overlays.

Project description

WhipperSnapPy

WhipperSnapPY is a small Python OpenGL program to render FreeSurfer and FastSurfer surface models and color overlays and generate screen shots.

Contents:

  • Capture 4x4 surface plots (front & back, left and right)
  • OpenGL window for interactive visualization

Installation:

The WhipperSnapPy package can be installed from pypi via

python3 -m pip install whippersnappy

Note, that currently no off-screen rendering is natively supported. Even in snap mode an invisible window will be created to render the openGL output and capture the contents to an image. In order to run this on a headless server, inside Docker, or via ssh we recommend to install xvfb and run

sudo apt update && apt install -y python3 python3-pip xvfb libxcb-xinerama0
pip3 install pyopengl glfw pillow numpy pyrr PyQt6
pip3 install whippersnappy
xvfb-run whippersnap ...

Usage:

Local:

After installing the Python package, the whippersnap program can be run using the installed command line tool such as in the following example:

whippersnap -lh $OVERLAY_DIR/$LH_OVERLAY_FILE \
            -rh $OVERLAY_DIR/$RH_OVERLAY_FILE \
            -sd $SURF_SUBJECT_DIR \
            --fmax 4 --fthresh 2 --invert \
            --caption caption.txt \
            -o $OUTPUT_DIR/whippersnappy_image.png \

For more options see whippersnap --help. Note, that adding the --interactive flag will start an interactive GUI that includes a visualization of one hemisphere side and a simple application through which color threshold values can be configured.

Docker:

The whippersnap program can be run within a docker container to capture a snapshot by building the provided Docker image and running a container as follows:

docker build --rm=true -t whippersnappy -f ./Dockerfile .
docker run --rm --init --name my_whippersnappy -v $SURF_SUBJECT_DIR:/surf_subject_dir \
                                               -v $OVERLAY_DIR:/overlay_dir \
                                               -v $OUTPUT_DIR:/output_dir \
                                               --user $(id -u):$(id -g) whippersnappy:latest \
                                               --lh_overlay /overlay_dir/$LH_OVERLAY_FILE \
                                               --rh_overlay /overlay_dir/$RH_OVERLAY_FILE \
                                               --sdir /surf_subject_dir \
                                               --output_path /output_dir/whippersnappy_image.png

In this example: $SURF_SUBJECT_DIR contains the surface files, $OVERLAY_DIR contains the overlays to be loaded on to the surfaces, $OUTPUT_DIR is the local output directory in which the snapshot will be saved, and ${LH/RH}_OVERLAY_FILE point to the specific overlay files to load.

Note: The --init flag to Docker is needed for the xvfb-run tool to be used correctly for off screen rendering.

API Documentation

The API Documentation can be found at https://deep-mi.org/WhipperSnapPy .

Links:

We also invite you to check out our lab webpage at https://deep-mi.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whippersnappy-1.3.0.tar.gz (119.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whippersnappy-1.3.0-py3-none-any.whl (118.5 kB view details)

Uploaded Python 3

File details

Details for the file whippersnappy-1.3.0.tar.gz.

File metadata

  • Download URL: whippersnappy-1.3.0.tar.gz
  • Upload date:
  • Size: 119.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for whippersnappy-1.3.0.tar.gz
Algorithm Hash digest
SHA256 cff830c48f6c6e45399351c14f99793033cae1e4cb780deb19b9fa26e3370fa6
MD5 2d02457c6db119cba063cea1b6e8493c
BLAKE2b-256 de3f25f0ee31d8af3a9c98d6c1f232e15b9269e30321361812368b04793263eb

See more details on using hashes here.

File details

Details for the file whippersnappy-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: whippersnappy-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 118.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for whippersnappy-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9611e7c2c53b59abcc8c681d93a086a6a0e5a9cd397718e7b2010fc62df57fd8
MD5 5c682b83b0a5d484a2efb85b5d13ed14
BLAKE2b-256 1d156a5b57a82718cd5f2e5f82a347874aee9634a334046c9093e2d024099e80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page