Installation on Windows 10 - dwong263/MAGIQ GitHub Wiki
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
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
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.
Use the following settings:
- Select Multiple Windows in the "Display Settings" window and specify 0 for the "Display number".
- Select the Start no client option in the "Client startup" window.
- Uncheck Native opengl in the "Extra settings" window.
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.
To download code from GitHub, you will need git
. Install git
for Windows from here.
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.
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.
- 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. - Navigate to that folder in a command prompt window (
cd <Software Folder>
) and clone the MAGIQ repository:
git clone https://github.com/dwong263/MAGIQ
- Install PyQt5.
pip install PyQt5
- Install scipy and numpy.
pip install scipy
- Install matplotlib.
pip install matplotlib
- Install pyfftw.
pip install pyfftw
- Install NiBabel.
pip install nibabel
- Install future.
pip install future
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.
- Search for "environment variables" in the Start Menu. Select "Edit the system environment variables."
- Click the "Environment Variables..." button. Under "User variables for
<username>
" panel, find the "Path" variable, select it and hit the "Edit..." button. - 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.
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:
- Install
distro
so the operating system is detected correctly.
pip2 install distro
- Run the installer.
sudo
or administrative priveleges may be required for this operation.
python2 fslinstaller.py
Next, configure your shell by editing ~/.profile
.
- Change to your home directory and open the
.profile
file using VIM.
cd ~
vim .profile
- Hit "i" on your keyboard to enter insert mode.
- 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
- Save the file by hitting the "Esc" key on your keyboard. Then type
:x
and hit "Enter".
Checking the Installation
- Open a new Ubuntu terminal window and check that your environment is correct by typing
echo $FSLDIR
. - Check that your path is correct by running an FSL command such as
flirt --version
. - Check that the FSL GUI applications launch normally by running a command such as
fsleyes
orfsl
.
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
- First, download
swigwin-4.0.2.zip
from here. - Extract the archive and copy the
swigwin-4.0.2
folder toC:\Program Files\
. - Add
C:\Program Files\swigwin-4.0.2\
to your Windows PATH variable, just like you did for IDL above.
Configure and Compile
- Open the file
gamma\platforms\msvc2017e\dynamic\gamma.sln
in Visual Studio 2019. - 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.
- Double check that
python.exe
andswig.exe
are both added to your Windows PATH variable. - Start the build by right clicking
gamma
in the Solution Explorer and click build.
Installing PyGAMMA
cd gamma\pygamma
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:
- Navigate to
C:\Users\<User Name>\AppData\Local\Programs\Python\Python37\lib\site-packages\
in Windows Explorer. - Make a new directory called
pygamma
- Copy all files from
gamma\pygamma\dist_staging
- Delete the egg file (
pygamma-4.3.4rc1-py3.7.egg
)
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
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.
- Download and install MATLAB.
- 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
- Ensure you have the MATLAB NIFTI tools downloaded and on your MATLAB path.