Commit 7a946a97 authored by Ludovica Griffanti's avatar Ludovica Griffanti
Browse files

Upload bb_tbss_md_NAWM

parent 69fb4ee1
#!/bin/bash
#
# Script name: bb_tbss_md_NAWM
#
# Description: Script to calculate MD values from WM tracts excluding WMH, i.e. normal appearing white matter (NAWM)
# (adapted pipeline from dMRI sequence with 3 diffusion directions)
#
# Authors: Ludovica Griffanti, Fidel Alfaro-Almagro, Stephen M. Smith & Mark Jenkinson
#
# Copyright 2021 University of Oxford
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
. "$BB_BIN_DIR"/bb_pipeline_tools/bb_set_header
direc="$PWD"/"$1"
TBSSDir="$direc"/dMRI/TBSS
biancaDIR="$direc"/T2_FLAIR/lesions/
################# Apply FNRIT warp to WMH to have WMH_to_MNI.nii.gz
cd "$biancaDIR"
$FSLDIR/bin/applywarp -i final_mask.nii.gz -o final_mask_to_MNI.nii.gz -r ${FSLDIR}/data/standard/MNI152_T1_1mm.nii.gz -w ../../T1/transforms/T1_to_MNI_warp.nii.gz
################# Calculating IDPs masking out WMH
cd "$TBSSDir"
cd stats
fslmaths ${biancaDIR}/final_mask_to_MNI.nii.gz -thr 0.2 -binv -mul all_MD all_MD_NAWM
fslmaths all_MD_NAWM -mas mean_FA_skeleton_mask all_MD_NAWM_skeletonised
fslstats -K ${FSLDIR}/data/atlases/JHU/JHU-ICBM-labels-1mm all_MD_NAWM_skeletonised.nii.gz -M >JHUrois_MD_NAWM.txt
cd ../..
################# Saving IDPs in the main IDPs directory
#Setting the string of NaN in case there is a problem.
numVars="48"
nanResult="";
for i in $(seq 1 $numVars) ; do
nanResult="NaN $nanResult" ;
done
result=""
#for i in FA MD ; do
for i in MD_NAWM ; do
if [ -f ${TBSSDir}/stats/JHUrois_${i}.txt ] ; then
if [ `cat ${TBSSDir}/stats/JHUrois_${i}.txt | wc -w` = $numVars ] ; then
miniResult=`cat ${TBSSDir}/stats/JHUrois_${i}.txt`
else
miniResult="$nanResult"
fi
else
miniResult="$nanResult"
fi
result="$result $miniResult"
done
echo $result > ${direc}/IDP_files/bb_IDP_diff_TBSS_NAWM.txt
done
. "$BB_BIN_DIR"/bb_pipeline_tools/bb_set_footer
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment