Skip to content

Developer Manual

Davide Punzo edited this page Jan 25, 2022 · 95 revisions

The SlicerAstro functionality is implemented as multiple plug-in modules, bundled as one downloadable extension as shown in the figure below:

SlicerAstro Doxygen

SlicerAstro Doxygen documentation.

3DSlicer Doxygen

3DSlicer Doxygen documentation.

Before starting developing software for SlicerAstro and 3DSlicer, it is advisable to consult the developer manual. This provides many resources such as tutorials and instructions (e.g., how's to use QtCreator and QtDesigner with 3DSlicer).

Slicer developer meetings are open to everyone, feel free to join.

The most effective way to get help from the community.

3DSlicer FAQ

Set of common development questions/answers.

Build 3DSlicer and SlicerAstro

3DSlicer and SlicerAstro are built every day by Kitware on their factory machines (see CDash). Here we provide a guide (updated up to July 2018) how to compile 3DSlicer and SlicerAstro for people interested in developing SlicerAstro. However we advice people only interested in using SlicerAstro to not go through the effort to compile Slicer but instead use the binary distribution.

Common Prerequisites

Ubuntu (tested on Ubuntu 21.10, gcc 10.3.0):

  1. sudo apt install chrpath git-core make gcc-10 g++ libxt-dev libgl1-mesa-dev libglu1-mesa-dev libfontconfig-dev libxrender-dev libncurses5-dev libosmesa6-dev bison build-essential gperf libasound2-dev libatkmm-1.6-dev libbz2-dev libcap-dev libcups2-dev libdrm-dev libegl1-mesa-dev libfontconfig1-dev libfreetype6-dev libgcrypt20-dev libglib2.0-0 libglib2.0-dev libglu1-mesa-dev libgstreamer1.0-dev libice6 libicu-dev libnss3-dev libpci-dev libpulse-dev libsm6 libxcb-sync0-dev libssl-dev libudev-dev libx11-dev libx11-xcb-dev libxcb-composite0 libxcb-composite0-dev libxcb-cursor-dev libxcb-cursor0 libxcb-damage0 libxcb-damage0-dev libxcb-dpms0 libxcb-dpms0-dev libxcb-dri2-0 libxcb-dri2-0-dev libxcb-dri3-0 libxcb-dri3-dev libxcb-ewmh-dev libxcb-ewmh2 libxcb-glx0 libxcb-glx0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-image0 libxcb-image0-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-present-dev libxcb-present0 libxcb-randr0 libxcb-randr0-dev libxcb-record0 libxcb-record0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-render0 libxcb-render0-dev libxcb-res0 libxcb-res0-dev libxcb-screensaver0 libxcb-screensaver0-dev libxcb-shape0 libxcb-shape0-dev libxcb-shm0 libxcb-shm0-dev libxcb-sync-dev libxcb-sync-dev libxcb-sync1 libxcb-util-dev libxcb-util0-dev libxcb-util1 libxcb-xf86dri0 libxcb-xf86dri0-dev libxcb-xfixes0 libxcb-xfixes0-dev libxcb-xinerama0 libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xkb1 libxcb-xtest0 libxcb-xtest0-dev libxcb-xv0 libxcb-xv0-dev libxcb-xvmc0 libxcb-xvmc0-dev libxcb1 libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxi-dev libxrandr-dev libxslt1-dev libxss-dev libxtst-dev libpthread-stubs0-dev libpthread-workqueue0 libpthread-workqueue-dev perl python ruby gyp ninja-build libwebp-dev libjsoncpp-dev libopus-dev libminizip-dev libavutil-dev libavformat-dev libavcodec-dev libevent-dev libwayland-dev libwayland-egl1-mesa libwayland-server0 libgles2-mesa-dev libxkbcommon-dev libsrtp2-dev NOTE: the majority of these prerequisities were needed to compile Qt from source, however now we can download it with the online installer. Anyway installing them, would not bring any issue.
  2. cmake minimum version has to be 3.22.1. If your system one is older, please download it from https://cmake.org/download/ and check update-cmake.
  3. download the qt (version 5.15.2) online installer and install the following: Desktop gcc 64-bit, Sources, Qt WebEngine, Qt Script, Qt Debug Information Files and Qt Creator (this last it is installed in default).

MacOS (tested on MacOS 10.13)

  1. cmake minimum version has to be 3.17.3. If your system one is older, please download it from https://cmake.org/download/ and check update-cmake.
  2. install qt (version 5.15.1) using the special package qt-easy-build.
  3. Install Xcode: xcode-select --install

Windows

Currently SlicerAstro extension does not compile/work under Windows (because of specific libraries deps, e.g. wcslib).

Configure and generate Slicer solution files

  1. git clone https://github.com/Slicer/Slicer.git
  2. mkdir Slicer-SuperBuild-Debug (be aware that for MacOS the long building path can break the compilation; navigate to the following link for further details)
  3. cd Slicer-SuperBuild-Debug
  4. cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR=path-to-Qt/lib/cmake/Qt5 ../Slicer
  5. for MacOS add: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.X where X is the OS version
  6. make -j 8 (8 is the number of cores)
  7. git clone https://github.com/Punzo/SlicerAstro.git
  8. mkdir SlicerAstro-Build-Debug
  9. cd SlicerAstro-Build-Debug
  10. cmake -DSlicer_DIR=/path/Slicer-SuperBuild-Debug/Slicer-build -DCMAKE_BUILD_TYPE:STRING=Debug ../SlicerAstro
  11. for MacOS add: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.X where X is the OS version
  12. make -j 8
  13. Start SlicerAstro with the custom binaries (SlicerWithSlicerAstro) in the inner-build folder.

Testing

It is possible to run automated tests by typing the following command in the inner-build folders (Slicer-SuperBuild-Debug/Slicer-build and SlicerAstro-SuperBuild-Debug/inner-build):

ctest -j8

Packing

For generating binaries (again in the inner-build folder):

cpack -j8

NOTE: Use -DCMAKE_BUILD_TYPE:STRING=Release in compilation if you would like to release the software.

SlicerAstro is an extension of 3DSlicer. Therefore to incorporate SlicerAstro binaries in 3DSlicer, the files have to be moved inside the 3DSlicer package. The SlicerAstro binaries can be included in the 3DSlicer package using the following feature in the extension manager:

Full 3DSlicer customization is possible using the SlicerAstroApp.

Continuous Integration

3DSlicer and SlicerAstro builds and tests are available every day at the following links:

  1. 3DSlicer download page and check Get-SlicerAstro link;
  2. 3DSlicer CDash.

Create Docker image with OpenGL

Slicer is an OpenGL application and the ssh protocol does not support running scripts on a server. To solve this problem one can run Slicer in a docker image on a server (e.g., for making videos of many sources).

How's to create an OpenGL docker image:
SlicerAstro-Docker-OpenGL

TeamViewer can also be used to work remotely (the remote workstation still needs a connected graphical output, see link for more information).

Finally Slicer (and therefore also SlicerAstro) can be used as a fully interactive jupyter notebook, see link.

Additional build information

Additional 3DSlicer build instructions are available at the following link.