User Tools

Site Tools


neuroimagen:vbm_own

Custom VBM pipeline

Steps

  1. Get GM & WM
  2. Make initial template in MNI space
  3. Register to initial template & make custom template
  4. Register to custom template
  5. Merge and AVG
  6. randomise!

Diagrama de flujo

Get GM & WM from segmentation

I will get GM and WM from FS LUT.

GM WM
3, 10, 11, 12, 13, 17, 18, 26, 42, 49, 50, 51, 52, 53, 54, 58 2, 16, 28, 41, 60, 77, 85, 251, 252, 253, 254, 255

My first step should be get the aseg file from Freesurfer. Not to hard, I should know the FS subject ID, the ID in the actual project and the working directory,

get_aseg.sh
#!/bin/sh
 
fsid=$1
shift
 
id=$1
shift
 
dir=$1
shift
 
debug=0
 
#First get the freesurfer processed aseg.mgz
${FREESURFER_HOME}/bin/mri_label2vol --seg ${SUBJECTS_DIR}/${fsid}/mri/aseg.mgz --temp ${SUBJECTS_DIR}/${fsid}/mri/rawavg.mgz --o ${dir}/${id}_tmp_aseg.mgz --regheader ${SUBJECTS_DIR}/${fsid}/mri/aseg.mgz
${FREESURFER_HOME}/bin/mri_convert --in_type mgz --out_type nii ${dir}/${id}_tmp_aseg.mgz ${dir}/${id}_tmp_aseg.nii.gz
${FSLDIR}/bin/fslreorient2std ${dir}/${id}_tmp_aseg ${dir}/${id}_aseg
 
if [ $debug = 0 ] ; then
    rm ${dir}/${id}_tmp* 
fi

And from the aseg file I will select the proper segmentations. So I will make a loop over the segmentation tags and run a simple script,

get_lut.sh
#!/bin/sh
 
id=$1
shift
 
dir=$1
shift
 
lut=$1
shift
 
debug=0
 
${FSLDIR}/bin/fslmaths ${dir}/${id}_aseg.nii.gz -uthr ${lut} -thr ${lut} -div ${lut} ${dir}/${id}_${lut}.nii.gz
neuroimagen/vbm_own.txt · Last modified: 2021/06/28 11:00 by osotolongo