Giter Site home page Giter Site logo

sepehr-mortaheb / fmri_preproc_spm Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 30 KB

This repository suggests an organized pipeline for spatial preprocessing of fMRI data (both task-based and resting-state).

MATLAB 100.00%
cat12 fmri-preprocessing spm12

fmri_preproc_spm's Introduction

An fMRI preprocessing pipeline

This is an automatic fMRI spatial preprocessing pipeline based on the SPM12 and CAT12 that can be used for both task-based and resting-state fMRI data. It consists of the following steps:

  • Susceptibility distortion correction
    • VDM calculation based on the fieldmap phase and amplitude data.
  • Realignment and Unwarp
    • Simultaneous realignment of functional volumes and applying VDM.
  • Segmentation of the structural data
    • It also creates a bias-corrected T1 image, normalizes it and all the extracted tissue masks to the MNI space, and outputs the forward and inverse transformation parameters.
  • Coregistration of the functional data into the T1 image.
    • It aligns the functional data to the bias-corrected T1 image.
  • Normalization to the MNI space
    • It uses the forward transformation parameters of the segmentation step, to normalize the functional data into the MNI space.
  • Smoothing

I tried to make this pipeline as automatic as possible. You just need to set some directories and acquisition parameters, run the pipeline, and sit and drink your coffee!

Useful info:

  • I used CAT12 for the segmentation as it gives more precise results than the SPM.
  • Make sure that before running the pipeline, you have downloaded the Artifact Detection Tools (ART) and have added its directory to the Matlab paths. Also make sure that you have downloaded the CAT12 package and have put it in the SPM toolbox folder.
  • The pipeline considers that your data is organized in the BIDS format as follows:
    Data_dir -->
                sub-XXX
                sub-YYY
                .
                .
                .
                sub-ZZZ -->
                           ses-xxx
                           ses-yyy
                           .
                           .
                           .
                           ses-zzz -->
                                      anat -->
                                              sub-ZZZ_ses-zzz_T1w.json
                                              sub-ZZZ_ses-zzz_T1w.nii
                                      fmap -->
                                              sub-ZZZ_ses-zzz_task-<TaskName>_magnitude1.json
                                              sub-ZZZ_ses-zzz_task-<TaskName>_magnitude1.nii
                                              sub-ZZZ_ses-zzz_task-<TaskName>_phasediff.json
                                              sub-ZZZ_ses-zzz_task-<TaskName>_phasediff.nii
                                      func -->
                                              sub-ZZZ_ses-zzz_task-<TaskName>_bold.json
                                              sub-ZZZ_ses-zzz_task-<TaskName>_bold.nii
    
  • To run the pipeline, open the preprocessing.m file, set the requested directories and parameters, and run the file.
  • If you need to change the hyperparmeters of different preprocessing steps, open the func_PreprocBatch.m file, and set the parameters with your own values accordingly.
  • I have tested the pipeline on macOS Sonoma Version 14.5 and it works without any error.

Do not hesitate to send your feedback to improve this pipeline!

fmri_preproc_spm's People

Contributors

sepehr-mortaheb 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.