- Jerry Jeyachandra (https://github.com/jerdra)
- Michael Joseph (https://github.com/josephmje)
- Olivia Stanley (https://github.com/ostanley)
- Jason Kai (https://github.com/kaitj)
Open up a terminal and enter the following:
ssh <user>@teach.scinet.utoronto.ca
module load anaconda3
source /scinet/course/ss2019/3/6_mripython/setup_workshop
python -m ipykernel install --user --name mripython_conda
Open a new terminal and enter the following:
ssh -L 8888:jupyterhub<X>:8000 <user>@teach.scinet.utoronto.ca -N
Where <X>
is a number between 1-6.
If nothing happens that's great! Now open up your favourite browser and enter the following in your address bar:
https://localhost:8888
You're ready to go!
This will open up a jupyter terminal for you. Then just hit:
- New --> Terminal
This will open up a terminal. Once you're in here type the following:
./setup_workshop
Then leave it running in the background and switch tabs over back to the previous tab (says "Home" on Chrome)
On the GitHub repo (this page), click the green button that says "Clone or download", then click Download ZIP. Once downloaded, extract the ZIP file.
Using this method requires a (very) useful piece of software called git
. The process of installing git depends heavily on whether you're using MacOS, Windows or Linux. Follow the instructions in the link below to set up git
on your PC:
Once you've installed git
, open up your terminal and do the following:
git clone https://github.com/jerdra/scwg2018_python_neuroimaging.git
This will download the repository directly into your current directory.
We use python version 3.6.0, but any newer version should also work (Python 2 versions haven't been tested). There are many methods to setting up a python environment but we'd recommend using some sort of virtual environment as to not break your system python install. Two methods (of many) are listed below:
For easy set-up we recommend Anaconda to manage python packages for scientific computing. Once installed, setting up the python environment can be done quite easily:
- Install Anaconda Python version 3.7
- Open Anaconda Navigator
- Click on Environments on the left pane
- Click Create then type in
scwg2018_python_neuroimaging
- In the
scwg2018_python_neuroimaging
entry click the play button then click Open Terminal - In terminal type:
conda install -y numpy pandas scipy scikit-learn matplotlib jupyter ipykernel nb_conda
conda install -y -c conda-forge awscli
pip install nilearn nibabel
- Close the terminal, click on the play button again and open Jupyter Notebook
- Navigate to
scwg2018_python_neuroimaging
folder you downloaded earlier. - Done!
After installing Anaconda, open terminal and type:
cd scwg2018_python_neuroimaging
conda create -p ./scwg2018_nilearn
source activate $(pwd)/scwg2018_nilearn
conda install numpy pandas scipy scikit-learn matplotlib jupyter ipykernel nb_conda
conda install -c conda-forge awscli
pip install nilearn nibabel
An alternative method uses pyenv with pyenv virtualenv. This is a favourite because it seamlessly integrates multiple python versions and environments into your system while maintaining use of pip (instead of conda).
cd scwg2018_python_neuroimaging
pyenv virtualenv 3.6.0 scwg2018_nilearn
echo scwg2018_nilearn > .python-version
pip install --requirement requirements.txt
This tutorial uses data derived from the UCLA Consortium for Neuropsychiatric Phenomics LA5c Study [1].
To acquire the data we use Amazon AWS S3. You can set up an account using the link. Then you'll need to set up the awscli python tool using your AWS account credentials (more info: Amazon AWS CLI)
aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: ca-central-1
Default output format [None]: ENTER
To download (warning: large download size!) the subset of the data used for the tutorial:
cd scwg2018_python_neuroimaging
# download T1w scans
cat download_list | \
xargs -I '{}' aws s3 sync --no-sign-request \
s3://openneuro/ds000030/ds000030_R1.0.5/uncompressed/{}/anat \
./data/ds000030/{}/anat
# download resting state fMRI scans
cat download_list | \
xargs -I '{}' aws s3 sync --no-sign-request \
s3://openneuro/ds000030/ds000030_R1.0.5/uncompressed/{}/func \
./data/ds000030/{}/func \
--exclude '*' \
--include '*task-rest_bold*'
# download fmriprep preprocessed anat data
cat download_list | \
xargs -I '{}' aws s3 sync --no-sign-request \
s3://openneuro/ds000030/ds000030_R1.0.5/uncompressed/derivatives/fmriprep/{}/anat \
./data/ds000030/derivatives/fmriprep/{}/anat
# download fmriprep preprocessed func data
cat download_list | \
xargs -I '{}' aws s3 sync --no-sign-request \
s3://openneuro/ds000030/ds000030_R1.0.5/uncompressed/derivatives/fmriprep/{}/func \
./data/ds000030/derivatives/fmriprep/{}/func \
--exclude '*' \
--include '*task-rest_bold*'
Finally open up the jupyter notebook to explore the tutorials:
cd scwg2018_python_neuroimaging
#Include below line if using anaconda environment
source activate $(pwd)/scwg2018_nilearn
jupyter notebook
Reference
[1] Gorgolewski KJ, Durnez J and Poldrack RA. Preprocessed Consortium for Neuropsychiatric Phenomics dataset [version 2; referees: 2 approved]. F1000Research 2017, 6:1262 (https://doi.org/10.12688/f1000research.11964.2)