Code Monkey home page Code Monkey logo

gbss's Introduction

Gray-matter Based Spatial Statistics (NODDI-GBSS)

License

Introduction

Gray matter-based spatial statistics (NODDI-GBSS) is a pipeline to perform voxel-wise statistical analysis on gray matter microstructure. Our method is based on GBSS method primarily introduced by Ball et. al1 and discribed elswhere in full details2,3. Unlike the original GBSS method, NODDI-GBSS only uses multi-shell diffusion-weighted images for tissue segmentation and registration2,3. NODDI-GBSS requires NODDI (http://mig.cs.ucl.ac.uk/index.php?n=Tutorial.NODDImatlab) and DTI images and depends on FSL (http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/) and ANTs (http://stnava.github.io/ANTs/).

Overview

gbss_1_reg.sh

Gray matter fraction maps are estimated in the native diffusion space by subtracting CSF fraction (fCSF maps from NODDI) and white matter fraction (estimated by two-tissue class segmentation of FA images using Atropos) from 1 in each voxel. To increase tissue contrasts and enhance between-subject registration steps, partial volume estimation maps for each tissue class are multiplied by their corresponding contrast (0 for CSF, 1 for gray matter, and 2 for white matter) and summed together to generate images with similar contrast to T1-weighted images. The resulting images are then used to build a study-specific template using the buildtemplateparallel.sh script in the Advanced Normalization Tools (ANTs). Gray matter fraction, ODI, and NDI images are warped to the template space using the warp fields estimated during the previous step.

gbss_2_skell.sh

To enhance between-subject alignment of gray matter voxels, GBSS adopts the tract-based spatial statistics (TBSS) algorithm. The average gray matter fraction map was skeletonized and for each individual, diffusion metrics (i.e., ODI and NDI) and gray matter fraction were projected from local voxels with greatest gray matter fraction in the template space onto the skeleton. The final skeleton is generated by keeping only voxels with a gray matter fraction greater than a given threshold (default: 0.65) in more than a given percentage (default: 75%) of the subjects.

gbss_3_fill.sh

The remaining voxels on the subjects’ skeletons with non-satisfactory gray matter fraction (e.g. below 0.65) are filled with the average of the surrounding satisfactory voxels on the skeleton (e.g. gray matter fraction>0.65) weighted by their closeness with a Gaussian kernel (default: σ=2 mm).

Installation:

NODDI-GBSS scripts rely on FSL (v4.1.9 or higher) and ANTs (v2.1). After installing dependencies, simply clone the scripts as follows:

git clone https://github.com/arash-n/GBSS

Add the GBSS/NODDI folder to the $PATH.

Usage:

First, create an output directory containing following folders: FA, CSF, ODI, fIC. Copy respective images into each directory (all should have the same name across the folders: e.g. sub001.nii.gz). Now, you can run the scripts sequentially.

First Step:

For gbss_1_reg.sh, outputs from the NODDI and DTI models should be already available.This script works as follows:

a) The input older containing the following subdirectories: FA, CSF, ODI, fIC. b) Each Folder should contain corresponding image files with the same subject name in all folders.

NOTE: Remove any underline (_) from your filenames.

gbss_1_reg.sh [options] output_directory
Second Step:

NOTE: cd to output_directory

gbss_2_skel.sh
Third Step:

NOTE: cd to stats folder

gbss_3_fill.sh

Potential Alternative Routes:

NODDI Model Fitting:

If you are dealing with large high-resolution multi-shell DWI datasets and have access to computational clusters (+GPUs), I highly recommend using MDT toolbox: https://github.com/robbert-harms/MDT

Tissue Segmentations:

In the original implemenation of NODDI-GBSS, NODDI (Free water maps) and DTI models (FA map--> white matter segmentation) are used to indirectly estimate gray matter probability maps. However, it is possible to use multi-shell data and segment them into different tissue classes based on tissue masks from the structural MRI. This has been implemented as a part of MRtrix3:

dwi2fod msmt_csd dwi.mif wm_response.txt wmfod.mif gm_response.txt gm.mif csf_response.txt csf.mif

Here is the link for more information: https://mrtrix.readthedocs.io/en/latest/constrained_spherical_deconvolution/multi_shell_multi_tissue_csd.html

NOTE: Given the differences in estimation techniques, gray matter probability maps will not be identical with original NODDI-GBSS implementation.

Citations:

  1. Ball G, Srinivasan L, Aljabar P, Counsell SJ, Durighel G, Hajnal JV et al. Development of cortical microstructure in the preterm human brain. PNAS; 110(23): 9541-9546.
  2. Nazeri A, Chakravarty MM, Rotenberg DJ, Rajji TK, Rathi Y, Michailovich OV et al. Functional Consequences of Neurite Orientation Dispersion and Density in Humans across the Adult Lifespan. J Neurosci 2015; 35(4): 1753-1762.
  3. Nazeri A, Mulsant BH, Rajji TK, Levesque ML, Pipitone J, Stefanik L, Shahab S, Roostaei T et al. Gray matter neuritic microstructure deficits in schizophrenia and bipolar disorder. Biological Psychiatry 2017; 82(10): 726-736.

For a primer on diffusion-weighted imaging for characterization of gray matter microstructure and analysis pipelines (in the Supplementary Material), please see:

  1. Nazeri A, Schifani C, Anderson JA, Ameis SH, Voineskos AN. In vivo imaging of gray matter microstructure in major psychiatric disorders: Opportunities for clinical translation. Biological Psychiatry: Cognitive Neuroscience and Neuroimaging.

gbss's People

Contributors

arash-n avatar pipitone avatar tina-roostaei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gbss's Issues

threshold for bin_mean

Hi Arash,

I'd like to ask you what's the aim of the last line in gbss_3_fill.sh (fslmaths bin_mean.nii.gz -thr 0.995 mask). The reason is that I'm getting a nice skeleton in bin_mean.nii.gz but it gets very much disconnected when the threshold 0.995 is applied. Is it possible to lower that threshold to e.g. 0.95?

Thank you!

the Atropos command missing

Dear sirs,
Thanks for your GBSS code, Now I meet a problem about two commands missing Atropos -d 3 -a. gbss_1_reg.sh (line 166: can not find command Atropos).And gbss_1_reg.sh (line 204 ImageMath command) missing.

FSL version5.0.
ANTs version is the latest.

Thanks for your help.

Add checks for all tool dependencies

I think it would be nice to include some basic checks for the FSL and ANTS tools that GBSS depends on, and if they aren't found in the user's environment, we can spit out a "friendly" error message rather than just crash later on, cryptically. I've done this very basically in the my PR #2 by adding the check for FSLDIR. We could add specific checks for ANTS and other tools (e.g. fslmaths, etc..).

For instance,

command -v ANTS >/dev/null 2>&1 || { echo "ANTS required but not found. Aborting"; exit 1 }

gbss_2_skel.sh error

Image Exception : #63 :: No image files match: /noddi_gbss/input/*GM*
terminate called after throwing an instance of 'armawrap::AWException'
  what():  No image files match: /noddi_gbss/input/*GM*
/noddi_gbss/GBSS/NODDI/gbss_2_skel.sh: line 110: 14432 Aborted                 (core dumped) fslmerge -t all_GM ${tmp_folder}/*GM*

I was wondering if the GM fraction maps should auto generate or we need to manually provide it?

Not clear for the tutorial

Hi, after reading your original paper, and I tried to try your pipeline, but I found that the tutorial in the github is not so clear, I created the required output structure for the NODDI maps, and run the first command which is Ok, and then cd output_directory, and run the second script : gbss_2_skel.sh ., which gave me errors, do you have a better explanation for this different steps, because I found it very hard to understand.

Thanks in advance

Hao

Template drifts: Frontal part of brain was lack in D1_template.nii.gz in GBSS using buildtemplateparallel.sh

Hello, Dear Expert,

As mentioned in #11, I noticed that you suggested to check the intermediate templates are saved for QC, because sometimes the template drifts partially out of the field of view. If that occurs, the option -y 0 of antsMultivariateTemplateConstruction2.sh can be used; however, GBSS uses an older version of ANTs (buildtemplateparallel.sh) . I look up the usage of buildtemplateparallel.sh, However, buildtemplateparallel.sh doesn't have the option -y 0 to avoid template drifts in translation or orientation. How to deal with template drifts (the frontal part of brain was lack in D1_template.nii.gz) in GBSS using buildtemplateparallel.sh?

the frontal part of brain was lack in D1_template nii gz 2022-05-11 125853

Thank you very much!

Jay Chang

loop is not working

Hi Jon @pipitone

I was wondering if you can take a look at the new code added to the GBSS:

GBSS/NODDI/native/gbss_native.sh

It seems that the while loop is not working for some reason the j and k remain 1 instead of increasing by 1 each cycle.

Cheers,
Arash

GBSS-DKI?

Dear Arash,

we think, this would be great complement to the TBSS analysis on our data. However, I have a few questions an would like to kindly ask you for your advices.

First, I have more general question. With our dataset we aim to the DKI analysis. Is that possible to use your scripts for "GBSS-DKI" just by changing ODI and fIC parameters for DKI ones? Or do you see any reason, why this would fail?

If it would be OK, then I would have a question about the buildtemplateparallel.sh function (ANTs) in gbss_reg_1 script. In this issues forum someone wrote the function is outdated. You suggested to use the antsMultivariateTemplateConstruction2.sh with adjusted flags. I am not realy familiar with ANTs and differences between these two functions, could you please be more specific about changes needed?

Thank you for your advices.
Alzbeta

input threshold in gbss_2_skel.sh

Hi Arash,

do you think it would be meaningful to use an input threshold e.g. 0.45 in gbss_2_skel.sh? The reason for using such a low value, is because otherwise the skeleton I get is very disconnected. In addition to that, I'm also using -thr 0.025 (instead of 0.05) in the following lines.

fslmaths fIC_non_lesion_bin_s_2 -thr 0.025 -bin -mul all_lesion.nii.gz -mul fIC_filler -add fIC_non_lesion all_fIC_filled
fslmaths ODI_non_lesion_bin_s_2 -thr 0.025 -bin -mul all_lesion.nii.gz -mul ODI_filler -add ODI_non_lesion all_ODI_filled

and increased -s 2 to -s 3

Would you please, have a look at the attached skeleton? I guess the reason I have troubles to get a good skeleton is the large voxel size (2.5 mm iso).

mask_thr045.nii.gz

Thank you very much in advance.

wrong_registration

Hi Arash,
when we run the step of buildtemplateparallel.sh, we found that D1_template created could not match with the MNI_template, are there any parameters should I adjust?
looking forward to your reply
Yours
Hui Hong

buildtemplateparallel.sh outdated

Hi, I've just noticed that you use buildtemplateparallel.sh from ANTs to create the template. However, in ANTs they say that they'd rather recommend to use antsMultivariateTemplateConstruction2.sh instead of buildtemplateparallel.sh in general.
Do you think it would also work in the framework of your GBSS?
Thank you!

threshold in gbss_2_skel.sh

Hi Arash,
the threshold in gbss_2_skel.sh, line 139:
fslmaths all_fIC_skeletonised -mul mean_GM_skeleton_mask_general -thr 0.65 -bin all_lesion_fIC

does it refer to the same threshold defined in thresh (line 54)? if I choose another threshold, do I need to also change the one in line 139?

Thanks!

D1-template.nii.gz does not exist

  • mkdir /root/test/FA/D1
  • cp /root/test/FA/FA/Sub001_pseudoT1.nii.gz /root/test/FA/D1/
  • cd /root/test/FA/D1
  • '[' 1 == 1 ']'
  • echo 'OPTION 1: Creating Template Image'
    OPTION 1: Creating Template Image
  • buildtemplateparallel.sh -d 3 -j 1 -o D1_ -n 0 -s MI -i 4 -m 30x50x20 -t GR -z /usr/share/fsl/5.0/data/standard/MNI152_T1_1mm.nii.gz Sub001_pseudoT1.nii.gz
    do you have qsub? if not, then choose another c option ... if so, then check where the qsub alias points ...
  • '[' 1 == 0 ']'
  • cd /root/test/FA/FA
  • D1_folder=FA/D1
  • ref=/root/test/FA/D1/D1_template.nii.gz
  • for FAs in *FA.nii.gz
    ++ echo Sub001_FA.nii.gz
    ++ cut -f1 -d
  • a=Sub001
  • fsl_sub antsApplyTransforms -i Sub001_GM_frac.nii.gz -d 3 -e 0 -n NearestNeighbor -r /root/test/FA/D1/D1_template.nii.gz -t '/root/test/FA/D1/*Sub001_pseudoT1Warp.nii.gz' -t '/root/test/FA/D1/*Sub001_pseudoT1Affine.txt' -o /root/test/tmpspace/Sub001_GM.nii.gz --float
    file /root/test/FA/D1/D1_template.nii.gz does not exist .

Hi,
Trouble you again, from the debug info, The D1 folder is created automatically.
Where is D1_template.nii.gz ?

Best regards,
wang

NODDI AMICO

Hi Arash,

do you know if it would make a difference to use NODDI AMICO instead of using the NODDI matlab package in GBSS?

Best

fsl_sub -r flag

Hellow:
Thank for your work, I have a question when you create the template by using fsl_sub, you have a -r falg to point to the reference image(template), but I checked out the fsl fsl_sub wiki, there is no this flag, in my linux and mac, there are not neither, my fsl_sub versin is V1.1, can you please let me konw your fsl_sub version????

Thanks in advance

Hao

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.