Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

deleted: rsc/scripts/LIA_to_LAS_conformed.mat

 	deleted:    rsc/scripts/apply_func2MNI.sh
 	deleted:    rsc/scripts/apply_mc+unwarp.sh
 	deleted:    rsc/scripts/apply_unwarp.sh
 	deleted:    rsc/scripts/bin/sort8
 	deleted:    rsc/scripts/checks.cmd
 	deleted:    rsc/scripts/collectvols.sh
 	deleted:    rsc/scripts/convert_regs.sh
 	deleted:    rsc/scripts/createALFF.sh
 	deleted:    rsc/scripts/cycler.sh
 	deleted:    rsc/scripts/delbrokenlinks.sh
 	deleted:    rsc/scripts/denoise4D.sh
 	deleted:    rsc/scripts/dualreg.sh
 	deleted:    rsc/scripts/dummy_bvalbvec.sh
 	deleted:    rsc/scripts/eddy_correct.sh
 	deleted:    rsc/scripts/eddy_correct_plot.sh
 	deleted:    rsc/scripts/ersatzblade.launcher.sh
 	deleted:    rsc/scripts/extract.sh
 	deleted:    rsc/scripts/extractConfoundsFromNativeFuncs.sh
 	deleted:    rsc/scripts/extractmerge.sh
 	deleted:    rsc/scripts/extractmerge_parallel.sh
 	deleted:    rsc/scripts/feat_T1_2_MNI.sh
 	deleted:    rsc/scripts/feat_hpf.sh
 	deleted:    rsc/scripts/feat_mask.sh
 	deleted:    rsc/scripts/feat_scale.sh
 	deleted:    rsc/scripts/feat_smooth.sh
 	deleted:    rsc/scripts/feat_unwarp.sh
 	deleted:    rsc/scripts/feat_writeMNI.sh
 	deleted:    rsc/scripts/findclusters.sh
 	deleted:    rsc/scripts/fs_convert.sh
 	deleted:    rsc/scripts/fs_create_masks.sh
 	deleted:    rsc/scripts/fsl_sub_NOPOSIXLY.sh
 	deleted:    rsc/scripts/fsl_sub_v5_NOPOSIXLY.sh
 	deleted:    rsc/scripts/getsliceorderSIEMENS_interleaved.sh
 	deleted:    rsc/scripts/globalfuncs
 	deleted:    rsc/scripts/globalvars_test
 	deleted:    rsc/scripts/greperror.sh
 	deleted:    rsc/scripts/greptracstats.sh
 	deleted:    rsc/scripts/ic011_ExtractCorrelations.sh
 	deleted:    rsc/scripts/longt_fslvbm_2_template.sh
 	deleted:    rsc/scripts/longt_fslvbm_3_proc.sh
 	deleted:    rsc/scripts/main.sh
 	deleted:    rsc/scripts/make_fmap.sh
 	deleted:    rsc/scripts/melodic.sh
 	deleted:    rsc/scripts/nautilus/FSL_Glm
 	deleted:    rsc/scripts/nautilus/FSL_checkTBSS
 	deleted:    rsc/scripts/nautilus/FSL_checkVBM
 	deleted:    rsc/scripts/nautilus/FSL_fslview
 	deleted:    rsc/scripts/nautilus/FS_freeview
 	deleted:    rsc/scripts/qdelall.sh
 	deleted:    rsc/scripts/qstatloop.sh
 	deleted:    rsc/scripts/rem_noise.sh
 	deleted:    rsc/scripts/show3D.sh
 	deleted:    rsc/scripts/show4D.sh
 	deleted:    rsc/scripts/topup.sh
 	deleted:    rsc/scripts/unwarp4D.sh
 	deleted:    rsc/scripts/update_FSL-scripts.sh
  • Loading branch information...
commit 72bebae332cae443d61a13f5f40b84840deeb7d2 1 parent 5cf054f
@ahheckel authored
Showing with 0 additions and 10,181 deletions.
  1. +0 −4 rsc/scripts/LIA_to_LAS_conformed.mat
  2. +0 −109 rsc/scripts/apply_func2MNI.sh
  3. +0 −94 rsc/scripts/apply_mc+unwarp.sh
  4. +0 −49 rsc/scripts/apply_unwarp.sh
  5. BIN  rsc/scripts/bin/sort8
  6. +0 −488 rsc/scripts/checks.cmd
  7. +0 −95 rsc/scripts/collectvols.sh
  8. +0 −52 rsc/scripts/convert_regs.sh
  9. +0 −110 rsc/scripts/createALFF.sh
  10. +0 −54 rsc/scripts/cycler.sh
  11. +0 −25 rsc/scripts/delbrokenlinks.sh
  12. +0 −160 rsc/scripts/denoise4D.sh
  13. +0 −153 rsc/scripts/dualreg.sh
  14. +0 −47 rsc/scripts/dummy_bvalbvec.sh
  15. +0 −93 rsc/scripts/eddy_correct.sh
  16. +0 −47 rsc/scripts/eddy_correct_plot.sh
  17. +0 −4 rsc/scripts/ersatzblade.launcher.sh
  18. +0 −28 rsc/scripts/extract.sh
  19. +0 −62 rsc/scripts/extractConfoundsFromNativeFuncs.sh
  20. +0 −33 rsc/scripts/extractmerge.sh
  21. +0 −75 rsc/scripts/extractmerge_parallel.sh
  22. +0 −63 rsc/scripts/feat_T1_2_MNI.sh
  23. +0 −34 rsc/scripts/feat_hpf.sh
  24. +0 −58 rsc/scripts/feat_mask.sh
  25. +0 −37 rsc/scripts/feat_scale.sh
  26. +0 −82 rsc/scripts/feat_smooth.sh
  27. +0 −137 rsc/scripts/feat_unwarp.sh
  28. +0 −46 rsc/scripts/feat_writeMNI.sh
  29. +0 −103 rsc/scripts/findclusters.sh
  30. +0 −66 rsc/scripts/fs_convert.sh
  31. +0 −61 rsc/scripts/fs_create_masks.sh
  32. +0 −407 rsc/scripts/fsl_sub_NOPOSIXLY.sh
  33. +0 −479 rsc/scripts/fsl_sub_v5_NOPOSIXLY.sh
  34. +0 −36 rsc/scripts/getsliceorderSIEMENS_interleaved.sh
  35. +0 −1,013 rsc/scripts/globalfuncs
  36. +0 −342 rsc/scripts/globalvars_test
  37. +0 −24 rsc/scripts/greperror.sh
  38. +0 −85 rsc/scripts/greptracstats.sh
  39. +0 −87 rsc/scripts/ic011_ExtractCorrelations.sh
  40. +0 −136 rsc/scripts/longt_fslvbm_2_template.sh
  41. +0 −69 rsc/scripts/longt_fslvbm_3_proc.sh
  42. +0 −4,052 rsc/scripts/main.sh
  43. +0 −70 rsc/scripts/make_fmap.sh
  44. +0 −61 rsc/scripts/melodic.sh
  45. +0 −2  rsc/scripts/nautilus/FSL_Glm
  46. +0 −4 rsc/scripts/nautilus/FSL_checkTBSS
  47. +0 −4 rsc/scripts/nautilus/FSL_checkVBM
  48. +0 −2  rsc/scripts/nautilus/FSL_fslview
  49. +0 −5 rsc/scripts/nautilus/FS_freeview
  50. +0 −4 rsc/scripts/qdelall.sh
  51. +0 −6 rsc/scripts/qstatloop.sh
  52. +0 −31 rsc/scripts/rem_noise.sh
  53. +0 −15 rsc/scripts/show3D.sh
  54. +0 −17 rsc/scripts/show4D.sh
  55. +0 −664 rsc/scripts/topup.sh
  56. +0 −69 rsc/scripts/unwarp4D.sh
  57. +0 −28 rsc/scripts/update_FSL-scripts.sh
View
4 rsc/scripts/LIA_to_LAS_conformed.mat
@@ -1,4 +0,0 @@
-1 0 0 0
-0 0 1 0
-0 -1 0 255
-0 0 0 1
View
109 rsc/scripts/apply_func2MNI.sh
@@ -1,109 +0,0 @@
-#!/bin/bash
-# writes func -> standard space w/o intermediary write-outs.
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <input4D> <output4D> <mc mat-dir|.ecclog file|matrix file> <unwarp shiftmap> <unwarp direction: x/y/z/x-/y-/z-> <func_to_T1 mat> <T1_to_MNI warp> <interp>"
- echo "Example: `basename $0` bold mni_bold ./mc/prefiltered_func_data_mcf.mat/ ./unwarp/EF_UD_shift.nii.gz y ./reg/example_func2highres.mat ./reg/highres2standard_warp.nii.gz spline"
- echo " `basename $0 diff mni_diff ./diff.ecclog ./unwarp/EF_UD_shift.nii.gz y ./reg/example_func2highres.mat ./reg/highres2standard_warp.nii.gz spline"
- echo " `basename $0 diff mni_diff ./matrix.mat ./unwarp/EF_UD_shift.nii.gz y ./reg/example_func2highres.mat ./reg/highres2standard_warp.nii.gz spline"
- echo ""
- exit 1
-}
-
-[ "$7" = "" ] && Usage
-
-input=`remove_ext "$1"`
-output=`remove_ext "$2"`
-mcdir="$3"
-shiftmap="$4"
-uwdir="$5"
-f2t1_mat="$6"
-f2mni_warp="$7"
-interp="$8"
-if [ x"$interp" = "x" ] ; then interp="trilinear" ; fi
-
-# motion correction or eddy-correction ?
-ecclog=0 ; sinlgemat=0
-if [ ! -d $mcdir ] ; then
- echo "`basename $0`: '$mcdir' is not a directory..."
- if [ -f $mcdir -a ${mcdir#*.} = "ecclog" ] ; then
- echo "`basename $0`: '$mcdir' is an .ecclog file."
- ecclog=1
- elif [ -f $mcdir ] ; then
- sinlgemat=1
- echo "`basename $0`: '$mcdir' is not an .ecclog file - let's assume that it is a text file with a transformation matrix in it..."
- else
- echo "`basename $0`: '$mcdir' not found. Exiting..." ; exit 1
- fi
-fi
-
-# display info
-echo "`basename $0` : write func -> standard space w/o intermediary write-outs..."
-
-# extract example_func
-nvol=`fslinfo $input | grep ^dim4 | awk '{print $2}'`
-mid=$(echo "scale=0 ; $nvol / 2" | bc)
-fslroi $input ${output}_example_func $mid 1
-
-# convert warps
- cmd="convertwarp --ref=${output}_example_func --shiftmap=${shiftmap} --shiftdir=${uwdir} --out=${output}_WARP1 --relout"
- echo $cmd
- $cmd
-
-
- cmd="convertwarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --warp1=${f2mni_warp} --premat=${f2t1_mat} --out=${output}_WARP2 --relout"
- echo $cmd
- $cmd
-
-
- cmd="convertwarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --warp1=${output}_WARP1 --warp2=${output}_WARP2 --out=${output}_WARP --relout"
- echo $cmd
- $cmd
-
-# apply transforms
-imrm ${output}_tmp_????.*
-fslsplit $input ${output}_tmp_
-full_list=`imglob ${output}_tmp_????.*`
-i=0
-for file in $full_list ; do
- echo "processing $file"
- if [ $ecclog -eq 1 -o $sinlgemat -eq 1 ] ; then
- if [ $ecclog -eq 1 ] ; then
- line1=$(echo "$i*8 + 4" | bc -l)
- line2=$(echo "$i*8 + 7" | bc -l)
- cat ${mcdir} | sed -n "$line1,$line2"p > ${output}_tmp_ecclog.mat
- cmd="applywarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --in=${file} --warp=${output}_WARP --premat=${output}_tmp_ecclog.mat --rel --out=${file} --interp=${interp}"
- elif [ $sinlgemat -eq 1 ] ; then
- cmd="applywarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --in=${file} --warp=${output}_WARP --premat=${mcdir} --rel --out=${file} --interp=${interp}"
- fi
- else
- i=`zeropad $i 4`
- cmd="applywarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --in=${file} --warp=${output}_WARP --premat=${mcdir}/MAT_${i} --rel --out=${file} --interp=${interp}"
- fi
- echo $cmd
- $cmd
-
- i=$(scale=0 ; echo "$i + 1" | bc)
-done
-
-# merge
-echo "`basename $0`: merge outputs...."
-fslmerge -t $output $full_list
-outdir=$(dirname $output)
-fslroi $output $outdir/example_func $mid 1
-
-# cleanup
-imrm $full_list
-imrm ${output}_example_func
-imrm ${output}_WARP1
-imrm ${output}_WARP2
-imrm ${output}_WARP
-rm -f ${output}_tmp_ecclog.mat
-
-
-echo "`basename $0` : done."
View
94 rsc/scripts/apply_mc+unwarp.sh
@@ -1,94 +0,0 @@
-#!/bin/bash
-# apply motion correction and unwarp shiftmap to 4Ds
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <input4D> <output4D> <mc mat-dir|.ecclog file|matrix file> <unwarp shiftmap> <unwarp direction: x/y/z/x-/y-/z-> <interp (default:trilinear)>"
- echo "Example: `basename $0` bold uw_bold ./mc/prefiltered_func_data_mcf.mat/ ./unwarp/EF_UD_shift.nii.gz y spline"
- echo " `basename $0` diff uw_diff ./ec_dwi.ecclog ./unwarp/EF_UD_shift.nii.gz y spline"
- echo " `basename $0` diff uw_diff ./matrix.mat ./unwarp/EF_UD_shift.nii.gz y spline"
- echo ""
- exit 1
-}
-
-[ "$5" = "" ] && Usage
-
-input=`remove_ext "$1"`
-output=`remove_ext "$2"`
-mcdir="$3"
-shiftmap="$4"
-uwdir="$5"
-interp="$6"
-if [ x"$interp" = "x" ] ; then interp="trilinear" ; fi
-
-# motion correction or eddy-correction ?
-ecclog=0 ; sinlgemat=0
-if [ ! -d $mcdir ] ; then
- echo "`basename $0`: '$mcdir' is not a directory..."
- if [ -f $mcdir -a ${mcdir#*.} = "ecclog" ] ; then
- echo "`basename $0`: '$mcdir' is an .ecclog file."
- ecclog=1
- elif [ -f $mcdir ] ; then
- sinlgemat=1
- echo "`basename $0`: '$mcdir' is not an .ecclog file - let's assume that it is a text file with a transformation matrix in it..."
- else
- echo "`basename $0`: '$mcdir' not found. Exiting..." ; exit 1
- fi
-fi
-
-# display info
-echo "`basename $0` : applying motion-correction and shiftmap..."
-
-# write unwarp warpfield
-nvol=`fslinfo $input | grep ^dim4 | awk '{print $2}'`
-mid=$(echo "scale=0 ; $nvol / 2" | bc)
-fslroi $input ${output}_example_func $mid 1
-cmd="convertwarp --ref=${output}_example_func --shiftmap=${shiftmap} --shiftdir=${uwdir} --out=${output}_WARP1 --relout"
-echo $cmd
-$cmd
-
-# combine with motion correction
-imrm ${output}_tmp_????.*
-fslsplit $input ${output}_tmp_
-full_list=`imglob ${output}_tmp_????.*`
-i=0
-for file in $full_list ; do
- echo "processing $file"
-
- if [ $ecclog -eq 1 -o $sinlgemat -eq 1 ] ; then
- if [ $ecclog -eq 1 ] ; then
- line1=$(echo "$i*8 + 4" | bc -l)
- line2=$(echo "$i*8 + 7" | bc -l)
- cat ${mcdir} | sed -n "$line1,$line2"p > ${output}_tmp_ecclog.mat
- cmd="applywarp --ref=${output}_example_func --in=${file} --warp=${output}_WARP1 --premat=${output}_tmp_ecclog.mat --rel --out=${file} --interp=${interp}"
- elif [ $sinlgemat -eq 1 ] ; then
- cmd="applywarp --ref=${output}_example_func --in=${file} --warp=${output}_WARP1 --premat=${mcdir} --rel --out=${file} --interp=${interp}"
- fi
- else
- i=`zeropad $i 4`
- cmd="applywarp --ref=${output}_example_func --in=${file} --warp=${output}_WARP1 --premat=${mcdir}/MAT_${i} --rel --out=${file} --interp=${interp}"
- fi
-
- echo $cmd
- $cmd
-
- i=$(scale=0 ; echo "$i + 1" | bc)
-done
-
-# merge
-echo "`basename $0`: merge outputs...."
-fslmerge -t $output $full_list
-outdir=$(dirname $output)
-fslroi $output $outdir/example_func $mid 1
-
-# cleanup
-imrm $full_list
-imrm ${output}_example_func
-imrm ${output}_WARP1
-rm -f ${output}_tmp_ecclog.mat
-
-echo "`basename $0` : done."
View
49 rsc/scripts/apply_unwarp.sh
@@ -1,49 +0,0 @@
-#!/bin/bash
-# apply unwarp shiftmap to 4Ds
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <input4D> <output4D> <unwarp shiftmap> <unwarp direction: x/y/z/x-/y-/z-> <interp (default:trilinear)>"
- echo "Example: `basename $0` bold uw_bold ./unwarp/EF_UD_shift.nii.gz y spline"
- echo ""
- exit 1
-}
-
-[ "$4" = "" ] && Usage
-
-input=`remove_ext "$1"`
-output=`remove_ext "$2"`
-shiftmap="$3"
-uwdir="$4"
-interp="$5"
-if [ x"$interp" = "x" ] ; then interp="trilinear" ; fi
-
-echo "`basename $0` : applying shiftmap..."
-
-nvol=`fslinfo $input | grep ^dim4 | awk '{print $2}'`
-mid=$(echo "scale=0 ; $nvol / 2" | bc)
-fslroi $input ${output}_example_func $mid 1
-
-
- cmd="convertwarp --ref=${output}_example_func --shiftmap=${shiftmap} --shiftdir=${uwdir} --out=${output}_WARP1 --relout"
- echo $cmd
- $cmd
-
- cmd="applywarp --ref=${output}_example_func --in=${input} --warp=${output}_WARP1 --rel --out=${output} --interp=${interp}"
- echo $cmd
- $cmd
-
- i=$(scale=0 ; echo "$i + 1" | bc)
-
-outdir=$(dirname $output)
-fslroi $output $outdir/example_func $mid 1
-
-imrm ${output}_example_func
-imrm ${output}_WARP1
-
-
-echo "`basename $0` : done."
View
BIN  rsc/scripts/bin/sort8
Binary file not shown
View
488 rsc/scripts/checks.cmd
@@ -1,488 +0,0 @@
-############
-# CHECK LOGS
-############
-
-# check recon-all
-grep --color=always "finished without error" ./logs/* | grep recon-all | grep -v recon-all_base | grep -v recon-all_long
-grep --color=always "finished without error" ./logs/* | grep recon-all_base
-grep --color=always "finished without error" ./logs/* | grep recon-all_long
-
-
-
-# check tracula
-grep --color=always "finished without error" ./logs/* | grep trac-all-prep
-
-c=1
-for i in `find ./subj/FS_subj -name monitor -type f | sort` ; do
- i=$(dirname $i)
- if [ -f $i/xfms/eye.mat ] ; then
- echo "$c '$i' : finished"
- else
- echo "$c '$i' : unfinished"
- fi
- c=$[$c+1]
-done
-c=0
-
-grep --color=always "finished without error" ./logs/* | grep trac-all-paths
-
-
-
-# check sge error-logs
-greperror.sh logs/*.e*
-
-
-
-# check BPX
-subdir=bpx_topup_ec_bvecrot.bedpostX
-c=1 ; for i in `find ./subj -name monitor -type f | grep /bpx/$subdir | sort` ; do
- i=$(dirname $i)
- if [ -f $i/xfms/eye.mat ] ; then
- echo "$c '$i' : finished."
- else
- echo "$c '$i' : UNFINISHED."
- fi
- c=$[$c+1]
-done ; c=0
-
-
-
-# check feat - dwi
-subdir=unwarpDWI_y.feat
-find ./subj -name report_log.html -type f | grep /fdt/$subdir | sort | xargs -I {} greperror.sh {}
-
-
-
-# check feat - bold
-subdir=preprocBOLD_uw.y_st0_s0_hpfInf.feat
-find ./subj -name report_log.html -type f | grep /bold/$subdir | sort | xargs -I {} greperror.sh {}
-
-
-
-# check VBM
-subdir=vbm_nonflip
-greperror.sh ./grp/vbm/$subdir/*/fslvbm*
-greperror.sh ./grp/vbm/$subdir/stats*/*/*/*.generate*
-
-
-
-# check TBSS
-subdir=tbss_nonflip_topup_ec_bvecrot
-find ./grp/tbss/$subdir/*/ -name tbss_?_* | sort | xargs -I {} greperror.sh {}
-greperror.sh ./grp/tbss/$subdir/stats*/*/*/*.generate*
-
-
-
-# check dualreg
-subdir=ica_50_allICs_n2000
-greperror.sh ./grp/dualreg/$subdir/scripts+logs/*
-
-
-
-
-
-##############
-# CHECK IMAGES
-##############
-
-################################
-# check denoise masks (mni bold)
-################################
-file=filtered_func_data_longt_mni2.nii.gz ; subdir=bold/SESSA_uw+y_st0_s0_hpfInf.feat ; out=chk/MNI_bold_merged
-
-mkdir -p $(dirname $out)
-files=$(find ./subj -name $file | grep /$subdir/reg_standard/ | sort)
-c=1; for i in $files ; do echo "$(zeropad $c 3) $i" ; c=$[$c+1] ; done ; c=0
-extractmerge.sh $out 0 "$files"
-cmd="fslview ${out} $FSL_DIR/data/standard/avg152T1_csf_bin.nii.gz -l "Blue" -t 0.5 $FSL_DIR/data/standard/avg152T1_white_bin.nii.gz -l "Yellow" -t 0.5"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-######################################
-# check denoise masks (mni bold) - alt
-######################################
-file=filtered_func_data_mni2.nii.gz ; subdir=bold/SESSA_uw+y_st0_s0_hpfInf.feat ; out=MNI_bold_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out) ; imrm ${out}tmp_????
-f_WM=""; f_CSF=""; f_WB=""; f_bold=""
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$subdir/reg_standard/$file -a -d $i/$j/$subdir/reg_standard/noise ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- f_WM=$f_WM" "$i/$j/$subdir/reg_standard/noise/MNI_WM
- f_CSF=$f_CSF" "$i/$j/$subdir/reg_standard/noise/MNI_CSF
- f_WB=$f_WB" "$i/$j/$subdir/reg_standard/noise/EF_WB
- extractmerge.sh ${out}tmp_$(zeropad $c 4) 0 "$i/$j/$subdir/reg_standard/$file"
- f_bold=$f_bold" "${out}tmp_$(zeropad $c 4)
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}WM_merged $f_WM 2>/dev/null
-fslmerge -t ${out}CSF_merged $f_CSF 2>/dev/null
-fslmerge -t ${out}WB_merged $f_WB 2>/dev/null
-fslmerge -t ${out}merged $f_bold 2>/dev/null
-imrm ${out}tmp_????
-cmd="fslview ${out}merged ${out}WB_merged -t 0 ${out}CSF_merged -l "Blue" -t 0.5 ${out}WM_merged -l "Yellow" -t 0.5"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-###################################
-# check denoise masks (native bold)
-###################################
-file=example_func.nii.gz ; subdir=bold/SESSA_uw+y_st0_s0_hpfInf.feat ; out=chk/EF_bold_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out) ; imrm ${out}tmp_????
-f_WM=""; f_CSF=""; f_WB=""; f_bold=""
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$subdir/$file -a -d $i/$j/$subdir/noise ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- f_WM=$f_WM" "$i/$j/$subdir/noise/EF_WM
- f_CSF=$f_CSF" "$i/$j/$subdir/noise/EF_CSF
- f_WB=$f_WB" "$i/$j/$subdir/noise/EF_WB
- f_bold=$f_bold" "$i/$j/$subdir/$file
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}WM_merged $f_WM 2>/dev/null
-fslmerge -t ${out}CSF_merged $f_CSF 2>/dev/null
-fslmerge -t ${out}WB_merged $f_WB 2>/dev/null
-fslmerge -t ${out}merged $f_bold 2>/dev/null
-imrm ${out}tmp_????
-cmd="fslview ${out}merged ${out}WB_merged -t 0 ${out}CSF_merged -l "Blue" -t 0.5 ${out}WM_merged -l "Yellow" -t 0.5"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-############################
-# check vbm brain extraction
-############################
-struc=*_t1_orig.nii.gz ; brain=*_t1_watershed_initbrain.nii.gz ; out=chk/vbm_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out) ; imrm ${out}tmp_????
-f_brain=""; f_struc=""
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/vbm/$struc -a -f $i/$j/vbm/$brain ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- f_brain=$f_brain" "$i/$j/vbm/$brain
- f_struc=$f_struc" "$i/$j/vbm/$struc
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}brain $f_brain 2>/dev/null
-fslmerge -t ${out}struc $f_struc 2>/dev/null
-
-cmd="fslview ${out}struc -t 0.5 ${out}brain -t 1"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-###################
-# check bold unwarp
-###################
-file=bold/preprocBOLD_hpf100_s4_uw-y.feat/filtered_func_data.nii.gz ; file2=$(dirname $file)/unwarp/EF_UD_fmap_mag_brain.nii.gz ; out=chk/EF_bold_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out) ; imrm ${out}tmp_????
-files=""; files2="";
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- extractmerge.sh ${out}tmp_$(zeropad $c 4) 0 "$i/$j/$file"
- files=$files" "${out}tmp_$(zeropad $c 4)
- #files=$files" "$i/$j/$file
- files2=$files2" "$i/$j/$file2
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}merged $files 2>/dev/null
-fslmerge -t ${out}magn_merged $files2 2>/dev/null
-imrm ${out}tmp_????
-cmd="fslview ${out}magn_merged -l "Blue-Lightblue" ${out}merged"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-######################
-# check BOLD->T1 bbreg
-######################
-file=bold/preprocBOLD_uw+y_st0_s0_hpf100.feat/reg_longt/example_func2highres_bbr.nii.gz ; file2=$(dirname $file)/highres.nii.gz ; out=chk/EF_bold_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out) ; imrm ${out}tmp_????
-files=""; files2="";
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- files=$files" "$i/$j/$file
- files2=$files2" "$i/$j/$file2
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}bold_bbreg $files 2>/dev/null
-fslmerge -t ${out}T1 $files2 2>/dev/null
-imrm ${out}tmp_????
-cmd="fslview ${out}bold_bbreg ${out}T1"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-##################
-# check dwi unwarp
-##################
-file=fdt/unwarpDWI_y.feat/filtered_func_data.nii.gz ; file2=$(dirname $file)/unwarp/EF_UD_fmap_mag_brain.nii.gz ; out=chk/EF_dwi_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a c e"
-
-mkdir -p $(dirname $out) ; imrm ${out}tmp_????
-files=""; files2="";
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- extractmerge.sh ${out}tmp_$(zeropad $c 4) 0 "$i/$j/$file"
- files=$files" "${out}tmp_$(zeropad $c 4)
- #files=$files" "$i/$j/$file
- files2=$files2" "$i/$j/$file2
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}merged $files 2>/dev/null
-fslmerge -t ${out}magn_merged $files2 2>/dev/null
-imrm ${out}tmp_????
-cmd="fslview ${out}magn_merged -l "Blue-Lightblue" ${out}merged"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-#############
-# pSWI -> MNI
-#############
-_subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-_sess="a b c d e"
-out=pseudoSWI_MNI
-subdir=SESSA_uw+y_st0_s0_hpfInf.feat
-_FM_2_EF=bold/$subdir/unwarp/FM_2_EF.mat
-_EF_2_T1=bold/$subdir/reg_longt/example_func2longt_brain.mat
- #_EF_2_T1=bold/$subdir/reg/example_func2highres.mat
-_T1_2_MNI=bold/$subdir/reg_longt/longt_head2longt_standard_warp.nii.gz
- #_T1_2_MNI=bold/$subdir/reg/highres2standard_warp.nii.gz
-
-c=1 ; for subj in $_subj ; do
- for sess in $_sess ; do
- fldr=$subj/$sess/fm
- fmap=$fldr/uphase_rad_filt.nii.gz
- fmap0=$fldr/fmap_rads_masked.nii.gz
- magn=$fldr/magn.nii.gz
-
- FM_2_EF=$subj/$sess/$_FM_2_EF
- EF_2_T1=$subj/$sess/$_EF_2_T1
- T1_2_MNI=$subj/$sess/$_T1_2_MNI
-
- err=0
- if [ ! -f $FM_2_EF ] ; then echo "$subj $sess : '$FM_2_EF' not found." ; err=1 ; fi
- if [ ! -f $EF_2_T1 ] ; then echo "$subj $sess : '$EF_2_T1' not found." ; err=1 ; fi
- if [ ! -f $T1_2_MNI ] ; then echo "$subj $sess : '$T1_2_MNI' not found." ; err=1 ; fi
- if [ ! -f $magn ] ; then echo "$subj $sess : '$magn' not found." ; err=1 ; fi
- if [ $err -eq 1 ] ; then continue ; fi
-
- c=$[$c+1]
- echo "$(zeropad $c 3) $subj $sess : found."
-
- echo " subj $subj , sess $sess : fieldmap->bold: $FM_2_EF"
- echo " subj $subj , sess $sess : bold->T1: $EF_2_T1"
- echo " subj $subj , sess $sess : T1->MNI: $T1_2_MNI"
-
- echo " subj $subj , sess $sess : concatenate matrices..."
- convert_xfm -omat $fldr/fm_to_t1.mat -concat $EF_2_T1 $FM_2_EF
-
- echo " subj $subj , sess $sess : apply transform to `basename $fmap`..."
- applywarp --ref=$FSLDIR/data/standard/MNI152_T1_2mm_brain --in=$fmap --out=$fldr/${out} --warp=$T1_2_MNI --premat=$fldr/fm_to_t1.mat
-
- #echo " subj $subj , sess $sess : apply transform to `basename $fmap0`..."
- #applywarp --ref=$FSLDIR/data/standard/MNI152_T1_2mm_brain --in=$fmap0 --out=$fldr/fmap_MNI --warp=$T1_2_MNI --premat=$fldr/fm_to_t1.mat
-
- #echo " subj $subj , sess $sess : apply transform to `basename $magn`..."
- #applywarp --ref=$FSLDIR/data/standard/MNI152_T1_2mm_brain --in=$magn --out=$fldr/magn_brain_MNI --warp=$T1_2_MNI --premat=$fldr/fm_to_t1.mat
- done
-done ; c=0
-
-
-##########################
-# check fmap & hpf'ed fmap
-##########################
-file=fm/fmap_rads_masked.nii.gz ; file2=fm/uphase_rad_filt.nii.gz ; out=chk/fmap_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out)
-files=""; files2=""
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- files=$files" "$i/$j/$file
- files2=$files2" "$i/$j/$file2
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}merged $files 2>/dev/null
-fslmerge -t ${out}filt $files2 2>/dev/null
-cmd="fslview ${out}filt ${out}merged"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-############################################
-# check averaged MNI-bolds & hpf'ed MNI-fmap
-############################################
-file=bold/SESSA_uw+y_st0_s0_hpfInf.feat/reg_standard/filtered_func_data_mni2.nii.gz ; file2=fm/pseudoSWI_MNI.nii.gz ; out=chk/meanMNIbold_
-subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-sess="a b c d e"
-
-mkdir -p $(dirname $out)
-files=""; files2=""
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
- echo "$(zeropad $c 3) $i $j : found."
- cmd="fslmaths $i/$j/$file -Tmean ${out}tmp_$(zeropad $c 4)"
- echo " $cmd" ; $cmd
- files=$files" "${out}tmp_$(zeropad $c 4)
- files2=$files2" "$i/$j/$file2
- c=$[$c+1]
- else
- echo " $i $j : not found."
- fi
- done
-done ; c=0
-fslmerge -t ${out}merged $files 2>/dev/null
-fslmerge -t ${out}filt $files2 2>/dev/null
-imrm ${out}tmp_????
-cmd="fslview ${out}filt ${out}merged"
-echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-###########################################
-# check FREESURFER's Talairach registration
-###########################################
-subj=$(find ./subj/FS_subj -mindepth 1 -maxdepth 1 -type d | grep -v '.long.' | sort)
-SUBJECTS_DIR=./subj/FS_subj
-
-paths="" ; c=1
-for i in $subj ; do
- if [ -f ${i}/mri/transforms/talairach.auto.xfm ] ; then
- echo "$(zeropad $c 3) $i : found."
- paths=$paths" "${i}
- c=$[$c+1]
- else
- echo " $i : not found."
- fi
-
- done
-
-for i in $paths ; do
- tkregister2 --s $(basename $i) --fstal --surf
-done
-
-
-###############################################
-# check FREESURFER's surfaces and segmentations
-###############################################
-d=./subj/FS_subj
-subj="$d/01a $d/02"
-#subj=$(find $d -mindepth 1 -maxdepth 1 -type d | grep -v '.long.' | sort)
-SUBJECTS_DIR=$d
-
-paths="" ; c=1
-for i in $subj ; do
- if [ -f ${i}/mri/aparc+aseg.mgz ] ; then
- echo "$(zeropad $c 3) $i : found."
- paths=$paths" "${i}
- c=$[$c+1]
- else
- echo " $i : not found."
- fi
-
- done
-
-for i in $paths ; do
- tkmedit $(basename $i) brainmask.mgz -aux T1.mgz -surfs -aseg &
- tksurfer $(basename $i) lh inflated
- read -p "press key..."
-done
-
-
-#################################
-# check longt. VBM using freeview
-#################################
-subj=01
-base=./subj/FS_subj/${subj}
-a=./subj/FS_subj/${subj}a.long.${subj}
-b=./subj/FS_subj/${subj}c.long.${subj}
-c=./subj/FS_subj/${subj}e.long.${subj}
-
-freeview -v $base/mri/norm.mgz \
- -f $a/surf/lh.pial:edgecolor=red \
- $a/surf/lh.white:edgecolor=blue \
- $b/surf/lh.pial:edgecolor=255,128,128 \
- $b/surf/lh.white:edgecolor=lightblue \
- $c/surf/lh.pial:edgecolor=255,128,0 \
- $c/surf/lh.white:edgecolor=white \
-
-
-
-
-############
-# check TBSS
-############
-statdirs=$(find ./grp/tbss/ -name "stats_*" -type d | sort)
-out=chk/tbss.cmd
-
-rm -f $out
-for i in $statdirs ; do
- if [ -f $i/all_FA_skeletonised.nii.gz -a -f $i/all_FA.nii.gz ] ; then
- echo "$i : found."
- echo "fslview $i/all_FA.nii.gz -l \"Grayscale\" -t 1 $i/mean_FA_skeleton_mask.nii.gz -l \"Blue\" -t 1 $i/all_FA_skeletonised.nii.gz -l \"Red-Yellow\" -t 1" >> $out
- if [ -f $i/all_F1_x_skeletonised.nii.gz -a -f $i/all_F2_x_skeletonised.nii.gz -a -f $i/all_FA.nii.gz ] ; then
- echo "fslview $i/all_FA.nii.gz -l \"Grayscale\" -t 1 $i/mean_FA_skeleton_mask.nii.gz -l \"Blue\" -t 1 $i/all_F2_x_skeletonised.nii.gz -l \"Red-Yellow\" -t 1 $i/all_F1_x_skeletonised.nii.gz -l \"Red-Yellow\" -t 1" >> $out
- fi
- else
- echo "$i : not found."
- fi
-done
-
-cat $out
-
-
-
-
-
-
-
View
95 rsc/scripts/collectvols.sh
@@ -1,95 +0,0 @@
-#!/bin/bash
-# collect and merge volumes from the directory tree
-
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-wdir=`pwd`/.collectvols$$ ; mkdir -p $wdir
-trap "echo -e \"\ncleanup: erasing '$wdir'\" ; rm -f $wdir/* ; rmdir $wdir ; exit" EXIT
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` [ -m|-e [idx] ] <4doutput> <\"subdir/filename\"> <subjectsdir> <\"01 02 ...\"|-> <\"sessa sessb ...\">"
- echo ""
- exit 1
-}
-
-[ "$5" = "" ] && Usage
-domean=0 ; doextr=0
-if [ $1 = "-m" ] ; then
- domean=1
- shift
-elif [ $1 = "-e" ] ; then
- doextr=1
- idx=$2
- shift 2
-fi
-out=`remove_ext "$1"`
-file="$2"
-subjdir="$3"
-if [ "$4" = "-" ] ; then
- subj=$(find $subjdir -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
-else
- subj="$4"
- _subj=""
- for i in $subj ; do
- _subj=$_subj" "$subjdir/$i
- done
- subj="$_subj"
-fi
-sess="$5"
-
-
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file ] ; then
- echo "$(zeropad $c 3) found: $i/$j/$file"
- c=$[$c+1]
- else
- echo " not found: $i/$j/$file"
- fi
- done
-done ; c=0
-
-set +e
-read -p "Press key..."
-set -e
-
-mkdir -p $(dirname $out)
-files=""
-rm -f $wdir/*
-rm -f ${out}.list
-c=1 ; for i in $subj ; do
- for j in $sess ; do
- if [ -f $i/$j/$file ] ; then
- if [ $doextr -eq 1 ] ; then
- echo "$(zeropad $c 3) found: $i/$j/$file - extracting at pos. $idx..." | tee -a ${out}.list
- _file=$(zeropad $c 3)_extracted_${idx}
- fslroi $i/$j/$file $wdir/$_file $idx 1
- files=$files" "$wdir/$_file
- elif [ $domean -eq 1 ] ; then
- echo "$(zeropad $c 3) found: $i/$j/$file - creating mean..." | tee -a ${out}.list
- _file=$(zeropad $c 3)_mean
- fslmaths $i/$j/$file -Tmean $wdir/$_file
- files=$files" "$wdir/$_file
- else
- echo "$(zeropad $c 3) found: $i/$j/$file" >> ${out}.list
- files=$files" "$i/$j/$file
- fi
- c=$[$c+1]
- else
- echo " not found: $i/$j/$file" >> ${out}.list
- fi
- done
-done ; c=0
-
-echo "merging..."
-cmd="fslmerge -t ${out} $files"
-echo $cmd ; $cmd
-
-#cmd="fslview ${out}"
-#echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
-
-
-echo "`basename $0`: done."
View
52 rsc/scripts/convert_regs.sh
@@ -1,52 +0,0 @@
-#!/bin/bash
-# converts between affine matrix formats
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <mov> <targ> <inmat: .reg|.lta|.txt|.mat|.xfm> <outmat: .reg|.lta||.mat|.xfm>"
- echo "Note: vox2vox ascii (.txt): targ->mov, not mov->targ"
- echo ""
- exit 1
-}
-
-[ "$4" = "" ] && Usage
-
-mov="$1"
-targ="$2"
-inmat="$3"
-outmat="$4"
-
-out_ext=${outmat##*.}
-in_ext=${inmat##*.}
-
-if [ "$in_ext" = "$out_ext" ] ; then echo "`basename $0` : ERROR : file extension of input and output matrices are the same (*.$out_ext)" ; exit 1 ; fi
-
-if [ "$in_ext" = "dat" ] ; then regin="--reg $inmat" ; fi
-if [ "$in_ext" = "xfm" ] ; then regin="--xfm $inmat" ; fi
-if [ "$in_ext" = "mat" ] ; then regin="--fsl $inmat" ; fi
-if [ "$in_ext" = "lta" ] ; then regin="--lta $inmat" ; fi
-if [ "$in_ext" = "txt" ] ; then regin="--vox2vox $inmat" ; fi
-
-
-if [ "$out_ext" = "dat" ] ; then regout="--reg $outmat" ; fi
-if [ "$out_ext" = "xfm" ] ; then regout="--xfmout $outmat" ; fi
-if [ "$out_ext" = "mat" ] ; then regout="--fslregout $outmat" ; fi
-if [ "$out_ext" = "lta" ] ; then regout="--ltaout $outmat" ; fi
-
-if [ "$in_ext" != "dat" -a "$out_ext" != "dat" ] ; then delme="--reg $$deleteme.reg.dat" ; else delme="" ; fi
-
-cmd="tkregister2 --noedit --mov $mov --targ $targ $regin $regout $delme"
-echo $cmd ; $cmd
-
-
-rm -f $$deleteme.reg.dat
-
-
-echo "`basename $0` : subj $subj , sess $sess : done."
-
-
-
View
110 rsc/scripts/createALFF.sh
@@ -1,110 +0,0 @@
-#!/bin/bash
-
-## This is an adaptation of the 1000 Connectome script written by Xi-Nian Zuo, Maarten Mennes & Michael Milham.
-## for more information see www.nitrc.org/projects/fcon_1000
-
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <ALFF-out> <bold4D-in> <mask> <TR(s)> <freq-band:LP,HP>"
- echo "Example: `basename $0` outdir/ALFF.nii.gz bold/resting.nii.gz bold/mask.nii.gz 3.33 0.01,0.1"
- echo "Note: Input should be motion-corrected (perhaps also unwarped + slicetiming corrected) with drifts removed and Grand-Mean scaled."
- exit 1
-}
-
-[ "$5" = "" ] && Usage
-
-out=$(remove_ext "$1")
-input=$(remove_ext "$2")
-mask=$(remove_ext "$3")
-TR=$4
-LP=$(echo $5 | cut -d "," -f 1)
-HP=$(echo $5 | cut -d "," -f 2)
-
-# checks
-if [ ! -f ${input}.nii.gz ] ; then
- echo "`basename $0`: ERROR: file '$input' not found... exiting" ; exit 1
-fi
-if [ ! -f ${mask}.nii.gz ] ; then
- echo "`basename $0`: ERROR: file '$mask' not found... exiting" ; exit 1
-fi
-
-# mkdir
-wdir=$(dirname $out) ; mkdir -p $wdir
-
-## 0. Bet
-#fslmaths $input -Tmean $wdir/prealff_mean ; bet2 $wdir/prealff_mean $wdir/prealff_mean_bet -f 0.3 ; fslmaths $wdir/prealff_mean_bet -bin ${out}_mask
-
-## CALCULATING ALFF AND fALFF
-## 1. primary calculations
-n_vols=`fslinfo $input| grep ^dim4 | awk '{print $2}'`
-echo "`basename $0`: there are ${n_vols} vols"
-## decide whether n_vols is odd or even
-MOD=$(echo "${n_vols} % 2" | bc ) ; echo "`basename $0`: Odd (1) or Even (0): ${MOD}"
-## if odd, remove the first volume
-N=$(echo "scale=0; ${n_vols}/2"|bc) ; N=$(echo "2*${N}"|bc)
-if [ ${MOD} -eq 1 ]
-then
- echo "`basename $0`: Deleting the first volume from bold data due to a bug in fslpspec"
- fslroi $input $wdir/prealff_func_data.nii.gz 1 ${N}
-fi
-if [ ${MOD} -eq 0 ]
-then
- cp ${input}.nii.gz $wdir/prealff_func_data.nii.gz
-fi
-
-## 1. Despike
-
-## 2. Computing power spectrum
-echo "`basename $0`: Computing power spectrum"
-fslpspec $wdir/prealff_func_data.nii.gz $wdir/prealff_func_data_ps.nii.gz
-## copy power spectrum to keep it for later (i.e. it does not get deleted in the clean up at the end of the script)
-cp $wdir/prealff_func_data_ps.nii.gz $wdir/power_spectrum_distribution.nii.gz
-echo "`basename $0`: Computing square root of power spectrum"
-fslmaths $wdir/prealff_func_data_ps.nii.gz -sqrt $wdir/prealff_func_data_ps_sqrt.nii.gz
-
-## 3. Calculate ALFF
-echo "`basename $0`: Extracting power spectrum at the slow frequency band"
-## calculate the low frequency point
-n_lp=$(echo "scale=10; ${LP}*${N}*${TR}"|bc)
-n1=$(echo "${n_lp}-1"|bc|xargs printf "%1.0f") ;
-echo "`basename $0`: ${LP} Hz is around the ${n1} frequency point."
-## calculate the high frequency point
-n_hp=$(echo "scale=10; ${HP}*${N}*${TR}"|bc)
-n2=$(echo "${n_hp}-${n_lp}+1"|bc|xargs printf "%1.0f") ;
-echo "`basename $0`: There are about ${n2} frequency points before ${HP} Hz."
-## cut the low frequency data from the the whole frequency band
-fslroi $wdir/prealff_func_data_ps_sqrt.nii.gz $wdir/prealff_func_ps_slow.nii.gz ${n1} ${n2}
-## calculate ALFF as the sum of the amplitudes in the low frequency band
-echo "`basename $0`: Computing amplitude of the low frequency fluctuations (ALFF)"
-fslmaths $wdir/prealff_func_ps_slow.nii.gz -Tmean -mul ${n2} $wdir/prealff_func_ps_alff4slow.nii.gz
-imcp $wdir/prealff_func_ps_alff4slow.nii.gz ${out}_ALFF
-
-## 4. Calculate fALFF
-echo "`basename $0`: Computing amplitude of total frequency"
-fslmaths $wdir/prealff_func_data_ps_sqrt.nii.gz -Tmean -mul ${N} -div 2 $wdir/prealff_func_ps_sum.nii.gz
-## calculate fALFF as ALFF/amplitude of total frequency
-echo "`basename $0`: Computing fALFF"
-fslmaths $wdir/prealff_func_ps_alff4slow.nii.gz -div $wdir/prealff_func_ps_sum.nii.gz ${out}_fALFF.nii.gz
-
-## 5. Z-normalisation across whole brain
-echo "`basename $0`: Normalizing ALFF/fALFF to Z-score across full brain"
-fslstats ${out}_ALFF -k ${mask}.nii.gz -m > ${out}_mean_ALFF.txt ; mean=$( cat ${out}_mean_ALFF.txt )
-fslstats ${out}_ALFF -k ${mask}.nii.gz -s > ${out}_std_ALFF.txt ; std=$( cat ${out}_std_ALFF.txt )
-echo " mean: $mean ; std: $std"
-fslmaths ${out}_ALFF.nii.gz -sub ${mean} -div ${std} -mas ${mask}.nii.gz ${out}_ALFF_Z.nii.gz
-fslstats ${out}_fALFF.nii.gz -k ${mask}.nii.gz -m > ${out}_mean_fALFF.txt ; mean=$( cat ${out}_mean_fALFF.txt )
-fslstats ${out}_fALFF.nii.gz -k ${mask}.nii.gz -s > ${out}_std_fALFF.txt ; std=$( cat ${out}_std_fALFF.txt )
-echo " mean: $mean ; std: $std"
-fslmaths ${out}_fALFF.nii.gz -sub ${mean} -div ${std} -mas ${mask}.nii.gz ${out}_fALFF_Z.nii.gz
-
-## 6. Register Z-transformed ALFF and fALFF maps to standard space
-
-## 7. Clean up
-echo "`basename $0`: Clean up temporary files"
-rm -f $wdir/prealff_*.nii.gz
-
-
View
54 rsc/scripts/cycler.sh
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-#cycler
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <'cmd'> <'A B C...'> <'a b c...'< <'1 2 3...'>"
- echo "example: `basename $0` 'ls @^/@^^' '01 02 03' 'a b c'"
- echo ""
- exit 1
-}
-
-[ "$2" = "" ] && Usage
-
-cmd="$1" ; shift
-
-nlev=$#
-if [ $nlev -gt 4 ] ; then echo "`basename $0` : Sorry, `basename $0` does not support more than 4 levels." ; exit 1 ; fi
-
-a1="$1"
-a2="$2"
-a3="$3"
-a4="$4"
-
-if [ "$a2" = "" ] ; then a2="1" ; fi
-if [ "$a3" = "" ] ; then a3="1" ; fi
-if [ "$a4" = "" ] ; then a4="1" ; fi
-
-
-cmd=`echo $cmd | sed 's|@^^^^|\${LLL}|g'`
-cmd=`echo $cmd | sed 's|@^^^|\${KKK}|g'`
-cmd=`echo $cmd | sed 's|@^^|\${JJJ}|g'`
-cmd=`echo $cmd | sed 's|@^|\${III}|g'`
-
-export III JJJ KKK LLL
-
-for III in $a1 ; do
-for JJJ in $a2 ; do
-for KKK in $a3 ; do
-for LLL in $a4 ; do
-
- sh -c "echo $cmd"
-
-done
-done
-done
-done
-
-unset III JJJ KKK LLL
-
View
25 rsc/scripts/delbrokenlinks.sh
@@ -1,25 +0,0 @@
-#!/bin/bash
-# Recursively removes broken symlinks.
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo "Recursively removes broken symlinks."
- echo "Usage: `basename $0` <directory>"
- echo ""
- exit 1
-}
-
-
-[ "$1" = "" ] && Usage
-
-echo "`basename $0`: removing all broken symlinks under '$1'..."
-
-if [ ! -d $1 ] ; then echo "`basename $0`: '$1' does not exist." ; exit 1 ; fi
-
-find $1 -type l ! -exec test -e {} \; -exec echo deleting {} \; -exec rm {} \;
-
-echo "`basename $0`: done."
-
View
160 rsc/scripts/denoise4D.sh
@@ -1,160 +0,0 @@
-#!/bin/bash
-# removes nuisance confounds from 4D functional using masks
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` [-m] <input4D> <"mask1 mask2 ..." |none> <movpar|none> <movpar_calcs 0:none|1:orig|2:^2|3:abs|4:diff+|5:diff-> <output> <subj_idx> <sess_idx>"
- echo " Options: -m just create confound matrix, don't denoise"
- echo ""
- exit 1
-}
-
-function row2col()
-{
- local dat=`cat $1`
- local i=""
- for i in $dat ; do echo $i ; done
-}
-
-if [ x$(which octave) = "x" ] ; then echo "`basename $0` : ERROR : OCTAVE does not seem to be installed on your system ! Exiting..." ; exit 1 ; fi
-
-if [ "$1" = "-m" ] ; then
- denoise=0
- shift
-else
- denoise=1
-fi
-
-[ "$5" = "" ] && Usage
-input=$(remove_ext "$1")
-masks="$2"
-movpar="$3" ;
-movpar_calcs="$4"
-output=$(remove_ext "$5")
-subj="$6" # optional
-sess="$7" # optional
-
-outdir=`dirname $output`
-indir=`dirname $input`
-formula1="output_precision(8); c" # formula1="c-mean(c)" # for WM / CSF / WB signal
-formula2="output_precision(8); c" # formula2="c-mean(c)" # for movpars
-
-# extract nuisance regressors from masks
-ts_list=""
-ts_list_proc=""
-if [ "$masks" != "none" ] ; then
- for mask in $masks ; do
- mask=$indir/$mask
- ts=${output}_$(basename $(remove_ext $mask))_meants
- echo "`basename $0` : subj $subj , sess $sess : extracting timecourse for '$mask' -> '$ts'..."
-
- if [ $(imtest $mask) -eq 0 ] ; then echo "`basename $0` : subj $subj , sess $sess : ERROR: '$mask' not found - exiting..." ; exit 1 ; fi
-
- fslmeants -i $input -m $mask -o $ts
-
- # process using octave
- rm -f ${ts}_proc
- vals=$(cat $ts)
- c=$(octave -q --eval "c=[$vals] ; $formula1")
- echo $c | cut -d "=" -f 2- | row2col > ${ts}_proc
-
- ts_list=$ts_list" "${ts}
- ts_list_proc=$ts_list_proc" "${ts}_proc
- done
-fi
-
-# create motion related regressors
-if [ "$movpar_calcs" != 0 ] ; then
- if [ ! -f $movpar ] ; then
- echo "`basename $0` : subj $subj , sess $sess : motion parameter file '$movpar' not found - exiting..."
- exit 1
- else
- cat $movpar > ${output}_movpar
-
- # process using octave
- movpar_proc=${output}_movpar_proc
- rm -f ${movpar_proc}_?
-
- movpar_calc_list=""
- for calc in $movpar_calcs ; do
- if [ $calc -eq 0 ] ; then continue ; fi
- if [ $calc -eq 1 ] ; then formula2="output_precision(8); c" ; fi
- if [ $calc -eq 2 ] ; then formula2="output_precision(8); c.*c" ; fi
- if [ $calc -eq 3 ] ; then formula2="output_precision(8); abs(c)" ; fi
- if [ $calc -eq 4 ] ; then formula2="output_precision(8); c=diff(c); c=[0 ; c]" ; fi
- if [ $calc -eq 5 ] ; then formula2="output_precision(8); c=diff(c); c=[c ; 0]" ; fi
-
- echo "`basename $0` : subj $subj , sess $sess : applied OCTAVE formula for motion parameter regressors: '$formula2'"
-
- vals=$(cat $movpar | awk '{print $1}')
- c=$(octave -q --eval "c=[$vals] ; $formula2") ; echo $c | cut -d "=" -f 2- | row2col > ${movpar_proc}_1
- vals=$(cat $movpar | awk '{print $2}')
- c=$(octave -q --eval "c=[$vals] ; $formula2") ; echo $c | cut -d "=" -f 2- | row2col > ${movpar_proc}_2
- vals=$(cat $movpar | awk '{print $3}')
- c=$(octave -q --eval "c=[$vals] ; $formula2") ; echo $c | cut -d "=" -f 2- | row2col > ${movpar_proc}_3
- vals=$(cat $movpar | awk '{print $4}')
- c=$(octave -q --eval "c=[$vals] ; $formula2") ; echo $c | cut -d "=" -f 2- | row2col > ${movpar_proc}_4
- vals=$(cat $movpar | awk '{print $5}')
- c=$(octave -q --eval "c=[$vals] ; $formula2") ; echo $c | cut -d "=" -f 2- | row2col > ${movpar_proc}_5
- vals=$(cat $movpar | awk '{print $6}')
- c=$(octave -q --eval "c=[$vals] ; $formula2") ; echo $c | cut -d "=" -f 2- | row2col > ${movpar_proc}_6
-
- paste -d " " ${movpar_proc}_1 ${movpar_proc}_2 ${movpar_proc}_3 ${movpar_proc}_4 ${movpar_proc}_5 ${movpar_proc}_6 > ${movpar_proc}_calc${calc}
- movpar_calc_list=$movpar_calc_list" "${movpar_proc}_calc${calc}
- rm -f ${movpar_proc}_?
- done
- paste -d " " $movpar_calc_list > ${movpar_proc}
- rm -f ${movpar_proc}_calc*
- fi
-else
- movpar=""
- movpar_proc=""
-fi
-
-# create matrix - mean regrssor
-ones=$outdir/ones
-#for i in $ts_list ; do n=$(cat $i | wc -l) ; break ; done
-n=`fslinfo $input| grep ^dim4 | awk '{print $2}'`
-c=$(octave -q --eval "ones($n,1)") ; echo $c | cut -d "=" -f 2- | row2col > $ones
-
-# create matrix - confounds
-confounds="${output}_nuisance_meants.mat"
-echo "`basename $0` : subj $subj , sess $sess : creating nuisance matrix '$confounds' and '${confounds%.mat}_proc.mat'..."
-paste -d " " $ts_list_proc $movpar_proc $ones > ${confounds%.mat}_proc.mat
-paste -d " " $ts_list $movpar $ones > $confounds
-
-# denoise
-if [ $denoise -eq 1 ] ; then
- echo "`basename $0` : subj $subj , sess $sess : denoising..."
- #cmd="fsl_glm -i $input -d ${confounds%.mat}_proc.mat --demean --out_res=${output}"
- #echo $cmd ; $cmd
- #fslmaths $input -Tmean ${input}_mean
- #fslmaths ${output} -add ${input}_mean ${output} # otw. speckled results...
-
- if [ x$movpar = "x" ] ; then
- n_movpar=0
- else
- n_movpar=$(awk '{print NF}' $movpar_proc | sort -nu | head -n 1)
- fi
- if [ "$masks" = "none" ] ; then
- n_masks=0
- else
- n_masks=$(echo $masks | wc -w)
- fi
- n_total=$(echo "scale=0; $n_movpar + $n_masks + 1" | bc) # add 1 for the mean regressor (!)
- comps=$(echo `seq 1 $n_total` | sed "s| |","|g")
-
- cmd="fsl_regfilt -i $input -o ${output} -d ${confounds%.mat}_proc.mat -f $comps"
- echo $cmd | tee ${output}.cmd ; $cmd
-fi
-
-# cleanup
-rm -f $ones $ts_list_proc $movpar_proc
-imrm ${input}_mean
-
-echo "`basename $0` : subj $subj , sess $sess : done."
-
View
153 rsc/scripts/dualreg.sh
@@ -1,153 +0,0 @@
-#!/bin/sh
-# adapted by HKL: address sections (mask / dualreg / randomise) separately & insert exchangeability block file into randomise call & voxel-wise stats & name randomise results according
-# to the name of the used design & delete ${LOGDIR}/dr[ABCD] cmd-file to avoid accumulation on re-run. randomise_parallel or randomise are used on demand, randomise_parallel however
-# only works if /bin/sh points to /bin/bash ! (!)
-
-Usage() {
- cat <<EOF
-
-dual_regression v0.5 (beta)
-
-***NOTE*** ORDER OF COMMAND-LINE ARGUMENTS IS DIFFERENT FROM PREVIOUS VERSION
-
-Usage: dual_regression <group_IC_maps> <des_norm> <design.mat> <design.con> <design.grp> <n_perm> <output_directory> <DO_MASK> <DO_DUALREG> <DO_RANDOMISE> <input1> <input2> <input3> .........
-e.g. dual_regression groupICA.gica/groupmelodic.ica/melodic_IC 1 design.mat design.con 500 grot \`cat groupICA.gica/.filelist\`
-
-<group_IC_maps_4D> 4D image containing spatial IC maps (melodic_IC) from the whole-group ICA analysis
-<des_norm> 0 or 1 (1 is recommended). Whether to variance-normalise the timecourses used as the stage-2 regressors
-<design.mat> Design matrix for final cross-subject modelling with randomise
-<design.con> Design contrasts for final cross-subject modelling with randomise
-<n_perm> Number of permutations for randomise; set to 1 for just raw tstat output, set to 0 to not run randomise at all.
-<output_directory> This directory will be created to hold all output and logfiles
-<input1> <input2> ... List all subjects' preprocessed, standard-space 4D datasets
-
-<design.mat> <design.con> can be replaced with just
--1 for group-mean (one-group t-test) modelling.
-If you need to add other randomise option then just edit the line after "EDIT HERE" below
-
-EOF
- exit 1
-}
-
-############################################################################
-
-[ "$6" = "" ] && Usage
-
-ORIG_COMMAND=$*
-
-ICA_MAPS=`${FSLDIR}/bin/remove_ext $1` ; shift
-
-DES_NORM=--des_norm
-if [ $1 = 0 ] ; then
- DES_NORM=""
-fi ; shift
-
-if [ $1 = "-1" ] ; then
- DESIGN="-1"
- shift
-else
- dm=$1
- dc=$2
- dgrp=$3
- DESIGN="-d $1 -t $2 -e $3"
- RANDCMD="$4"
- shift 4
-fi
-
-NPERM=$1 ; shift
-
-OUTPUT=`${FSLDIR}/bin/remove_ext $1` ; shift
-
-DO_MASK=$1 ; shift
-DO_DUALREG=$1 ; shift
-DO_RANDOMISE=$1 ; shift
-
-while [ _$1 != _ ] ; do
- INPUTS="$INPUTS `${FSLDIR}/bin/remove_ext $1`"
- shift
-done
-
-############################################################################
-
-mkdir -p $OUTPUT
-LOGDIR=${OUTPUT}/scripts+logs
-mkdir -p $LOGDIR
-echo $ORIG_COMMAND > $LOGDIR/command
-#if [ "$DESIGN" != -1 ] ; then
- #/bin/cp $dm $OUTPUT/design.mat
- #/bin/cp $dc $OUTPUT/design.con
-#fi
-
-if [ $DO_MASK -eq 1 ] ; then
-
-rm -f ${LOGDIR}/drA # delete cmd-file to avoid accumulation on re-run (HKL)
-rm -f ${LOGDIR}/drB # delete cmd-file to avoid accumulation on re-run (HKL)
-
-echo "creating common mask"
-j=0
-for i in $INPUTS ; do
- echo "$FSLDIR/bin/fslmaths $i -Tstd -bin ${OUTPUT}/mask_`${FSLDIR}/bin/zeropad $j 5` -odt char" >> ${LOGDIR}/drA
- j=`echo "$j 1 + p" | dc -`
-done
-ID_drA=`$FSLDIR/bin/fsl_sub -T 10 -N drA -l $LOGDIR -t ${LOGDIR}/drA`
-cat <<EOF > ${LOGDIR}/drB
-#!/bin/sh
-\$FSLDIR/bin/fslmerge -t ${OUTPUT}/maskALL \`\$FSLDIR/bin/imglob ${OUTPUT}/mask_*\`
-\$FSLDIR/bin/fslmaths $OUTPUT/maskALL -Tmin $OUTPUT/mask
-\$FSLDIR/bin/imrm $OUTPUT/mask_*
-EOF
-chmod a+x ${LOGDIR}/drB
-ID_drB=`$FSLDIR/bin/fsl_sub -j $ID_drA -T 5 -N drB -l $LOGDIR ${LOGDIR}/drB`
-fi
-
-if [ $DO_DUALREG -eq 1 ] ; then
-
-rm -f ${LOGDIR}/drC # delete cmd-file to avoid accumulation on re-run (HKL)
-
-echo "doing the dual regressions"
-j=0
-for i in $INPUTS ; do
- s=subject`${FSLDIR}/bin/zeropad $j 5`
- echo "$FSLDIR/bin/fsl_glm -i $i -d $ICA_MAPS -o $OUTPUT/dr_stage1_${s}.txt --demean -m $OUTPUT/mask ; \
- $FSLDIR/bin/fsl_glm -i $i -d $OUTPUT/dr_stage1_${s}.txt -o $OUTPUT/dr_stage2_$s --out_z=$OUTPUT/dr_stage2_${s}_Z --demean -m $OUTPUT/mask $DES_NORM ; \
- $FSLDIR/bin/fslsplit $OUTPUT/dr_stage2_$s $OUTPUT/dr_stage2_${s}_ic" >> ${LOGDIR}/drC
- j=`echo "$j 1 + p" | dc -`
-done
-ID_drC=`$FSLDIR/bin/fsl_sub -T 30 -N drC -l $LOGDIR -t ${LOGDIR}/drC` # HKL removed switch "-j $ID_drB"
-fi
-
-if [ $DO_RANDOMISE -eq 1 ] ; then
-
-rm -f ${LOGDIR}/drD # delete cmd-file to avoid accumulation on re-run (HKL)
-
-if [ "$DESIGN" != -1 ] ; then
- dname=$(echo `basename $(dirname $dm)`) # HKL: note that the design's name = the folder's name where the *.con, *.mat, etc. files reside.
- mkdir -p $OUTPUT/stats/$dname
- /bin/cp $dm $OUTPUT/stats/$dname/
- /bin/cp $dc $OUTPUT/stats/$dname/
- /bin/cp $dgrp $OUTPUT/stats/$dname/
-fi
-
-echo "sorting maps and running randomise on design '$dname'"
-j=0
-Nics=`$FSLDIR/bin/fslnvols $ICA_MAPS`
-while [ $j -lt $Nics ] ; do
- jj=`$FSLDIR/bin/zeropad $j 4`
-
- RAND=""
- if [ $NPERM -eq 1 ] ; then
- RAND="$FSLDIR/bin/${RANDCMD} -i $OUTPUT/dr_stage2_ic$jj -o $OUTPUT/stats/$dname/dr_stage3_ic$jj -m $OUTPUT/mask $DESIGN -n 1 -V -R -x" # HKL added -x switch
- fi
- if [ $NPERM -gt 1 ] ; then
- # EDIT HERE
- RAND="$FSLDIR/bin/${RANDCMD} -i $OUTPUT/dr_stage2_ic$jj -o $OUTPUT/stats/$dname/dr_stage3_${dname}_ic$jj -m $OUTPUT/mask $DESIGN -n $NPERM -T -V -x" # randomise_parallel only works if /bin/sh points to /bin/bash ! (!) ; HKL added -x switch
- echo $RAND > $OUTPUT/stats/$dname/randomise.cmd # added by HKL
- fi
-
- echo "$FSLDIR/bin/fslmerge -t $OUTPUT/dr_stage2_ic$jj \`\$FSLDIR/bin/imglob $OUTPUT/dr_stage2_subject*_ic${jj}.*\` ; \
- $FSLDIR/bin/imrm \`\$FSLDIR/bin/imglob $OUTPUT/dr_stage2_subject*_ic${jj}.*\` ; $RAND" >> ${LOGDIR}/drD
- j=`echo "$j 1 + p" | dc -`
-done
-ID_drD=`$FSLDIR/bin/fsl_sub -T 60 -N drD -l $LOGDIR -t ${LOGDIR}/drD` # HKL removed switch "-j $ID_drC"
-fi
-
View
47 rsc/scripts/dummy_bvalbvec.sh
@@ -1,47 +0,0 @@
-#!/bin/bash
-# creating pseudo bval/bvec files
-
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <4Dinput> <n_b0>"
- echo ""
- exit 1
-}
-
-[ "$1" = "" ] && Usage
-file=`remove_ext "$1"`
-if [ x"$2" = "x" ] ; then n_b0=4 ; else n_b0=$2 ; fi
-
-nvols=`fslinfo $file | grep ^dim4 | awk '{print $2}'`
-intb0=$(scale=0; echo "$nvols / $n_b0" | bc)
-
-vals=""
-vecs=""
-for i in `seq 1 $nvols` ; do
- if [ $i -eq 1 -a $n_b0 -gt 0 ] ; then
- vals=0
- vecs=0.5
- elif [ $i -le $n_b0 ] ; then
- vals=$vals" "0
- vecs=$vecs" "0.5
- else
- vals=$vals" "1000
- vecs=$vecs" "0.5
- fi
-done
-
-echo "`basename $0`: '${file}_bvals':"
-echo $vals | tee ${file}_bvals
-echo "`basename $0`: '${file}_bvecs':"
-echo $vecs
-echo $vecs
-echo $vecs
-echo $vecs > ${file}_bvecs
-echo $vecs >> ${file}_bvecs
-echo $vecs >> ${file}_bvecs
-
-echo "`basename $0`: done."
View
93 rsc/scripts/eddy_correct.sh
@@ -1,93 +0,0 @@
-#!/bin/sh
-
-trap 'echo "$0 : An ERROR has occured." ; exit 1' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: eddy_correct [-t|-n] <4dinput> <4doutput> <reference_no> <dof> <cost{mutualinfo(=default),corratio,normcorr,normmi,leastsq,labeldiff}> <interp{spline,trilinear(=default),nearestneighbour,sinc}>"
- echo "Options (mutually exclusive): -t : test mode, create ecclog with identities."
- echo " -n : no write-outs, just create ecclog file."
- exit 1
-}
-
-noec=0 ; nowrite=0
-if [ "$1" = "-t" ] ; then
- noec=1 ; echo "`basename $0` : test-mode." ; shift
-elif [ "$1" = "-n" ] ; then
- nowrite=1 ; echo "`basename $0` : no write-outs." ; shift
-fi
-
-[ "$3" = "" ] && Usage
-
-input=`${FSLDIR}/bin/remove_ext ${1}`
-output=`${FSLDIR}/bin/remove_ext ${2}`
-ref=${3}
-dof=${4}
-cost=${5}
-interp=${6}
-full_list=""
-
-if [ "$4" = "" ] ; then dof=12 ; fi
-if [ "$5" = "" ] ; then cost="mutualinfo" ; fi
-if [ "$6" = "" ] ; then interp="trilinear" ; fi
-
-if [ `${FSLDIR}/bin/imtest $input` -eq 0 ];then
-echo "Input does not exist or is not in a supported format"
- exit 1
-fi
-
-fslversion=$(cat $FSL_DIR/etc/fslversion | cut -d . -f 1)
-echo "FSL : v.${fslversion}"
-echo "dof : $dof"
-echo "cost : $cost"
-echo "interp : $interp"
-
-fslroi $input ${output}_ref $ref 1
-imrm ${output}_tmp????.*
-fslsplit $input ${output}_tmp
-full_list=`${FSLDIR}/bin/imglob ${output}_tmp????.*`
-
-rm -f ${output}.ecclog # to avoid accumulation on re-run
-
-for i in $full_list ; do
- echo processing $i
- echo processing $i >> ${output}.ecclog
- if [ $noec != 1 ] ; then
- if [ "$interp" = "spline" -a $fslversion -lt 5 ] ; then
- ${FSLDIR}/bin/flirt -in $i -ref ${output}_ref -nosearch -paddingsize 1 -dof $dof -cost $cost > ${output}.ecclog.tmp
- if [ $nowrite -eq 0 ] ; then
- cat ${output}.ecclog.tmp | sed -n '3,6'p > ${output}.ecclog.tmp.applywarp
- ${FSLDIR}/bin/applywarp --ref=${output}_ref --in=$i --out=$i --premat=${output}.ecclog.tmp.applywarp --interp=spline
- rm ${output}.ecclog.tmp.applywarp
- fi
- else
- if [ $nowrite -eq 0 ] ; then
- ${FSLDIR}/bin/flirt -in $i -ref ${output}_ref -out $i -nosearch -paddingsize 1 -dof $dof -cost $cost -interp $interp > ${output}.ecclog.tmp
- else
- ${FSLDIR}/bin/flirt -in $i -ref ${output}_ref -nosearch -paddingsize 1 -dof $dof -cost $cost > ${output}.ecclog.tmp
- fi
- fi
-
- if [ "$interp" = "spline" -a $nowrite -eq 0 ] ; then
- #${FSLDIR}/bin/fslmaths $i -abs $i
- ${FSLDIR}/bin/fslmaths $i -thr 0 $i
- fi
-
- else
- echo "" >> ${output}.ecclog.tmp
- echo "Final result:" >> ${output}.ecclog.tmp
- cat $FSL_DIR/etc/flirtsch/ident.mat >> ${output}.ecclog.tmp
- echo "" >> ${output}.ecclog.tmp
- fi
-
- cat ${output}.ecclog.tmp >> ${output}.ecclog ; rm ${output}.ecclog.tmp
-done
-
-if [ $nowrite -eq 0 ] ; then
- fslmerge -t $output $full_list
-fi
-
-/bin/rm ${output}_tmp????.* ${output}_ref*
-
View
47 rsc/scripts/eddy_correct_plot.sh
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-if [ $# -lt 1 ] ; then
- echo "Usage: `basename $0` <eddy current ecclog file>"
- exit 1;
-fi
-
-logfile=$1;
-subj=$2 # added by HKL
-basenm=`basename $logfile .ecclog`;
-
-nums=`grep -n 'Final' $logfile | sed 's/:.*//'`;
-
-touch grot_ts.txt
-touch grot.mat
-
-firsttime=yes;
-m=1;
-for n in $nums ; do
- echo "Timepoint $m"
- n1=`echo $n + 1 | bc` ;
- n2=`echo $n + 5 | bc` ;
- sed -n "$n1,${n2}p" $logfile > grot.mat ;
- if [ $firsttime = yes ] ; then firsttime=no; cp grot.mat grot.refmat ; cp grot.mat grot.oldmat ; fi
- absval=`$FSLDIR/bin/rmsdiff grot.mat grot.refmat $basenm`;
- relval=`$FSLDIR/bin/rmsdiff grot.mat grot.oldmat $basenm`;
- cp grot.mat grot.oldmat
- echo $absval $relval >> ec_disp.txt ;
- $FSLDIR/bin/avscale --allparams grot.mat $basenm | grep 'Rotation Angles' | sed 's/.* = //' >> ec_rot.txt ;
- $FSLDIR/bin/avscale --allparams grot.mat $basenm | grep 'Translations' | sed 's/.* = //' >> ec_trans.txt ;
- m=`echo $m + 1 | bc`;
-done
-
-echo "absolute" > grot_labels.txt
-echo "relative" >> grot_labels.txt
-
-$FSLDIR/bin/fsl_tsplot -i ec_disp.txt -t "Subj. $subj - Eddy Current estimated mean displacement (mm)" -l grot_labels.txt -o ec_disp.png
-
-echo "x" > grot_labels.txt
-echo "y" >> grot_labels.txt
-echo "z" >> grot_labels.txt
-
-$FSLDIR/bin/fsl_tsplot -i ec_rot.txt -t "Subj. $subj - Eddy Current estimated rotations (radians)" -l grot_labels.txt -o ec_rot.png
-$FSLDIR/bin/fsl_tsplot -i ec_trans.txt -t "Subj. $subj - Eddy Current estimated translations (mm)" -l grot_labels.txt -o ec_trans.png
-
-# clean up temp files
-/bin/rm grot_labels.txt grot.oldmat grot.refmat grot.mat grot_ts.txt
View
4 rsc/scripts/ersatzblade.launcher.sh
@@ -1,4 +0,0 @@
-#!/bin/bash
-#gksudo ifup eth0
-ssh -X heckelandreas@161.42.71.54
-
View
28 rsc/scripts/extract.sh
@@ -1,28 +0,0 @@
-#!/bin/bash
-# extract images from 4D volume
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <out-Prefix> <idx> <input file>"
- echo "Example: `basename $0` ./test/melodic 0,1,2,3 melodic_IC.nii.gz"
- echo ""
- exit 1
-}
-
-[ "$3" = "" ] && Usage
-
-pref="$1" ; mkdir -p $(dirname $pref)
-idxs="$(echo "$2" | sed 's|,| |g')"
-input=$(remove_ext "$3")
-#pref=$(basename $input)
-
-for idx in $idxs ; do
- #echo "`basename $0`: extracting volume at pos. $idx from '$input'..."
- cmd="fslroi $input ${pref}_$(zeropad $idx 4) $idx 1"
- echo $cmd ; $cmd
-done
-
-echo "`basename $0`: done."
View
62 rsc/scripts/extractConfoundsFromNativeFuncs.sh
@@ -1,62 +0,0 @@
-#! /bin/bash
-
-set -e
-
-if [ $# -lt 4 ] ; then echo "Usage: `basename $0` <in> <out> <ref_pos> <struc>" ; exit 1 ; fi
-
-flirt_in=`remove_ext $1`
-flirt_out=`remove_ext $2`
-ref_pos=`remove_ext $3`
-struc=`remove_ext $4`
-fldr=$(dirname $flirt_out)
-al_exf=$fldr/al_example_func
-exf=$fldr/example_func
-
-
-echo "extracting example_func from '$flirt_in' at position ${ref_pos}..."
-fslroi $flirt_in $exf $ref_pos 1
-
-echo "flirting example_func to '$struc'"
-#flirt -in $exf -ref $struc -dof 12 -cost corratio -omat $fldr/BOLD2T1.mat -out $al_exf
-flirt -in $exf -ref $struc -dof 12 -cost mutualinfo -omat $fldr/BOLD2T1.mat -out $al_exf # mutualinfo is much better than corratio!
-
-echo "flirting 4D-BOLD to structural...."
-rm -f ${flirt_out}.flirtlog ${flirt_out}_tmp_????.*
-fslsplit $flirt_in ${flirt_out}_tmp_
-full_list=`imglob ${flirt_out}_tmp_????.*`
-for i in $full_list ; do
- echo processing $i
- #flirt -in $i -ref $al_exf -init $fldr/BOLD2T1.mat -applyxfm -o $(echo $i | sed "s|"_tmp"|""|g")
- rm ${i}.nii.gz
-done
-#fslmerge -t $flirt_out $full_list
-
-# run fast, if not already done so...
-if [ ! -e ${struc}_pve_2.nii.gz ] ; then
- echo "fasting '$struc'..."
- #fast -t 1 -n 3 $struc
-fi
-
-echo "creating masks..."
-echo " WholeBrain..."
-min=`fslstats $al_exf -P 15`
-fslmaths $al_exf -thr $min -bin $fldr/WB_mask
-echo " CSF..."
-fslmaths ${struc}_pve_0 -thr 1 -bin -ero -mas $fldr/WB_mask $fldr/CSF_mask
-echo " GreyMatter..."
-fslmaths ${struc}_pve_1 -thr 1 -bin -ero -mas $fldr/WB_mask $fldr/GM_mask
-echo " WhiteMatter..."
-fslmaths ${struc}_pve_2 -thr 1 -bin -ero -mas $fldr/WB_mask $fldr/WM_mask
-
-# extracting timecourses
-full_list=`imglob ${flirt_out}_????.*`
-for mask in CSF_mask WB_mask WM_mask ; do
- rm -f $fldr/tc_$mask
- echo "extracting timecourse for mask '$mask'..."
- for i in $full_list ; do
- fslmeants -i $i -m $fldr/$mask | sed '/^$/d' >> $fldr/tc_$mask
- done
-done
-
-# cleanup
-rm ${flirt_out}_????.*
View
33 rsc/scripts/extractmerge.sh
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-wdir=`pwd`/.extmerge$$
-mkdir -p $wdir
-trap "echo -e \"\ncleanup: erasing '$wdir'\" ; rm -f $wdir/* ; rmdir $wdir ; exit" EXIT
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <out4D> <idx> <\"input files\">"
- echo ""
- exit 1
-}
-
-[ "$3" = "" ] && Usage
-
-out="$1"
-idx="$2"
-inputs="$3"
-
-n=0
-for input in $inputs ; do
- echo "`basename $0`: extracting volume at pos. $idx from '$input'..."
- fslroi $input $wdir/_tmp_$(zeropad $n 4) $idx 1
- n=$(echo "$n + 1" | bc)
-done
-echo "`basename $0`: merging..."
-fslmerge -t ${out} $(imglob $wdir/_tmp_????)
-
-echo "`basename $0`: done."
View
75 rsc/scripts/extractmerge_parallel.sh
@@ -1,75 +0,0 @@
-#!/bin/bash
-
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-wdir=`pwd`/.extmerge$$
-mkdir -p $wdir
-trap "echo -e \"\ncleanup: erasing '$wdir'\" ; rm -f $wdir/* ; rmdir $wdir ; exit" EXIT
-
-function isStillRunning()
-{
- if [ "x$SGE_ROOT" = "x" ] ; then echo "0"; return; fi # is cluster environment present ?
-
- # does qstat work ?
- qstat &>/dev/null
- if [ $? != 0 ] ; then
- echo "ERROR : qstat failed. Is Network available ?" >&2
- echo "1"
- return
- fi
-
- local ID=$1
- local user=`whoami | cut -c 1-10`
- local stillrunnning=`qstat | grep $user | awk '{print $1}' | grep $ID | wc -l`
- echo $stillrunnning
-}
-
-function waitIfBusyIDs()
-{
- local IDfile=$1
- local ID=""
- echo -n "waiting..."
- for ID in $(cat $IDfile) ; do
- if [ `isStillRunning $ID` -gt 0 ] ; then
- while [ `isStillRunning $ID` -gt 0 ] ; do echo -n '.' ; sleep 5 ; done
- fi
- done
- echo "done."
- rm $IDfile
-}
-
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <out4D> <idx> <\"input files\"> <qsub logdir>"
- echo ""
- exit 1
-}
-
-[ "$4" = "" ] && Usage
-
-out="$1"
-idx="$2"
-inputs="$3"
-logdir="$4"
-
-n=0 ; i=1
-for input in $inputs ; do
- if [ ! -f $input ] ; then echo "`basename $0`: '$input' not found." ; continue ; fi
- echo "`basename $0`: $i - extracting volume at pos. $idx from '$input'..."
- fsl_sub -l $logdir fslroi $input $wdir/_tmp_$(zeropad $n 4) $idx 1 >> $wdir/jid.list
- n=$(echo "$n + 1" | bc)
- i=$[$i+1]
-done
-
-waitIfBusyIDs $wdir/jid.list
-
-echo "`basename $0`: merging..."
-
-fsl_sub -j $jid -l $logdir fslmerge -t ${out} $(imglob $wdir/_tmp_????) >> $wdir/jid.list
-
-waitIfBusyIDs $wdir/jid.list
-
-echo "`basename $0`: done."
View
63 rsc/scripts/feat_T1_2_MNI.sh
@@ -1,63 +0,0 @@
-
-#!/bin/bash
-# The FEAT way of T1->MNI registration.
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <T1-head> <T1-brain> <out> <init-affine|none> <[<affine-cost> <affine-init>] <MNI-template-head> <MNI-template-brain> <MNI-brainmask> <subj_idx> <sess_idx>"
- echo ""
- exit 1
-}
-
-[ "$4" = "" ] && Usage
-
-T1head=$(remove_ext $1)
-T1=$(remove_ext $2)
-out=$(remove_ext $3)
-aff=$4
-if [ $aff = "none" ] ; then
- if [ x$5 = "x" ] ; then
- costf="corratio"
- else
- costf="$5"
- shift
- fi
- if [ x$5 = "x" ] ; then
- initmat=""
- else
- initmat="-init $5"
- shift
- fi
-fi
-if [ x$5 = "x" ] ; then
- MNIhead=$FSLDIR/data/standard/MNI152_T1_2mm.nii.gz
- MNI=$FSLDIR/data/standard/MNI152_T1_2mm_brain.nii.gz
- MNI_mask=$FSLDIR/data/standard/MNI152_T1_2mm_brain_mask_dil.nii.gz
-else
- MNIhead=$(remove_ext $5)
- MNI=$(remove_ext $6)
- MNI_mask=$(remove_ext $7)
-fi
-subj="$8" # optional
-sess="$9" # optional
-
-outdir=$(dirname $out)
-
-
-if [ $aff = "none" ] ; then
- echo "`basename $0`: subj $subj , sess $sess : flirting brain '${T1}' -> '${MNI}'..."
- cmd="flirt -ref ${MNI} -in $T1 -out $outdir/$(basename $T1)2$(basename $MNI) $initmat -omat $outdir/$(basename $T1)2$(basename $MNI).mat -cost $costf -dof 12 -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -interp trilinear" #-usesqform"
- echo $cmd ; $cmd
- aff=${outdir}/$(basename $T1)2$(basename $MNI).mat
-fi
-
-echo "`basename $0`: subj $subj , sess $sess : fnirting head '${T1head}' -> '${MNIhead}'..."
-cmd="fnirt --in=${T1head} --aff=${aff} --cout=${out}_warp --iout=${out} --jout=${out}_jac --config=T1_2_MNI152_2mm --ref=${MNIhead} --refmask=${MNI_mask} --warpres=10,10,10"
-echo $cmd ; $cmd
-
-echo "`basename $0`: subj $subj , sess $sess : '${out}' created."
-echo "`basename $0`: subj $subj , sess $sess : done."
View
34 rsc/scripts/feat_hpf.sh
@@ -1,34 +0,0 @@
-
-#!/bin/bash
-# The FEAT way of high pass filtering.
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <4dinput> <output> <hpf> <TR> <subj_idx> <sess_idx>"
- echo ""
- exit 1
-}
-
-[ "$4" = "" ] && Usage
-data=`remove_ext "$1"`
-out=`remove_ext "$2"`
-hpf="$3"
-TR="$4"
-subj="$5" # optional
-sess="$6" # optional
-
-if [ $hpf = "inf" -o $hpf = "Inf" ] ; then
- fslmaths $data ${out}
-else
- hp_sigma_sec=$(echo "scale=10; $hpf / 2.0" | bc -l)
- hp_sigma_vol=$(echo "scale=10; $hp_sigma_sec / $TR" | bc -l)
- echo "`basename $0`: subj $subj , sess $sess : highpass temporal filtering of ${data} (Gaussian-weighted least-squares straight line fitting, with sigma=${hp_sigma_sec}s)..."
- cmd="fslmaths $data -bptf $hp_sigma_vol -1 ${out}" ; echo $cmd
- $cmd
-fi
-
-echo "`basename $0`: subj $subj , sess $sess : done."
View
58 rsc/scripts/feat_mask.sh
@@ -1,58 +0,0 @@
-
-#!/bin/bash
-# The FEAT way of making the mask.
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <4dinput> <output> <subj_idx> <sess_idx>"
- echo ""
- exit 1
-}
-
-[ "$2" = "" ] && Usage
-data=`remove_ext "$1"`
-out=`remove_ext "$2"`
-subj="$3" # optional
-sess="$4" # optional
-
-echo "`basename $0`: subj $subj , sess $sess : generating mask for $data -> $out..."
-
-echo "`basename $0`: subj $subj , sess $sess : generating `basename ${out}_mean_func`..."
-fslmaths ${data} -Tmean ${out}_mean_func
-
-echo "`basename $0`: subj $subj , sess $sess : betting `basename ${out}_mean_func` -> `basename ${out}`..."
-bet2 ${out}_mean_func ${out} -f 0.3 -n -m ; immv ${out}_mask ${out}
-
-echo "`basename $0`: subj $subj , sess $sess : masking `basename ${data}` -> `basename ${out}_bet`..."
-fslmaths ${data} -mas ${out} ${out}_bet
-range=`fslstats ${out}_bet -p 2 -p 98`
-int2=$(echo $range | cut -d " " -f 1)
-int98=$(echo $range | cut -d " " -f 2)
-brain_thres=10
-intensity_threshold=$(echo "scale=10; $int2 + ( ( $int98 - $int2 ) / 100.0 * $brain_thres )" | bc -l)
-echo "`basename $0`: subj $subj , sess $sess : -> p2: $int2"
-echo "`basename $0`: subj $subj , sess $sess : -> p98: $int98"
-echo "`basename $0`: subj $subj , sess $sess : -> intensity threshold: $intensity_threshold"
-
-echo "`basename $0`: subj $subj , sess $sess : thresholding `basename ${out}_bet` with $intensity_threshold -> `basename ${out}`..."
-fslmaths ${out}_bet -thr $intensity_threshold -Tmin -bin ${out} -odt char
-median_intensity=`fslstats ${data} -k ${out} -p 50`
-susan_int=$(echo "scale=10; ($median_intensity - $int2) * 0.75" | bc -l )
-echo "`basename $0`: subj $subj , sess $sess : -> median: $median_intensity"
-echo "`basename $0`: subj $subj , sess $sess : -> brightness threshold (susan_int): $susan_int"
-
-echo "`basename $0`: subj $subj , sess $sess : dilating `basename ${out}`..."
-fslmaths ${out} -dilF ${out}
-
-# cleanup
-echo "`basename $0`: subj $subj , sess $sess : cleanup..."
-imrm ${out}_bet ${out}_mean_func
-
-# save stats
-echo "$int2 $int98 $intensity_threshold $median_intensity $susan_int" > ${out}_vals
-
-echo "`basename $0`: subj $subj , sess $sess : done."
View
37 rsc/scripts/feat_scale.sh
@@ -1,37 +0,0 @@
-#!/bin/bash
-# The FEAT way of scaling.
-
-set -e
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <4dinput> <output> <'global'|'prop'> <normmean> <median> <subj_idx> <sess_idx>"
- echo ""
- exit 1
-}
-
-[ "$4" = "" ] && Usage
-data=`remove_ext "$1"`
-out=`remove_ext "$2"`
-mode="$3"
-normmean="$4"
-median_intensity="$5"
-subj="$6" # optional
-sess="$7" # optional
-
-if [ $mode = "global" ] ; then
- if [ x"$median_intensity" = x ] ; then Usage ; fi
- scaling=$(echo "scale=10; $normmean / $median_intensity" | bc -l)
- echo "`basename $0`: subj $subj , sess $sess : global-mean scaling of ${data} with factor $scaling..."
- fslmaths ${data} -mul $scaling ${out}
-elif [ $mode = "prop" ] ; then
- echo "`basename $0`: subj $subj , sess $sess : multiplicative mean intensity normalization of ${data} at each timepoint..."
- fslmaths ${data} -inm $normmean ${out}
-else
- echo "`basename $0`: subj $subj , sess $sess : ERROR : mode '$mode' not recognised..."
- exit 1
-fi
-
-echo "`basename $0`: subj $subj , sess $sess : done."
View
82 rsc/scripts/feat_smooth.sh
@@ -1,82 +0,0 @@
-
-#!/bin/bash
-# The FEAT way of smoothing.
-# NOTE: also performs grand mean scaling.
-
-trap 'echo "$0 : An ERROR has occured."' ERR
-
-set -e
-
-Usage() {
- echo ""
- echo "Usage: `basename $0` <4dinput> <4doutput> <"FWHM kernels"> <"HighPass cutoffs" | 'none'> <TR> <subj_idx> <sess_idx>"
- echo ""
- exit 1
-}
-
-[ "$3" = "" ] && Usage
-data=`remove_ext "$1"`
-out=`remove_ext "$2"`
-BOLD_SMOOTHING_KRNLS="$3"
-hpf_cutoffs="$4"
-if [ x"$hpf_cutoffs" = "x" -o "$hpf_cutoffs" = "none" ] ; then
- dohpf=0
-else
- dohpf=1
- tr=$5
-fi
-subj="$6" # optional
-sess="$7" # optional
-
-echo "`basename $0`: subj $subj , sess $sess : smoothing $data with [ $BOLD_SMOOTHING_KRNLS ] (FWHM) kernels -> ${out}_[${BOLD_SMOOTHING_KRNLS}] ..."
-
-# making mask
-$(dirname $0)/feat_mask.sh ${data} ${out}_susan_mask $subj $sess
-median_intensity=`cat ${out}_susan_mask_vals | awk '{print $4}'`
-susan_int=`cat ${out}_susan_mask_vals | awk '{print $5}'`
-
-echo "`basename $0`: subj $subj , sess $sess : masking `basename ${data}` -> `basename ${out}_thresh`..."
-fslmaths ${data} -mas ${out}_susan_mask ${out}_thresh
-
-echo "`basename $0`: subj $subj , sess $sess : generating mean from `basename ${out}_thres` -> *_susan_mean_func..."
-fslmaths ${out}_thresh -Tmean ${out}_susan_mean_func
-
-# smoothing
-for sm_krnl in $BOLD_SMOOTHING_KRNLS ; do
- _sm_krnl=$(echo $sm_krnl | sed "s|\.||g") # remove '.'
- smoothsigma=$(echo "scale=10; $sm_krnl / 2.355" | bc -l)
-
- if [ $smoothsigma = "0" ] ; then
- echo "`basename $0`: subj $subj , sess $sess : FWHM: $sm_krnl - sigma: $smoothsigma -> no smoothing..."
- imcp ${out}_thresh ${out}_smooth
- else
- echo "`basename $0`: subj $subj , sess $sess : FWHM: $sm_krnl - sigma: $smoothsigma"
- cmd="susan ${out}_thresh $susan_int $smoothsigma 3 1 1 ${out}_susan_mean_func $susan_int ${out}_smooth"
- echo "`basename $0`: subj $subj , sess $sess : executing command: $cmd"
- $cmd
- fi
-
- echo "`basename $0`: subj $subj , sess $sess : masking `basename ${out}_smooth` -> `basename ${out}_smooth`..."
- fslmaths ${out}_smooth -mas ${out}_susan_mask ${out}_smooth
-
- # global mean scaling
- normmean=10000
- $(dirname $0)/feat_scale.sh ${out}_smooth ${out}_intnorm "global" $normmean $median_intensity $subj $sess
- echo "`basename $0`: subj $subj , sess $sess : writing ${out}_s${_sm_krnl}..."
- fslmaths ${out}_intnorm ${out}_s${_sm_krnl}
-
- # high pass filtering (if applicable)
- if [ $dohpf -eq 1 ] ; then
- for hpf_cutoff in $hpf_cutoffs ; do
- echo "`basename $0`: subj $subj , sess $sess : high pass filtering with cutoff '$hpf_cutoff' (s) -> ${out}_s${_sm_krnl}_hpf${hpf_cutoff}..."
- $(dirname $0)/feat_hpf.sh ${out}_s${_sm_krnl} ${out}_s${_sm_krnl}_hpf${hpf_cutoff} $hpf_cutoff $tr $subj $sess
- done # end hpf_cutoff
- imrm ${out}_s${_sm_krnl}
- fi
-done # end sm_krnl
-
-# cleanup
-echo "`basename $0`: subj $subj , sess $sess : cleanup..."
-imrm ${out}_intnorm ${out}_smooth ${out}_bet ${out}_thresh ${out}_smooth_usan_size ${out}_susan_mean_func
-
-echo "`basename $0`: subj $subj , sess $sess : done."
View
137 rsc/scripts/feat_unwarp.sh
@@ -1,137 +0,0 @@