MRI and EEG data analysis in Nilearn, FSL, Nipype, and more
Hands-on
- Software Carpentry Unix and/or Python
- Tal Yarkoni’s “Introduction to Python” lecture delivered at Neurohackademy 2019
- Gaël Varoquaux’s Scipy Lecture Notes
- J. R. Johansson IPython notebooks
After conda installation, one can create a separate conda environment specific to this workshop, without necessarily disturbing your own research specific installation packaging versions.
conda create -n nimg_workshop python=3.9
conda activate nimg_workshop
Pip is the most common package installer for Python. This session requires a few additional neuroimaging-specific Python packages that can be installed with:
pip install nibabel nilearn pybids
nilearn and nibabel are for Neuroimaging data loading & handling; pybids for organizing neuroimaging data in proper structure
pip install pandas
pandas is for non-imaging data loading
pip install matplotlib
matplotlib is for visualization
dcm2niix software package for converting neuroimaging data from the DICOM format that is exported from the MRI scanner to the NIfTI format. Detailed installation instructions for various operating systems can be found on the dcm2niix README. With the Anaconda Python distribution which is recommended, dcm2niix can be installed by:
Google Colab No installation as such, just use with Google login
For e.g., Try importing nilearn in a python / iPython session:
import nilearn
If no error is raised, you have installed nilearn correctly.
Similary, check for nibabel pandas, etc.
You can download the sample data either using internet browser or via command line.
From an internet browser simply navigate to this link and click Download option there.
Command line download option for Linux/MaxOS
wget https://zenodo.org/record/3677090/files/0219191_mystudy-0219-1114.tar.gz
Navigate to the directory where data is downloaded, then you can unzip and extract files from the tarball (tar archive) using the following command:
tar -xvzf 0219191_mystudy-0219-1114.tar.gz
gzip -d 0219191_mystudy-0219-1114/dcm/*dcm.gz
Data source: A Big Thanks to The Princeton Handbook for Reproducible Neuroimaging¶