Installation on Windows 10 - dwong263/MAGIQ GitHub Wiki

Installing the Basics

Python

Download and install Python 3.7.7 for Windows 10 from here. During the installation, make sure ...

  • ... you check the "Add to Path" box
  • ... you install pip

Windows Subsystem for Linux (WSL) and Ubuntu

Although most of MAGIQ can run natively in Windows 10, some parts of BARSTOOL calls FSL commands which requires a UNIX environment. Thus, WSL is a requirement.

First, install and enable WSL according to these instructions. Then, in the Microsoft Store, search for Ubuntu and install the product.

After installation, Ubuntu will appear as an "App" in the Start Menu and you should be able to launch a terminal by clicking on its icon. On first launch, you will be asked for a username and a password. Make sure you remember the password, because it will be needed for any sudo commands.

Make sure you update and upgrade the included Ubuntu packages to the latest versions:

sudo apt update
sudo apt upgrade

VcXsrv

FSL requires the X11 windowing system. VcXsrv is an XWindows server that will provide this functionality. You can download and install VcXsrv from here.

To launch VcXsrv, search for "XLaunch" in the Windows Start Menu.

XLaunch

Use the following settings:

  • Select Multiple Windows in the "Display Settings" window and specify 0 for the "Display number".

VcXsrv Display Settings

  • Select the Start no client option in the "Client startup" window.

VcXsrv Client Startup

  • Uncheck Native opengl in the "Extra settings" window.

VcXsrv Extra Settings

Hit the "Finish" button in the "Finish configuration" window to launch VcXsrv.

  • Note that this is something that needs to be relaunched after every reboot.
  • If you're using WSL2 instead of WSL, you'll need the configuration detailed here.

git

To download code from GitHub, you will need git. Install git for Windows from here.

Obtaining the Software

Downloading a Specific Version

You can download a specific version of the software via the "Releases" page (https://github.com/dwong263/MAGIQ/releases). Place this source code and extract into an easily locatable folder. This folder will be referred to as the in subsequent instructions.

Using Git

You can use git to clone the GitHub repository and obtain the software. Download and install git for Windows from here. git allows you to contribute to the code development and easily pull the latest changes onto your computer.

  1. To keep all the software in one place, it is suggested that you install MAGIQ within an easily locatable folder. This folder will be referred to as the <Software Folder> in subsequent instructions.
  2. Navigate to that folder in a command prompt window (cd <Software Folder>) and clone the MAGIQ repository:
git clone https://github.com/dwong263/MAGIQ

Installing MAGIQ Dependencies

The Simple Stuff

  1. Install PyQt5.
pip install PyQt5
  1. Install scipy and numpy.
pip install scipy
  1. Install matplotlib.
pip install matplotlib
  1. Install pyfftw.
pip install pyfftw
  1. Install NiBabel.
pip install nibabel
  1. Install future.
pip install future

The More Complicated Stuff

Installing IDL

Download and Install IDL

From the L3Harris Geospatial Download and License Center, download the latest IDL Virtual Machine installer for Windows (IDL 8.7.3 for Windows (idl873-win.exe)). Launch the installer and follow the install instructions. Note that ENVI, ENVI Classic help files, ENVI Help files, DICOM Network Services do not need to be installed. Running the License Manager is also unnecessary.

Add IDL to the Windows PATH

Next, add IDL to the Windows PATH.

  1. Search for "environment variables" in the Start Menu. Select "Edit the system environment variables."
  2. Click the "Environment Variables..." button. Under "User variables for <username>" panel, find the "Path" variable, select it and hit the "Edit..." button.
  3. Click the "New" button and input C:\Program Files\Harris\IDL87\bin\bin.x86_64\ to add IDL to the windows path.

Test the IDL Installation

To test if the IDL Runtime was installed correctly, open a command prompt window, navigate to <Software Folder>/MAGIQ. Run idlrt fitman\fitMAN_Suite.sav.

A splash screen should pop up after running this command. Hit "Ok" on the splash screen and the FITMAN software should launch. If this happens, the IDL virtual machine was installed correctly.

Installing FSL

Installation of FSL occurs in the WSL Ubuntu environment. First, open a command prompt window and navigate to <Software Folder>/MAGIQ/dep. Then, enter the wsl command to start an Ubuntu terminal session. To install FSL, we need to first install Python 2.7 and pip for Python 2. These instructions should work.

Python 2.7 and pip for Python 2 are needed because the FSL installation script requires Python 2.7 to run properly. A "custom" version of this installation script is provided with MAGIQ. This is because the default FSL installation script does not detect the operating system correctly. Use the following instructions to run the script:

  1. Install distro so the operating system is detected correctly.
pip2 install distro
  1. Run the installer. sudo or administrative priveleges may be required for this operation.
python2 fslinstaller.py

Next, configure your shell by editing ~/.profile.

  1. Change to your home directory and open the .profile file using VIM.
cd ~
vim .profile
  1. Hit "i" on your keyboard to enter insert mode.
  2. Add the following to the end of the file:
FSLDIR=/usr/local/fsl 
. ${FSLDIR}/etc/fslconf/fsl.sh 
PATH=${FSLDIR}/bin:${PATH} 
export FSLDIR PATH
  1. Save the file by hitting the "Esc" key on your keyboard. Then type :x and hit "Enter".

Checking the Installation

  1. Open a new Ubuntu terminal window and check that your environment is correct by typing echo $FSLDIR.
  2. Check that your path is correct by running an FSL command such as flirt --version.
  3. Check that the FSL GUI applications launch normally by running a command such as fsleyes or fsl.

Installing PyGAMMA

PyGAMMA is the library used by PINTS to perform simulations of pulse sequences and to generate prior information templates used to fit the data. For Python versions greater than 2.7, PyGAMMA must be built from source. PyGAMMA build and install instructions are provided here, but a brief summary of the instructions are included below.

Install Subversion PyGAMMA is hosted on a subversion (SVN) repository. If you do not have an SVN client, you will need to get one. TortoiseSVN is a popular client for Windows users. If you are using TortoiseSVN, ensure you also select the command line tools during installation.

Once you have an SVN client, open a command prompt, go to your <Software Folder>, and enter the following command:

svn co http://scion.duhs.duke.edu/guest_svn/gamma/trunk gamma

Install Visual Studio 2019

Install Visual Studio 2019 from here. This is needed to compile PyGAMMA.

Install Swig

  1. First, download swigwin-4.0.2.zip from here.
  2. Extract the archive and copy the swigwin-4.0.2 folder to C:\Program Files\.
  3. Add C:\Program Files\swigwin-4.0.2\ to your Windows PATH variable, just like you did for IDL above.

Configure and Compile

  1. Open the file gamma\platforms\msvc2017e\dynamic\gamma.sln in Visual Studio 2019.
  2. If you are running a 64-bit Windows system (this is usually the case), configure the target platform for 64-bit according to these instructions.
  3. Double check that python.exe and swig.exe are both added to your Windows PATH variable.
  4. Start the build by right clicking gamma in the Solution Explorer and click build.

Installing PyGAMMA

  1. cd gamma\pygamma
  2. python setup.py install

Fixing a PyGAMMA Install/Compile Bug

It seems that PyGAMMA built under Python 3.7.7 cannot be imported successfully from an *.egg file. To fix this:

  1. Navigate to C:\Users\<User Name>\AppData\Local\Programs\Python\Python37\lib\site-packages\ in Windows Explorer.
  2. Make a new directory called pygamma
  3. Copy all files from gamma\pygamma\dist_staging
  4. Delete the egg file (pygamma-4.3.4rc1-py3.7.egg)

Launch MAGIQ

Your installation is now complete! Open a new command prompt window and navigate to the folder containing the MAGIQ files and launch the program with the following commands:

cd /mnt/c/Users/<username>/Software/MAGIQ
python main.py

You can launch the individual programs of the MAGIQ Software Suite using:

python pints.py
python apps.py
python fitman.py
python spices.py
python barstool.py

Special Instructions for the Rodent Version of BARSTOOL

You can also run the "Rodent Version" of BARSTOOL using the command:

python barstoolrv.py

Note that the "Rodent Version" of BARSTOOL (BARSTOOL-RV) requires MATLAB with the MATLAB Engine API for Python installed, as it relies on a pulse-coupled neural network (PCNN-3D) implemented in MATLAB for rodent brain extraction.

  1. Download and install MATLAB.
  2. In a command prompt window, execute the following commands. You may need sudo or administrative privileges to do this.
cd <MATLAB Root Folder\extern\engines\python
python setup.py install
  1. Ensure you have the MATLAB NIFTI tools downloaded and on your MATLAB path.
⚠️ **GitHub.com Fallback** ⚠️