Giter VIP home page Giter VIP logo

p-vs / uzb-fmr-processing-scripts Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 116.53 MB

This repository contains batch scripts to standardise and automate the processing of single echo (SE-fMRI), multi-echo (ME-fMRI) fMRI and VBM data in SPM12.

Home Page: https://github.com/P-VS/UZB-fmr-processing-scripts

License: GNU General Public License v3.0

Python 0.80% MATLAB 93.39% M 1.97% Makefile 0.03% C 2.32% C++ 1.49%
fmri-analysis fmri-data-analysis fmri-preprocessing spm12 vbm

uzb-fmr-processing-scripts's Introduction

UZB-fmr-processing-scripts

This repository contains some scripts used at UZ Brussel to standardise, optimise and automate the processing single echo and multi-echo fMRI data. Additionally, a batch script is provided to do the segmentation in CAT12 for VBM.

The python and Matlab scripts can be used independently from each other.

The scripts comes without any warrant for the results. You may use them at your own responsibility. I only share them to help and inspire others with their own processing scripts.

The folders contains following tools:

  1. Python

-AutoCropBET_T1w: FSL based cropping (RobustFOV), brain extraction (BET) and segmentation (FAST) of T1 weighted head scans

  1. Matlab

-spm_read_vols: alternative version of spm_read_vols that loads nifty data per volume rather than per slice to fasten up data loading. This script used the scripts in the my_spmbatch/NIFTI folder (copied from https://nl.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image). To use it, you have to replace or rename the original spm_read_vols.m file in the SPM12 folder.

-my_spmbatch/AutoSPMpreprocessing_fmri: initiating the automatic preprocessing of fMRI data in SPM12.

-my_spmbatch/AutoSPMprocessing_fmri: initiating the automatic processing of fMRI data in SPM12.

-my_spmbatch/AutoSPMpreprocessing_vbm: initiating the automatic preprocessing of VBM data (T1 anatomical high resolution scans) in CAT12.

The onsets and timings of the task events/blocks are read from an events.tsv file.

If no dummy scans at the start of the fMRI scan were added, you see a decrease in the image contrast in the first few dynamics. In that case, it is advisable to delete these first dynamics from the fMRI time series. In the AutoSPMpreprocessing_fmri script a step to delete these first "dummy" scans is included and the AutoSPMprocessing_fmri script will correct the onset timings in the event.tsv file with the start of the first dynamic in the remaining fMRI data. The number of dynamics that has to be deleted is calculated based on the 'dummytime' parameter (in seconds) and the TR. If your fMRI task started after the dummy scans at the scanner, you have to set the 'dummytime' as 0.

Although a Matlab convertion tool to convert dicom images into nifti format is included, dcm2niix (https://github.com/rordenlab/dcm2niix) as implemented in Python is advised. In the 'python_scripts' folder a batch script (convert_dcm2niix.py) is provided.

  1. fMRI_Class

The slides of my fMRI classes are provided. During these classes, a demo dataset is analysed manualy in the same way as is done by my scripts.


Required software installed:

To use the Matlab script within SPM:

To use the Python script:


Prior to using this script to process your data:

Convert the DICOM files into nifti using dcm2niix (e.g. manual in MROCroGL or by using 'convert_dcm2niix.py') For the anatomical scans, set 'Crop 3D Images' on

Optional but advisable, in SPM, set the origin and orientation of all scans according to the anterior-posterior comissura. It is best not to apply the transformation to the 4D data (it will nly be applied on the first dynamic), but to save the parameters in a .mat-file. The script will use the saved transformation for all dynamics.

Organise the data in BIDS format - datpath -sub-## -ses-00# (if your experiment contains multiple session per subject) -anat: containes the anatomical data (3D T1) Files: sub-##_T1w.nii and sub-##_T1w.json -func: containes the fmri data Files: sub-##_task-..._bold.nii and sub-##_task-..._bold.json -fmap: containnes the gradient pololarity (blip-up/down) filpt data or the fieldmap scans Files in case of inverted gradient polarity: sub-##_dir-pi_epi.nii and sub-##_dir-pi_epi.json Files in case of fieldmap scans: (image 1 in file is amplitude, image 2 in file is phase) sub-##_fmap_echo-1.nii and sub-##_fmap_echo-1.json sub-##_fmap_echo-2.nii and sub-##_fmap_echo-2.json

IMPORTANT: !! Look at your data before starting any (pre)processing. It makes no sense to lose time in trying to process bad data !!

uzb-fmr-processing-scripts's People

Contributors

p-vs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.