Alexsavio scripts
De Grupo de Inteligencia Computacional (GIC)
Alex Scripting
FSL Tools
create_mean_template.sh
#!/bin/bash subjs_root=../Female/original target_dir=$PWD cd $subjs_root cont=0 subj_num=`ls *t88_gfc*hdr | wc -l` template=template.nii.gz temp=temp.nii.gz if [ -f $template ] then rm -f $template fi if [ -f $temp ] then rm -f $temp fi ls *hdr | while read vol; do cont=$(($cont + 1)) echo $cont - $vol if [ -f $template ] then tmp=`fslstats $vol -r` max_intensity=${tmp:`expr index "$tmp" ' '`:${#tmp}} fslmaths -dt double $vol -div $subj_num $temp fslmaths -dt double $temp -add $template $template -odt double else tmp=`fslstats $vol -r` max_intensity=${tmp:`expr index "$tmp" ' '`:${#tmp}} fslmaths -dt double $vol -div $subj_num $template fi done cont=`ls *hdr | wc -l` #smooth fslmaths $template -kernel gauss 2 -fmean $template mv $template $target_dir rm -f $temp echo $cont files processed.