How-to build DSI Studio for Ubuntu 18.04 and later

DSI Studio is an open-source diffusion MRI analysis tool. We need to compile the software for Linux.
I could successfully finish compile the DSI Studio for Ubuntu 18.04 and later. Below is what I did.

  • 18-May-2021 Update instruction for Ubuntu 20.04. You need to install g++-7 and gcc-7 for compile.
  • 08-May-2021 Ubuntu 20.04 has Qt5.12.8 as default, so it would be easy. For Ubuntu 18.04, I found PPA for Qt5.12.8, which would make the installation much easier, so I updated the instruction.
  • 21-Mar-2020 Now DSI studio needs Qt 5.12.x for compile. I added the explanation how to setup Qt 5.12.
  1. Install gcc and g++
    • Ubuntu 20.04
    • DSI Studio needs gcc-7 and g++-7 for compile on Ubuntu 20.04. We can install them via apt.

      sudo apt update
      sudo apt install g++-7
      

      Just installing gcc-7 and g++-7 won’t have any effects on the machine.
      You can check the version of gcc and g++ by typing gcc –version and g++ –version

      gcc --version
          gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
      
      g++ --version
          g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
      

      In order to make gcc-7 and g++-7 available, we need to do the following;

      sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10
      sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 10
      

      You should see something like;

      update-alternatives: using /usr/bin/g++-7 to provide /usr/bin/g++ (g++) in auto mode
      

      If you have installed other version of gcc (eg. gcc-10), You need to select gcc-7 and g++-7

      sudo update-alternatives --config gcc
      
      There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
      
        Selection    Path            Priority   Status
      ------------------------------------------------------------
        0            /usr/bin/gcc-7   10        auto mode
        1            /usr/bin/gcc-7   10        manual mode
      * 2            /usr/bin/gcc-9   20        manual mode
      
      Press <enter> to keep the current choice[*], or type selection number: 0
      

      Do the same thing for g++

      sudo update-alternatives --config g++
      
    • Ubuntu 18.04
    • DSI Studio needs gcc-7 and g++-7 for compile on Ubuntu 18.04. We can install them via apt.

      sudo apt install g++-7
      
  2. Install necessary files for compile
  3. We also need to install the following;

    sudo apt install git libboost-all-dev zlib1g zlib1g-dev
    
  4. Get Qt 5.12.8
    • For Ubuntu 20.04, default Qt5 should work.
    • sudo apt install qt5-qmake qt5-default libqt5charts5-dev
      

      Some may need to install libqt5opengl5-dev (Thank Steven Baete for the Feedback!)

      sudo apt install libqt5opengl5-dev
      
    • For Ubuntu 18.04, PPA provided by Stephan Binner would be helpful.
    • sudo add-apt-repository ppa:beineri/opt-qt-5.12.8-bionic
      sudo apt update
      sudo apt install qt512base qt512charts-no-lgpl
      source /opt/qt512/bin/qt512-env.sh
      

  5. Prepare a working directory
  6. Prepare a working directory. We save files in this directory.

    mkdir dsistudio
    
  7. Get the Windows version of DSI Studio
  8. Download the Windows version of DSI Studio from this link and save it under working directory (dsistudio).
    Filename should be “dsi_studio_win.zip.”

  9. Get the source code from GitHub
  10. Now we get the source code of DSI Studio from Github. We also need “frankyeh-TIPL-xxxxxx(revision number).zip” to be downloaded. After unzipping, rename the folder as “tipl”, and move under src.

    cd dsistudio
    git clone -b master git://github.com/frankyeh/DSI-Studio.git src
    xdg-open https://github.com/frankyeh/TIPL/zipball/master
    unzip frankyeh-TIPL-xxxxxxx.zip
    mv frankyeh-TIPL-xxxxxxx tipl
    mv tipl src
    
  11. Compile
  12. Prepare a directory for build and compile. The point is that we need to use qmake under Qt5.12.8. I chose to specify fullpath because I don’t have to tweak system environments. After executing qmake, we just run make to compile.

    mkdir build
    cd build
    
    #(for Ubuntu 20.04)
    qmake ../src
    
    #(for Ubuntu 18.04 using ppa by Stephan Binner)
    /opt/qt512/bin/qmake ../src
    
    make
    

    If it goes well, you should find dsi_studio under build directory.
    You may remove unnecessary files with make clean.

    make clean
    
  13. Packaging
  14. Windows version zip file has atlas and other files included. We make use of it.
    DLL files are for Windows, so we delete all of them.

    cd .. # Now you should be in the "dsistudio" directory
    unzip dsi_studio_win.zip
    cd dsi_studio_win
    find . -name '*.dll' -exec rm {} ;
    rmdir iconengines imageformats platforms styles 
    rm dsi_studio.exe
    cp ../build/dsi_studio .
    
  15. Run DSI Studio
  16. Now you can run DSI Studio from the terminal.

    ./dsi_studio
    

    If everything works, the command brings up DSI Studio.