Skip to content

SIRF SuperBuild on Bash on Ubuntu on Windows 10

Elise Emond edited this page May 27, 2017 · 17 revisions

This page explains how to install the SIRF-SuperBuild and its dependencies using a clean install of "Bash on Ubuntu on Windows" and run a simple MR and PET image reconstruction using Python.

These instructions refer to the page "SIRF SuperBuild Ubuntu 16.04", showing the additional steps, specific to Bash on Ubuntu on Windows.

First version created by Elise Emond.

Introduction to Bash on Ubuntu on Windows (Windows Subsystem for Linux)

If you use Windows 10 and do not want the hassle of running a virtual machine, "Bash on Ubuntu on Windows" or simply "Bash" could be a good option for you. It provides you a bash shell and a Linux environment and most Linux tools can be used, directly on Windows.

Nota bene: You can also run Windows executables directly on Bash.

How to enable it

You need to have at least the Windows 10 Anniversary Update (released in August 2016) and a 64-bit build of Windows.

Please follow the installation steps here.

Support of Graphical Applications

Even though graphical applications are not natively supported on Bash, you can use an X server.

1. Install an Xserver

Recommended one: https://sourceforge.net/projects/xming/.

Download and install. Default parameters are fine. Launch the X server before you run a Linux graphical application from Bash.

2. Set the environment variable

Run the following command in Bash:

export DISPLAY=:0

Add this line to your .bashrc or .profile (located within the home directory on Bash), if you don't want to type this all the time. (nano .profile or nano .bashrc, then add the line at the end of the file and save (CTRL X, Y, ENTER)).

3. Enjoy!

Basic GUI applications (cmake-gui, gedit, ...) should work fine.

More information here.

Update Linux subsystem

sudo apt-get update
sudo apt-get upgrade

Now you should be all set to install and run SIRF!

Installation of SIRF using SIRF SuperBuild

The installation steps are basically the same as on Ubuntu: See instructions here.

However, I strongly suggest you to use a Windows folder as the installation folder. To do so:

  1. Create an empty folder "devel" in a Windows emplacement, e.g. "Documents".
  2. Create "Documents" folder in Bash if it does not exist already.
mkdir ~/Documents
  1. Add a symbolic link in Bash

If your folder "devel" is located at "C:\Users<YourUsername>\Documents", type in Bash

ln -s /mnt/c/Users/<YourUsername>/Documents/devel ~/Documents/devel 
cd ~/Documents/devel
  1. Tadaa! It's ready!

You can continue the installation starting 1. Install Dependencies for SIRF.

Recommendations/Warnings - Please read!

  • DO NOT attempt to modify Linux files in a Windows editor!

Do not try to access, modify or remove a file located on the Subsystem from Windows. If you attempt to do so, you will lose your whole Bash installation. Luckily, you can access Windows from the Subsystem without problems as described below.

  • Create your bash scripts directly on Windows!

You can download a text editor on Windows to create your bash files. I recommend using Notepad++ as it is very easy to use. You will have to use Unix line endings to be able to run a bash script, so modify the default format to Unix: Settings -> Preferences -> New Document -> Format (Line ending) -> Unix (You can also convert a file to Unix End Of Lines with Edit -> EOL Conversion -> Unix)

  • Use files located in regular Windows folders and symbolic links in Bash

As it is very easy to access Windows folders and files from Bash (e.g. "C:\Users<YourUsername>\Desktop" is located at "/mnt/c/Users//Desktop"), good practice would be to store as many files as you can in regular Windows emplacements and either run the commands in "/mnt/c/Where/Your/Files/Are" or, even easier, use symbolic links: if you use the previously created folder "devel" for all your data and scripts, you will be able to access them in "~/Documents/devel/" from Bash immediately. In this way, you have all the data (input and output images/sinograms) directly accessible in Windows, and you can reprocess/visualise the data with your regular tools: ImageJ, Amide, Matlab etc.