Skip to content

SIRF SuperBuild Ubuntu 16.04

Kris Thielemans edited this page May 4, 2017 · 39 revisions

This manual explains how to install the SIRF-SuperBuild and its dependencies on a clean Ubuntu 16.04 system and run a simple MR and PET image reconstruction using Python. The installation is done in a new folder devel in ~/Documents

    cd ~/Documents
    mkdir devel
    cd devel

Note that this might work for other Debian-based systems as well but we have not tested this.

1. Install dependencies for SIRF

 sudo apt-get install build-essential git g++

You probably want Python support

 sudo apt-get install python-matplotlib python-dev python-docopt 

Please check also our pages with specific instructions for SIRF and MATLAB, and SIRF and Python.

2. Install dependencies for Gadgetron

 sudo apt-get install \
    h5utils \ 
    liblapack-dev \
    libace-dev

Installing the following will add extra functionality to Gadgetron which you might want (but are currently not used by SIRF).

    libxml2-dev \
    libxslt-dev \
    python-h5py \
    python-libxml2 \
    python-psutil \
    libplplot-dev 

Optionally install CUDA suport if you have a NVidia GPU

  sudo apt-get install nvidia-cuda-toolkit 

3. Install SIRF-SuperBuild

Ensure the correct cmake version is installed (we need at least 3.7.2)

  wget https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh
  sudo mkdir /opt/cmake
  sudo bash cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake
  export PATH=/opt/cmake/cmake-3.7.2-Linux-x86_64/bin:$PATH

Note that if you want to use MATLAB, you need to specify a compiler supported by MATLAB. Please check our SIRF and MATLAB page.

Get the actual super-build.

  git clone https://github.com/CCPPETMR/SIRF-SuperBuild
  cd SIRF-SuperBuild/

And install it

  cmake .
  make

If you have a multi-core system you can speed-up the compilation by using parallel builds. For instance, on a 4 core system you could try to use make -j -l3 as opposed to make.

As opposed to running CMake with default options, you could run cmake-gui or ccmake to select some options. You could for instance decide to use Ubuntu packages for some of the dependencies after installing

    sudo apt-get install libfftw3-dev libboost-all-dev libhdf5-serial-dev \
       libarmadillo-dev libgtest-dev swig

More detail on this is out-of-scope for this page.

4. Rename the example configuration file for Gadgetron

 mv INSTALL/share/gadgetron/config/gadgetron.xml.example INSTALL/share/gadgetron/config/gadgetron.xml

5. Set SIRF pathnames

(you want to add this to your .bashrc)

  export PYTHONPATH=$PYTHONPATH:~/Documents/devel/SIRF-SuperBuild/INSTALL/python
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/Documents/devel/SIRF-SuperBuild/INSTALL/lib
  export SIRF_PATH=~/Documents/devel/SIRF-SuperBuild/SIRF
  PATH=~/Documents/devel/SIRF-SuperBuild/INSTALL/bin:$PATH

6. Install Ismrmrd-python-tools

 git clone https://github.com/ismrmrd/ismrmrd-python-tools.git
 cd ismrmrd-python-tools/
 python setup.py --user install

(or use python3 of course if that's your version)

7. Open a terminal and start Gadgetron

If you didn't add the PATH statement to your .bashrc, you will have to repeat them in this terminal first

 gadgetron

8. Run Python examples for MR and PET image reconstructions

Run this in your original terminal

  cd  ~/Documents/devel/SIRF-SuperBuild/SIRF/examples/Python/MR
  python fully_sampled_recon.py 

  cd ~/Documents/devel/SIRF-SuperBuild/SIRF/examples/Python/PET
  python osem_reconstruction.py