Wednesday, 25 March 2015

DTI preparation for TBSS analysis

Before anything else you need to be sure that the data you need (diffusion and T1 images) have all been retrieved from Dougal into /data/blinded and contain no duplicates.
1) LOGIN IN TO ONE OF THE LINUX SERVERS (nanlnx1, nanlnx2,...)
% ssh kxxxxxxx@nanlnx1.iop.kcl.ac.uk
2) ADD THE NBL MODULE (THIS WILL SET UP YOU ENVIRONMENT SO YOU CAN RUN THE PIPELINE COMMANDS)
%  module add /home/k1339392/software/nbl /etc/nblmodule
3) CREATE THE FOLDERS FOR YOUR PROJECT (i.e. DRUM_PROJECT)
% mkdir ~/DRUM_PROJECT
% mkdir ~/DRUM_PROJECT/nandata
% mkdir ~/DRUM_PROJECT/dtidata
% mkdir ~/DRUM_PROJECT/expdtidata
% cd ~/DRUM_PROJECT
% ls
4) GET THE DATA FROM DOUGAL (add new folders with NIFTI data to ./nandata with NIFTI data)
% getnandata /data/blinded/CNSCNSD ./nandata DRUMPILOT01
% ls ./nandata
5) PREPARE DTI DATA FOR PREPROCESSING ( adds *.nii.gz *.bvec *.bval _mask.nii.gz files to ./dtidata). Use -C option if your data was acquired in the old CNS scanner using the 32 directions pulse sequence (i.e. BRCATLAS and MIAMRC projects).
% prepdti -C  ./nandata ./dtidata DRUMPILOT01 DTI_2mm_60B1500_FDA
% ls ./dtidata
6) PREPARE T1 DATA REQUIRED FOR EPI CORRECTION (adds new _T1.nii.gz _T1_mask.nii.gz files to ./dtidata)
% prept  ./nandata ./dtidata DRUMPILOT01 MPRAGE
7) RUN EXPLORE DTI PREPROCESSING SCRIPT (creates new *.mat *_EPI.mat files in ./expdtidata )
SM/EC CORRECTION ONLY
% expdticorr -R  ./dtidata ./expdtidata DRUMPILOT01 _SMEC
% ls ./expdtidata
SM/EC/EPI CORRECTION
% expdticorr -E  -R  ./dtidata ./expdtidata DRUMPILOT01 _EPI
% ls ./expdtidata

The final result will be a new file in ./expdtidata called DRUMPILOT01_[EPI/SMEC].mat. This file can only be opened with ExploreDTI. Using Explore DTI you will be able to generate any kind of diffusion images/maps you need, including of course tractography datasets.


See DTI pipeline document for more detail

Thursday, 5 March 2015

Random freesurfer commands and links

Table of surface areas (Desikan atlas)

aparc2statstable --hemi lh --subjects <list subjects> --tablefile lh.aparc.area.table

Table of thickness values (Desikan Atlas)

aparcstats2table --hemi lh --subjects <list subjects> -meas thickness --parc aparc --tablefile  lh.aparc.stats.thickness.table

Table of cortical volumes (Desikan Atlas)

aparcstats2table --subjects bert ernie fred margaret --parc aparc.a2005s --hemi rh --meas volume --tablefile aparc_stats_rh.txt

Table of subcortical volumes
asegstats2table --subjects bert ernie fred --meas volume --tablefile aseg_stats.txt

or create text file with path of all subjects and 

asegstats2table --subjectsfile=subject_to_write --meas volume --tablefile aseg_stats.txt

Change background of figure to white:
convert -fill white -opaque black <tksurfer_image_black_background>
<new_image_with_white_background>

http://ftp.nmr.mgh.harvard.edu/fswiki/FsTutorial/MorphAndRecon

Command line Group Analysis
https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/GroupAnalysis

Smoothing/qcache command
http://freesurfer.net/fswiki/FsTutorial/QdecGroupAnalysis_freeview

Methods citation
https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferMethodsCitation

Check surfaces
tkmedit your_subject_name wm.mgz rh.white -aux brain.mgz \
tkmedit your_subject_name wm.mgz lh.white -aux brain.mgz
https://surfer.nmr.mgh.harvard.edu/fswiki/BasicReconstruction

Check subcortical segmentation
tkmedit SUBJECT orig.mgz -aux-segmentation aseg.mgz

Explanation of steps of reconstruction
http://ftp.nmr.mgh.harvard.edu/fswiki/FsTutorial/MorphAndRecon


Recon-all descriptions
https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all