Python package for processing and analyzing high-resolution fMRI data. Please be aware that all functions are written for my own convenience and are under continuous development.
I recommend to use Miniconda
to create a new python environment with Python >= 3.6
. Then, clone this repository and run the following line from the directory in which the repository was cloned with the environment being activated:
pip install .
Another option is to install the package in development mode by creating a conda.pth
(which includes the path of the cloned repository) in the site-packages folder of your conda environment. Necessary external python packages can then be installed by running pip install -r requirements.txt
.
The package contains some matlab functions. Please add the following code to the matlab startup.m
script. This includes the package to the matlab search path. Next to the root directory of this package, you should add the root directory of SPM12, which is used throughout the package. Of course you have to specify the paths there.
%------------ FmriTools ------------------------------%
% Root directory of the fmri_tools package
path_fmri = <PATH-TO-FMRITOOLS-FOLDER>;
% Root directory of the SPM12 toolbox
path_spm12 = <PATH-TO-SPM12-ROOT>;
% add paths
addpath(fullfile(path_fmri, 'matlab'));
addpath(genpath(path_spm12));
clear path_fmri path_spm12;
%-----------------------------------------------------%
Single functions also call the matlab toolboxes OpenFmriAnalysis, knkutils, GLMdenoise, TDM and the SPM12 toolboxes hMRI, PhysIO, and VASA.
Furthermore, some functions need an installation of FreeSurfer, FSL, AFNI, ANTS and/or LAYNII which need to be accessible from the command line.
In the following, I list all necessary steps to install the gradunwarp toolbox to run gradient nonlinearity corrections with the scripts gnl_undistortion.py
or gnl_undistortion_time.py
:
- clone the gradunwarp repository
git clone https://github.com/Washington-University/gradunwarp.git
. - create a second conda environment with
python=2.7
:conda create -n <env> python=2.7
. - activate that environment:
conda activate <env>
. - install necessary packages:
pip install -r requirements.txt
. The requirements file is found in the same folder as this readme. - change to the cloned gradunwarp repository.
- install the repository with
python setup.py install
while the conda environment is still activated. wget "https://github.com/Washington-University/HCPpipelines/raw/stable/global/scripts/GradientDistortionUnwarp.sh"
.
- N.B. call the module
gradient_unwarp.py
with arguments--numpoints 128
and--interp_order 2
to have good accuracy when working with high-resolution data.
If you have questions, problems or suggestions regarding the FmriTools package, please feel free to contact me.