Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Andi Heckel authored

Showing 57 changed files with 0 additions and 10,181 deletions. Show diff stats Hide diff stats

  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
4 rsc/scripts/LIA_to_LAS_conformed.mat
... ... @@ -1,4 +0,0 @@
1   -1 0 0 0
2   -0 0 1 0
3   -0 -1 0 255
4   -0 0 0 1
109 rsc/scripts/apply_func2MNI.sh
... ... @@ -1,109 +0,0 @@
1   -#!/bin/bash
2   -# writes func -> standard space w/o intermediary write-outs.
3   -
4   -trap 'echo "$0 : An ERROR has occured."' ERR
5   -
6   -set -e
7   -
8   -Usage() {
9   - echo ""
10   - 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>"
11   - 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"
12   - 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"
13   - 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"
14   - echo ""
15   - exit 1
16   -}
17   -
18   -[ "$7" = "" ] && Usage
19   -
20   -input=`remove_ext "$1"`
21   -output=`remove_ext "$2"`
22   -mcdir="$3"
23   -shiftmap="$4"
24   -uwdir="$5"
25   -f2t1_mat="$6"
26   -f2mni_warp="$7"
27   -interp="$8"
28   -if [ x"$interp" = "x" ] ; then interp="trilinear" ; fi
29   -
30   -# motion correction or eddy-correction ?
31   -ecclog=0 ; sinlgemat=0
32   -if [ ! -d $mcdir ] ; then
33   - echo "`basename $0`: '$mcdir' is not a directory..."
34   - if [ -f $mcdir -a ${mcdir#*.} = "ecclog" ] ; then
35   - echo "`basename $0`: '$mcdir' is an .ecclog file."
36   - ecclog=1
37   - elif [ -f $mcdir ] ; then
38   - sinlgemat=1
39   - echo "`basename $0`: '$mcdir' is not an .ecclog file - let's assume that it is a text file with a transformation matrix in it..."
40   - else
41   - echo "`basename $0`: '$mcdir' not found. Exiting..." ; exit 1
42   - fi
43   -fi
44   -
45   -# display info
46   -echo "`basename $0` : write func -> standard space w/o intermediary write-outs..."
47   -
48   -# extract example_func
49   -nvol=`fslinfo $input | grep ^dim4 | awk '{print $2}'`
50   -mid=$(echo "scale=0 ; $nvol / 2" | bc)
51   -fslroi $input ${output}_example_func $mid 1
52   -
53   -# convert warps
54   - cmd="convertwarp --ref=${output}_example_func --shiftmap=${shiftmap} --shiftdir=${uwdir} --out=${output}_WARP1 --relout"
55   - echo $cmd
56   - $cmd
57   -
58   -
59   - cmd="convertwarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --warp1=${f2mni_warp} --premat=${f2t1_mat} --out=${output}_WARP2 --relout"
60   - echo $cmd
61   - $cmd
62   -
63   -
64   - cmd="convertwarp --ref=${FSL_DIR}/data/standard/MNI152_T1_2mm_brain.nii.gz --warp1=${output}_WARP1 --warp2=${output}_WARP2 --out=${output}_WARP --relout"
65   - echo $cmd
66   - $cmd
67   -
68   -# apply transforms
69   -imrm ${output}_tmp_????.*
70   -fslsplit $input ${output}_tmp_
71   -full_list=`imglob ${output}_tmp_????.*`
72   -i=0
73   -for file in $full_list ; do
74   - echo "processing $file"
75   - if [ $ecclog -eq 1 -o $sinlgemat -eq 1 ] ; then
76   - if [ $ecclog -eq 1 ] ; then
77   - line1=$(echo "$i*8 + 4" | bc -l)
78   - line2=$(echo "$i*8 + 7" | bc -l)
79   - cat ${mcdir} | sed -n "$line1,$line2"p > ${output}_tmp_ecclog.mat
80   - 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}"
81   - elif [ $sinlgemat -eq 1 ] ; then
82   - 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}"
83   - fi
84   - else
85   - i=`zeropad $i 4`
86   - 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}"
87   - fi
88   - echo $cmd
89   - $cmd
90   -
91   - i=$(scale=0 ; echo "$i + 1" | bc)
92   -done
93   -
94   -# merge
95   -echo "`basename $0`: merge outputs...."
96   -fslmerge -t $output $full_list
97   -outdir=$(dirname $output)
98   -fslroi $output $outdir/example_func $mid 1
99   -
100   -# cleanup
101   -imrm $full_list
102   -imrm ${output}_example_func
103   -imrm ${output}_WARP1
104   -imrm ${output}_WARP2
105   -imrm ${output}_WARP
106   -rm -f ${output}_tmp_ecclog.mat
107   -
108   -
109   -echo "`basename $0` : done."
94 rsc/scripts/apply_mc+unwarp.sh
... ... @@ -1,94 +0,0 @@
1   -#!/bin/bash
2   -# apply motion correction and unwarp shiftmap to 4Ds
3   -
4   -trap 'echo "$0 : An ERROR has occured."' ERR
5   -
6   -set -e
7   -
8   -Usage() {
9   - echo ""
10   - 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)>"
11   - echo "Example: `basename $0` bold uw_bold ./mc/prefiltered_func_data_mcf.mat/ ./unwarp/EF_UD_shift.nii.gz y spline"
12   - echo " `basename $0` diff uw_diff ./ec_dwi.ecclog ./unwarp/EF_UD_shift.nii.gz y spline"
13   - echo " `basename $0` diff uw_diff ./matrix.mat ./unwarp/EF_UD_shift.nii.gz y spline"
14   - echo ""
15   - exit 1
16   -}
17   -
18   -[ "$5" = "" ] && Usage
19   -
20   -input=`remove_ext "$1"`
21   -output=`remove_ext "$2"`
22   -mcdir="$3"
23   -shiftmap="$4"
24   -uwdir="$5"
25   -interp="$6"
26   -if [ x"$interp" = "x" ] ; then interp="trilinear" ; fi
27   -
28   -# motion correction or eddy-correction ?
29   -ecclog=0 ; sinlgemat=0
30   -if [ ! -d $mcdir ] ; then
31   - echo "`basename $0`: '$mcdir' is not a directory..."
32   - if [ -f $mcdir -a ${mcdir#*.} = "ecclog" ] ; then
33   - echo "`basename $0`: '$mcdir' is an .ecclog file."
34   - ecclog=1
35   - elif [ -f $mcdir ] ; then
36   - sinlgemat=1
37   - echo "`basename $0`: '$mcdir' is not an .ecclog file - let's assume that it is a text file with a transformation matrix in it..."
38   - else
39   - echo "`basename $0`: '$mcdir' not found. Exiting..." ; exit 1
40   - fi
41   -fi
42   -
43   -# display info
44   -echo "`basename $0` : applying motion-correction and shiftmap..."
45   -
46   -# write unwarp warpfield
47   -nvol=`fslinfo $input | grep ^dim4 | awk '{print $2}'`
48   -mid=$(echo "scale=0 ; $nvol / 2" | bc)
49   -fslroi $input ${output}_example_func $mid 1
50   -cmd="convertwarp --ref=${output}_example_func --shiftmap=${shiftmap} --shiftdir=${uwdir} --out=${output}_WARP1 --relout"
51   -echo $cmd
52   -$cmd
53   -
54   -# combine with motion correction
55   -imrm ${output}_tmp_????.*
56   -fslsplit $input ${output}_tmp_
57   -full_list=`imglob ${output}_tmp_????.*`
58   -i=0
59   -for file in $full_list ; do
60   - echo "processing $file"
61   -
62   - if [ $ecclog -eq 1 -o $sinlgemat -eq 1 ] ; then
63   - if [ $ecclog -eq 1 ] ; then
64   - line1=$(echo "$i*8 + 4" | bc -l)
65   - line2=$(echo "$i*8 + 7" | bc -l)
66   - cat ${mcdir} | sed -n "$line1,$line2"p > ${output}_tmp_ecclog.mat
67   - cmd="applywarp --ref=${output}_example_func --in=${file} --warp=${output}_WARP1 --premat=${output}_tmp_ecclog.mat --rel --out=${file} --interp=${interp}"
68   - elif [ $sinlgemat -eq 1 ] ; then
69   - cmd="applywarp --ref=${output}_example_func --in=${file} --warp=${output}_WARP1 --premat=${mcdir} --rel --out=${file} --interp=${interp}"
70   - fi
71   - else
72   - i=`zeropad $i 4`
73   - cmd="applywarp --ref=${output}_example_func --in=${file} --warp=${output}_WARP1 --premat=${mcdir}/MAT_${i} --rel --out=${file} --interp=${interp}"
74   - fi
75   -
76   - echo $cmd
77   - $cmd
78   -
79   - i=$(scale=0 ; echo "$i + 1" | bc)
80   -done
81   -
82   -# merge
83   -echo "`basename $0`: merge outputs...."
84   -fslmerge -t $output $full_list
85   -outdir=$(dirname $output)
86   -fslroi $output $outdir/example_func $mid 1
87   -
88   -# cleanup
89   -imrm $full_list
90   -imrm ${output}_example_func
91   -imrm ${output}_WARP1
92   -rm -f ${output}_tmp_ecclog.mat
93   -
94   -echo "`basename $0` : done."
49 rsc/scripts/apply_unwarp.sh
... ... @@ -1,49 +0,0 @@
1   -#!/bin/bash
2   -# apply unwarp shiftmap to 4Ds
3   -
4   -trap 'echo "$0 : An ERROR has occured."' ERR
5   -
6   -set -e
7   -
8   -Usage() {
9   - echo ""
10   - echo "Usage: `basename $0` <input4D> <output4D> <unwarp shiftmap> <unwarp direction: x/y/z/x-/y-/z-> <interp (default:trilinear)>"
11   - echo "Example: `basename $0` bold uw_bold ./unwarp/EF_UD_shift.nii.gz y spline"
12   - echo ""
13   - exit 1
14   -}
15   -
16   -[ "$4" = "" ] && Usage
17   -
18   -input=`remove_ext "$1"`
19   -output=`remove_ext "$2"`
20   -shiftmap="$3"
21   -uwdir="$4"
22   -interp="$5"
23   -if [ x"$interp" = "x" ] ; then interp="trilinear" ; fi
24   -
25   -echo "`basename $0` : applying shiftmap..."
26   -
27   -nvol=`fslinfo $input | grep ^dim4 | awk '{print $2}'`
28   -mid=$(echo "scale=0 ; $nvol / 2" | bc)
29   -fslroi $input ${output}_example_func $mid 1
30   -
31   -
32   - cmd="convertwarp --ref=${output}_example_func --shiftmap=${shiftmap} --shiftdir=${uwdir} --out=${output}_WARP1 --relout"
33   - echo $cmd
34   - $cmd
35   -
36   - cmd="applywarp --ref=${output}_example_func --in=${input} --warp=${output}_WARP1 --rel --out=${output} --interp=${interp}"
37   - echo $cmd
38   - $cmd
39   -
40   - i=$(scale=0 ; echo "$i + 1" | bc)
41   -
42   -outdir=$(dirname $output)
43   -fslroi $output $outdir/example_func $mid 1
44   -
45   -imrm ${output}_example_func
46   -imrm ${output}_WARP1
47   -
48   -
49   -echo "`basename $0` : done."
BIN  rsc/scripts/bin/sort8
Binary file not shown
488 rsc/scripts/checks.cmd
... ... @@ -1,488 +0,0 @@
1   -############
2   -# CHECK LOGS
3   -############
4   -
5   -# check recon-all
6   -grep --color=always "finished without error" ./logs/* | grep recon-all | grep -v recon-all_base | grep -v recon-all_long
7   -grep --color=always "finished without error" ./logs/* | grep recon-all_base
8   -grep --color=always "finished without error" ./logs/* | grep recon-all_long
9   -
10   -
11   -
12   -# check tracula
13   -grep --color=always "finished without error" ./logs/* | grep trac-all-prep
14   -
15   -c=1
16   -for i in `find ./subj/FS_subj -name monitor -type f | sort` ; do
17   - i=$(dirname $i)
18   - if [ -f $i/xfms/eye.mat ] ; then
19   - echo "$c '$i' : finished"
20   - else
21   - echo "$c '$i' : unfinished"
22   - fi
23   - c=$[$c+1]
24   -done
25   -c=0
26   -
27   -grep --color=always "finished without error" ./logs/* | grep trac-all-paths
28   -
29   -
30   -
31   -# check sge error-logs
32   -greperror.sh logs/*.e*
33   -
34   -
35   -
36   -# check BPX
37   -subdir=bpx_topup_ec_bvecrot.bedpostX
38   -c=1 ; for i in `find ./subj -name monitor -type f | grep /bpx/$subdir | sort` ; do
39   - i=$(dirname $i)
40   - if [ -f $i/xfms/eye.mat ] ; then
41   - echo "$c '$i' : finished."
42   - else
43   - echo "$c '$i' : UNFINISHED."
44   - fi
45   - c=$[$c+1]
46   -done ; c=0
47   -
48   -
49   -
50   -# check feat - dwi
51   -subdir=unwarpDWI_y.feat
52   -find ./subj -name report_log.html -type f | grep /fdt/$subdir | sort | xargs -I {} greperror.sh {}
53   -
54   -
55   -
56   -# check feat - bold
57   -subdir=preprocBOLD_uw.y_st0_s0_hpfInf.feat
58   -find ./subj -name report_log.html -type f | grep /bold/$subdir | sort | xargs -I {} greperror.sh {}
59   -
60   -
61   -
62   -# check VBM
63   -subdir=vbm_nonflip
64   -greperror.sh ./grp/vbm/$subdir/*/fslvbm*
65   -greperror.sh ./grp/vbm/$subdir/stats*/*/*/*.generate*
66   -
67   -
68   -
69   -# check TBSS
70   -subdir=tbss_nonflip_topup_ec_bvecrot
71   -find ./grp/tbss/$subdir/*/ -name tbss_?_* | sort | xargs -I {} greperror.sh {}
72   -greperror.sh ./grp/tbss/$subdir/stats*/*/*/*.generate*
73   -
74   -
75   -
76   -# check dualreg
77   -subdir=ica_50_allICs_n2000
78   -greperror.sh ./grp/dualreg/$subdir/scripts+logs/*
79   -
80   -
81   -
82   -
83   -
84   -##############
85   -# CHECK IMAGES
86   -##############
87   -
88   -################################
89   -# check denoise masks (mni bold)
90   -################################
91   -file=filtered_func_data_longt_mni2.nii.gz ; subdir=bold/SESSA_uw+y_st0_s0_hpfInf.feat ; out=chk/MNI_bold_merged
92   -
93   -mkdir -p $(dirname $out)
94   -files=$(find ./subj -name $file | grep /$subdir/reg_standard/ | sort)
95   -c=1; for i in $files ; do echo "$(zeropad $c 3) $i" ; c=$[$c+1] ; done ; c=0
96   -extractmerge.sh $out 0 "$files"
97   -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"
98   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
99   -
100   -
101   -######################################
102   -# check denoise masks (mni bold) - alt
103   -######################################
104   -file=filtered_func_data_mni2.nii.gz ; subdir=bold/SESSA_uw+y_st0_s0_hpfInf.feat ; out=MNI_bold_
105   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
106   -sess="a b c d e"
107   -
108   -mkdir -p $(dirname $out) ; imrm ${out}tmp_????
109   -f_WM=""; f_CSF=""; f_WB=""; f_bold=""
110   -c=1 ; for i in $subj ; do
111   - for j in $sess ; do
112   - if [ -f $i/$j/$subdir/reg_standard/$file -a -d $i/$j/$subdir/reg_standard/noise ] ; then
113   - echo "$(zeropad $c 3) $i $j : found."
114   - f_WM=$f_WM" "$i/$j/$subdir/reg_standard/noise/MNI_WM
115   - f_CSF=$f_CSF" "$i/$j/$subdir/reg_standard/noise/MNI_CSF
116   - f_WB=$f_WB" "$i/$j/$subdir/reg_standard/noise/EF_WB
117   - extractmerge.sh ${out}tmp_$(zeropad $c 4) 0 "$i/$j/$subdir/reg_standard/$file"
118   - f_bold=$f_bold" "${out}tmp_$(zeropad $c 4)
119   - c=$[$c+1]
120   - else
121   - echo " $i $j : not found."
122   - fi
123   - done
124   -done ; c=0
125   -fslmerge -t ${out}WM_merged $f_WM 2>/dev/null
126   -fslmerge -t ${out}CSF_merged $f_CSF 2>/dev/null
127   -fslmerge -t ${out}WB_merged $f_WB 2>/dev/null
128   -fslmerge -t ${out}merged $f_bold 2>/dev/null
129   -imrm ${out}tmp_????
130   -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"
131   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
132   -
133   -
134   -###################################
135   -# check denoise masks (native bold)
136   -###################################
137   -file=example_func.nii.gz ; subdir=bold/SESSA_uw+y_st0_s0_hpfInf.feat ; out=chk/EF_bold_
138   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
139   -sess="a b c d e"
140   -
141   -mkdir -p $(dirname $out) ; imrm ${out}tmp_????
142   -f_WM=""; f_CSF=""; f_WB=""; f_bold=""
143   -c=1 ; for i in $subj ; do
144   - for j in $sess ; do
145   - if [ -f $i/$j/$subdir/$file -a -d $i/$j/$subdir/noise ] ; then
146   - echo "$(zeropad $c 3) $i $j : found."
147   - f_WM=$f_WM" "$i/$j/$subdir/noise/EF_WM
148   - f_CSF=$f_CSF" "$i/$j/$subdir/noise/EF_CSF
149   - f_WB=$f_WB" "$i/$j/$subdir/noise/EF_WB
150   - f_bold=$f_bold" "$i/$j/$subdir/$file
151   - c=$[$c+1]
152   - else
153   - echo " $i $j : not found."
154   - fi
155   - done
156   -done ; c=0
157   -fslmerge -t ${out}WM_merged $f_WM 2>/dev/null
158   -fslmerge -t ${out}CSF_merged $f_CSF 2>/dev/null
159   -fslmerge -t ${out}WB_merged $f_WB 2>/dev/null
160   -fslmerge -t ${out}merged $f_bold 2>/dev/null
161   -imrm ${out}tmp_????
162   -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"
163   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
164   -
165   -
166   -############################
167   -# check vbm brain extraction
168   -############################
169   -struc=*_t1_orig.nii.gz ; brain=*_t1_watershed_initbrain.nii.gz ; out=chk/vbm_
170   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
171   -sess="a b c d e"
172   -
173   -mkdir -p $(dirname $out) ; imrm ${out}tmp_????
174   -f_brain=""; f_struc=""
175   -c=1 ; for i in $subj ; do
176   - for j in $sess ; do
177   - if [ -f $i/$j/vbm/$struc -a -f $i/$j/vbm/$brain ] ; then
178   - echo "$(zeropad $c 3) $i $j : found."
179   - f_brain=$f_brain" "$i/$j/vbm/$brain
180   - f_struc=$f_struc" "$i/$j/vbm/$struc
181   - c=$[$c+1]
182   - else
183   - echo " $i $j : not found."
184   - fi
185   - done
186   -done ; c=0
187   -fslmerge -t ${out}brain $f_brain 2>/dev/null
188   -fslmerge -t ${out}struc $f_struc 2>/dev/null
189   -
190   -cmd="fslview ${out}struc -t 0.5 ${out}brain -t 1"
191   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
192   -
193   -
194   -###################
195   -# check bold unwarp
196   -###################
197   -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_
198   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
199   -sess="a b c d e"
200   -
201   -mkdir -p $(dirname $out) ; imrm ${out}tmp_????
202   -files=""; files2="";
203   -c=1 ; for i in $subj ; do
204   - for j in $sess ; do
205   - if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
206   - echo "$(zeropad $c 3) $i $j : found."
207   - extractmerge.sh ${out}tmp_$(zeropad $c 4) 0 "$i/$j/$file"
208   - files=$files" "${out}tmp_$(zeropad $c 4)
209   - #files=$files" "$i/$j/$file
210   - files2=$files2" "$i/$j/$file2
211   - c=$[$c+1]
212   - else
213   - echo " $i $j : not found."
214   - fi
215   - done
216   -done ; c=0
217   -fslmerge -t ${out}merged $files 2>/dev/null
218   -fslmerge -t ${out}magn_merged $files2 2>/dev/null
219   -imrm ${out}tmp_????
220   -cmd="fslview ${out}magn_merged -l "Blue-Lightblue" ${out}merged"
221   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
222   -
223   -
224   -######################
225   -# check BOLD->T1 bbreg
226   -######################
227   -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_
228   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
229   -sess="a b c d e"
230   -
231   -mkdir -p $(dirname $out) ; imrm ${out}tmp_????
232   -files=""; files2="";
233   -c=1 ; for i in $subj ; do
234   - for j in $sess ; do
235   - if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
236   - echo "$(zeropad $c 3) $i $j : found."
237   - files=$files" "$i/$j/$file
238   - files2=$files2" "$i/$j/$file2
239   - c=$[$c+1]
240   - else
241   - echo " $i $j : not found."
242   - fi
243   - done
244   -done ; c=0
245   -fslmerge -t ${out}bold_bbreg $files 2>/dev/null
246   -fslmerge -t ${out}T1 $files2 2>/dev/null
247   -imrm ${out}tmp_????
248   -cmd="fslview ${out}bold_bbreg ${out}T1"
249   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
250   -
251   -
252   -##################
253   -# check dwi unwarp
254   -##################
255   -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_
256   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
257   -sess="a c e"
258   -
259   -mkdir -p $(dirname $out) ; imrm ${out}tmp_????
260   -files=""; files2="";
261   -c=1 ; for i in $subj ; do
262   - for j in $sess ; do
263   - if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
264   - echo "$(zeropad $c 3) $i $j : found."
265   - extractmerge.sh ${out}tmp_$(zeropad $c 4) 0 "$i/$j/$file"
266   - files=$files" "${out}tmp_$(zeropad $c 4)
267   - #files=$files" "$i/$j/$file
268   - files2=$files2" "$i/$j/$file2
269   - c=$[$c+1]
270   - else
271   - echo " $i $j : not found."
272   - fi
273   - done
274   -done ; c=0
275   -fslmerge -t ${out}merged $files 2>/dev/null
276   -fslmerge -t ${out}magn_merged $files2 2>/dev/null
277   -imrm ${out}tmp_????
278   -cmd="fslview ${out}magn_merged -l "Blue-Lightblue" ${out}merged"
279   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
280   -
281   -
282   -#############
283   -# pSWI -> MNI
284   -#############
285   -_subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
286   -_sess="a b c d e"
287   -out=pseudoSWI_MNI
288   -subdir=SESSA_uw+y_st0_s0_hpfInf.feat
289   -_FM_2_EF=bold/$subdir/unwarp/FM_2_EF.mat
290   -_EF_2_T1=bold/$subdir/reg_longt/example_func2longt_brain.mat
291   - #_EF_2_T1=bold/$subdir/reg/example_func2highres.mat
292   -_T1_2_MNI=bold/$subdir/reg_longt/longt_head2longt_standard_warp.nii.gz
293   - #_T1_2_MNI=bold/$subdir/reg/highres2standard_warp.nii.gz
294   -
295   -c=1 ; for subj in $_subj ; do
296   - for sess in $_sess ; do
297   - fldr=$subj/$sess/fm
298   - fmap=$fldr/uphase_rad_filt.nii.gz
299   - fmap0=$fldr/fmap_rads_masked.nii.gz
300   - magn=$fldr/magn.nii.gz
301   -
302   - FM_2_EF=$subj/$sess/$_FM_2_EF
303   - EF_2_T1=$subj/$sess/$_EF_2_T1
304   - T1_2_MNI=$subj/$sess/$_T1_2_MNI
305   -
306   - err=0
307   - if [ ! -f $FM_2_EF ] ; then echo "$subj $sess : '$FM_2_EF' not found." ; err=1 ; fi
308   - if [ ! -f $EF_2_T1 ] ; then echo "$subj $sess : '$EF_2_T1' not found." ; err=1 ; fi
309   - if [ ! -f $T1_2_MNI ] ; then echo "$subj $sess : '$T1_2_MNI' not found." ; err=1 ; fi
310   - if [ ! -f $magn ] ; then echo "$subj $sess : '$magn' not found." ; err=1 ; fi
311   - if [ $err -eq 1 ] ; then continue ; fi
312   -
313   - c=$[$c+1]
314   - echo "$(zeropad $c 3) $subj $sess : found."
315   -
316   - echo " subj $subj , sess $sess : fieldmap->bold: $FM_2_EF"
317   - echo " subj $subj , sess $sess : bold->T1: $EF_2_T1"
318   - echo " subj $subj , sess $sess : T1->MNI: $T1_2_MNI"
319   -
320   - echo " subj $subj , sess $sess : concatenate matrices..."
321   - convert_xfm -omat $fldr/fm_to_t1.mat -concat $EF_2_T1 $FM_2_EF
322   -
323   - echo " subj $subj , sess $sess : apply transform to `basename $fmap`..."
324   - applywarp --ref=$FSLDIR/data/standard/MNI152_T1_2mm_brain --in=$fmap --out=$fldr/${out} --warp=$T1_2_MNI --premat=$fldr/fm_to_t1.mat
325   -
326   - #echo " subj $subj , sess $sess : apply transform to `basename $fmap0`..."
327   - #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
328   -
329   - #echo " subj $subj , sess $sess : apply transform to `basename $magn`..."
330   - #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
331   - done
332   -done ; c=0
333   -
334   -
335   -##########################
336   -# check fmap & hpf'ed fmap
337   -##########################
338   -file=fm/fmap_rads_masked.nii.gz ; file2=fm/uphase_rad_filt.nii.gz ; out=chk/fmap_
339   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
340   -sess="a b c d e"
341   -
342   -mkdir -p $(dirname $out)
343   -files=""; files2=""
344   -c=1 ; for i in $subj ; do
345   - for j in $sess ; do
346   - if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
347   - echo "$(zeropad $c 3) $i $j : found."
348   - files=$files" "$i/$j/$file
349   - files2=$files2" "$i/$j/$file2
350   - c=$[$c+1]
351   - else
352   - echo " $i $j : not found."
353   - fi
354   - done
355   -done ; c=0
356   -fslmerge -t ${out}merged $files 2>/dev/null
357   -fslmerge -t ${out}filt $files2 2>/dev/null
358   -cmd="fslview ${out}filt ${out}merged"
359   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
360   -
361   -
362   -############################################
363   -# check averaged MNI-bolds & hpf'ed MNI-fmap
364   -############################################
365   -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_
366   -subj=$(find ./subj -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
367   -sess="a b c d e"
368   -
369   -mkdir -p $(dirname $out)
370   -files=""; files2=""
371   -c=1 ; for i in $subj ; do
372   - for j in $sess ; do
373   - if [ -f $i/$j/$file -a -f $i/$j/$file2 ] ; then
374   - echo "$(zeropad $c 3) $i $j : found."
375   - cmd="fslmaths $i/$j/$file -Tmean ${out}tmp_$(zeropad $c 4)"
376   - echo " $cmd" ; $cmd
377   - files=$files" "${out}tmp_$(zeropad $c 4)
378   - files2=$files2" "$i/$j/$file2
379   - c=$[$c+1]
380   - else
381   - echo " $i $j : not found."
382   - fi
383   - done
384   -done ; c=0
385   -fslmerge -t ${out}merged $files 2>/dev/null
386   -fslmerge -t ${out}filt $files2 2>/dev/null
387   -imrm ${out}tmp_????
388   -cmd="fslview ${out}filt ${out}merged"
389   -echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
390   -
391   -
392   -###########################################
393   -# check FREESURFER's Talairach registration
394   -###########################################
395   -subj=$(find ./subj/FS_subj -mindepth 1 -maxdepth 1 -type d | grep -v '.long.' | sort)
396   -SUBJECTS_DIR=./subj/FS_subj
397   -
398   -paths="" ; c=1
399   -for i in $subj ; do
400   - if [ -f ${i}/mri/transforms/talairach.auto.xfm ] ; then
401   - echo "$(zeropad $c 3) $i : found."
402   - paths=$paths" "${i}
403   - c=$[$c+1]
404   - else
405   - echo " $i : not found."
406   - fi
407   -
408   - done
409   -
410   -for i in $paths ; do
411   - tkregister2 --s $(basename $i) --fstal --surf
412   -done
413   -
414   -
415   -###############################################
416   -# check FREESURFER's surfaces and segmentations
417   -###############################################
418   -d=./subj/FS_subj
419   -subj="$d/01a $d/02"
420   -#subj=$(find $d -mindepth 1 -maxdepth 1 -type d | grep -v '.long.' | sort)
421   -SUBJECTS_DIR=$d
422   -
423   -paths="" ; c=1
424   -for i in $subj ; do
425   - if [ -f ${i}/mri/aparc+aseg.mgz ] ; then
426   - echo "$(zeropad $c 3) $i : found."
427   - paths=$paths" "${i}
428   - c=$[$c+1]
429   - else
430   - echo " $i : not found."
431   - fi
432   -
433   - done
434   -
435   -for i in $paths ; do
436   - tkmedit $(basename $i) brainmask.mgz -aux T1.mgz -surfs -aseg &
437   - tksurfer $(basename $i) lh inflated
438   - read -p "press key..."
439   -done
440   -
441   -
442   -#################################
443   -# check longt. VBM using freeview
444   -#################################
445   -subj=01
446   -base=./subj/FS_subj/${subj}
447   -a=./subj/FS_subj/${subj}a.long.${subj}
448   -b=./subj/FS_subj/${subj}c.long.${subj}
449   -c=./subj/FS_subj/${subj}e.long.${subj}
450   -
451   -freeview -v $base/mri/norm.mgz \
452   - -f $a/surf/lh.pial:edgecolor=red \
453   - $a/surf/lh.white:edgecolor=blue \
454   - $b/surf/lh.pial:edgecolor=255,128,128 \
455   - $b/surf/lh.white:edgecolor=lightblue \
456   - $c/surf/lh.pial:edgecolor=255,128,0 \
457   - $c/surf/lh.white:edgecolor=white \
458   -
459   -
460   -
461   -
462   -############
463   -# check TBSS
464   -############
465   -statdirs=$(find ./grp/tbss/ -name "stats_*" -type d | sort)
466   -out=chk/tbss.cmd
467   -
468   -rm -f $out
469   -for i in $statdirs ; do
470   - if [ -f $i/all_FA_skeletonised.nii.gz -a -f $i/all_FA.nii.gz ] ; then
471   - echo "$i : found."
472   - 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
473   - 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
474   - 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
475   - fi
476   - else
477   - echo "$i : not found."
478   - fi
479   -done
480   -
481   -cat $out
482   -
483   -
484   -
485   -
486   -
487   -
488   -
95 rsc/scripts/collectvols.sh
... ... @@ -1,95 +0,0 @@
1   -#!/bin/bash
2   -# collect and merge volumes from the directory tree
3   -
4   -set -e
5   -
6   -trap 'echo "$0 : An ERROR has occured."' ERR
7   -
8   -wdir=`pwd`/.collectvols$$ ; mkdir -p $wdir
9   -trap "echo -e \"\ncleanup: erasing '$wdir'\" ; rm -f $wdir/* ; rmdir $wdir ; exit" EXIT
10   -
11   -Usage() {
12   - echo ""
13   - echo "Usage: `basename $0` [ -m|-e [idx] ] <4doutput> <\"subdir/filename\"> <subjectsdir> <\"01 02 ...\"|-> <\"sessa sessb ...\">"
14   - echo ""
15   - exit 1
16   -}
17   -
18   -[ "$5" = "" ] && Usage
19   -domean=0 ; doextr=0
20   -if [ $1 = "-m" ] ; then
21   - domean=1
22   - shift
23   -elif [ $1 = "-e" ] ; then
24   - doextr=1
25   - idx=$2
26   - shift 2
27   -fi
28   -out=`remove_ext "$1"`
29   -file="$2"
30   -subjdir="$3"
31   -if [ "$4" = "-" ] ; then
32   - subj=$(find $subjdir -mindepth 1 -maxdepth 1 -type d | grep -v FS_ | sort)
33   -else
34   - subj="$4"
35   - _subj=""
36   - for i in $subj ; do
37   - _subj=$_subj" "$subjdir/$i
38   - done
39   - subj="$_subj"
40   -fi
41   -sess="$5"
42   -
43   -
44   -c=1 ; for i in $subj ; do
45   - for j in $sess ; do
46   - if [ -f $i/$j/$file ] ; then
47   - echo "$(zeropad $c 3) found: $i/$j/$file"
48   - c=$[$c+1]
49   - else
50   - echo " not found: $i/$j/$file"
51   - fi
52   - done
53   -done ; c=0
54   -
55   -set +e
56   -read -p "Press key..."
57   -set -e
58   -
59   -mkdir -p $(dirname $out)
60   -files=""
61   -rm -f $wdir/*
62   -rm -f ${out}.list
63   -c=1 ; for i in $subj ; do
64   - for j in $sess ; do
65   - if [ -f $i/$j/$file ] ; then
66   - if [ $doextr -eq 1 ] ; then
67   - echo "$(zeropad $c 3) found: $i/$j/$file - extracting at pos. $idx..." | tee -a ${out}.list
68   - _file=$(zeropad $c 3)_extracted_${idx}
69   - fslroi $i/$j/$file $wdir/$_file $idx 1
70   - files=$files" "$wdir/$_file
71   - elif [ $domean -eq 1 ] ; then
72   - echo "$(zeropad $c 3) found: $i/$j/$file - creating mean..." | tee -a ${out}.list
73   - _file=$(zeropad $c 3)_mean
74   - fslmaths $i/$j/$file -Tmean $wdir/$_file
75   - files=$files" "$wdir/$_file
76   - else
77   - echo "$(zeropad $c 3) found: $i/$j/$file" >> ${out}.list
78   - files=$files" "$i/$j/$file
79   - fi
80   - c=$[$c+1]
81   - else
82   - echo " not found: $i/$j/$file" >> ${out}.list
83   - fi
84   - done
85   -done ; c=0
86   -
87   -echo "merging..."
88   -cmd="fslmerge -t ${out} $files"
89   -echo $cmd ; $cmd
90   -
91   -#cmd="fslview ${out}"
92   -#echo $cmd | tee ${out}.cmd ; chmod +x ${out}.cmd ; $cmd
93   -
94   -
95   -echo "`basename $0`: done."
52 rsc/scripts/convert_regs.sh
... ... @@ -1,52 +0,0 @@
1   -#!/bin/bash
2   -# converts between affine matrix formats
3   -
4   -trap 'echo "$0 : An ERROR has occured."' ERR
5   -
6   -set -e
7   -
8   -Usage() {
9   - echo ""
10   - echo "Usage: `basename $0` <mov> <targ> <inmat: .reg|.lta|.txt|.mat|.xfm> <outmat: .reg|.lta||.mat|.xfm>"
11   - echo "Note: vox2vox ascii (.txt): targ->mov, not mov->targ"
12   - echo ""
13   - exit 1
14   -}
15   -
16   -[ "$4" = "" ] && Usage
17   -
18   -mov="$1"
19   -targ="$2"
20   -inmat="$3"
21   -outmat="$4"
22   -
23   -out_ext=${outmat##*.}
24   -in_ext=${inmat##*.}
25   -
26   -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
27   -
28   -if [ "$in_ext" = "dat" ] ; then regin="--reg $inmat" ; fi
29   -if [ "$in_ext" = "xfm" ] ; then regin="--xfm $inmat" ; fi
30   -if [ "$in_ext" = "mat" ] ; then regin="--fsl $inmat" ; fi
31   -if [ "$in_ext" = "lta" ] ; then regin="--lta $inmat" ; fi
32   -if [ "$in_ext" = "txt" ] ; then regin="--vox2vox $inmat" ; fi
33   -
34   -
35   -if [ "$out_ext" = "dat" ] ; then regout="--reg $outmat" ; fi
36   -if [ "$out_ext" = "xfm" ] ; then regout="--xfmout $outmat" ; fi
37   -if [ "$out_ext" = "mat" ] ; then regout="--fslregout $outmat" ; fi
38   -if [ "$out_ext" = "lta" ] ; then regout="--ltaout $outmat" ; fi
39   -
40   -if [ "$in_ext" != "dat" -a "$out_ext" != "dat" ] ; then delme="--reg $$deleteme.reg.dat" ; else delme="" ; fi
41   -
42   -cmd="tkregister2 --noedit --mov $mov --targ $targ $regin $regout $delme"
43   -echo $cmd ; $cmd
44   -
45   -
46   -rm -f $$deleteme.reg.dat
47   -
48   -
49   -echo "`basename $0` : subj $subj , sess $sess : done."
50   -
51   -
52   -
110 rsc/scripts/createALFF.sh
... ... @@ -1,110 +0,0 @@
1   -#!/bin/bash
2   -
3   -## This is an adaptation of the 1000 Connectome script written by Xi-Nian Zuo, Maarten Mennes & Michael Milham.
4   -## for more information see www.nitrc.org/projects/fcon_1000
5   -
6   -set -e
7   -
8   -trap 'echo "$0 : An ERROR has occured."' ERR
9   -
10   -Usage() {
11   - echo ""
12   - echo "Usage: `basename $0` <ALFF-out> <bold4D-in> <mask> <TR(s)> <freq-band:LP,HP>"
13   - echo "Example: `basename $0` outdir/ALFF.nii.gz bold/resting.nii.gz bold/mask.nii.gz 3.33 0.01,0.1"
14   - echo "Note: Input should be motion-corrected (perhaps also unwarped + slicetiming corrected) with drifts removed and Grand-Mean scaled."
15   - exit 1
16   -}
17   -
18   -[ "$5" = "" ] && Usage
19   -
20   -out=$(remove_ext "$1")
21   -input=$(remove_ext "$2")
22   -mask=$(remove_ext "$3")
23   -TR=$4
24   -LP=$(echo $5 | cut -d "," -f 1)
25   -HP=$(echo $5 | cut -d "," -f 2)
26   -
27   -# checks
28   -if [ ! -f ${input}.nii.gz ] ; then
29   - echo "`basename $0`: ERROR: file '$input' not found... exiting" ; exit 1
30   -fi
31   -if [ ! -f ${mask}.nii.gz ] ; then
32   - echo "`basename $0`: ERROR: file '$mask' not found... exiting" ; exit 1
33   -fi
34   -
35   -# mkdir
36   -wdir=$(dirname $out) ; mkdir -p $wdir
37   -
38   -## 0. Bet
39   -#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
40   -
41   -## CALCULATING ALFF AND fALFF
42   -## 1. primary calculations
43   -n_vols=`fslinfo $input| grep ^dim4 | awk '{print $2}'`
44   -echo "`basename $0`: there are ${n_vols} vols"
45   -## decide whether n_vols is odd or even
46   -MOD=$(echo "${n_vols} % 2" | bc ) ; echo "`basename $0`: Odd (1) or Even (0): ${MOD}"
47   -## if odd, remove the first volume
48   -N=$(echo "scale=0; ${n_vols}/2"|bc) ; N=$(echo "2*${N}"|bc)
49   -if [ ${MOD} -eq 1 ]
50   -then
51   - echo "`basename $0`: Deleting the first volume from bold data due to a bug in fslpspec"
52   - fslroi $input $wdir/prealff_func_data.nii.gz 1 ${N}
53   -fi
54   -if [ ${MOD} -eq 0 ]
55   -then
56   - cp ${input}.nii.gz $wdir/prealff_func_data.nii.gz
57   -fi
58   -
59   -## 1. Despike
60   -
61   -## 2. Computing power spectrum
62   -echo "`basename $0`: Computing power spectrum"
63   -fslpspec $wdir/prealff_func_data.nii.gz $wdir/prealff_func_data_ps.nii.gz
64   -## 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)
65   -cp $wdir/prealff_func_data_ps.nii.gz $wdir/power_spectrum_distribution.nii.gz
66   -echo "`basename $0`: Computing square root of power spectrum"
67   -fslmaths $wdir/prealff_func_data_ps.nii.gz -sqrt $wdir/prealff_func_data_ps_sqrt.nii.gz
68   -
69   -## 3. Calculate ALFF
70   -echo "`basename $0`: Extracting power spectrum at the slow frequency band"
71   -## calculate the low frequency point
72   -n_lp=$(echo "scale=10; ${LP}*${N}*${TR}"|bc)
73   -n1=$(echo "${n_lp}-1"|bc|xargs printf "%1.0f") ;
74   -echo "`basename $0`: ${LP} Hz is around the ${n1} frequency point."
75   -## calculate the high frequency point
76   -n_hp=$(echo "scale=10; ${HP}*${N}*${TR}"|bc)
77   -n2=$(echo "${n_hp}-${n_lp}+1"|bc|xargs printf "%1.0f") ;
78   -echo "`basename $0`: There are about ${n2} frequency points before ${HP} Hz."
79   -## cut the low frequency data from the the whole frequency band
80   -fslroi $wdir/prealff_func_data_ps_sqrt.nii.gz $wdir/prealff_func_ps_slow.nii.gz ${n1} ${n2}
81   -## calculate ALFF as the sum of the amplitudes in the low frequency band
82   -echo "`basename $0`: Computing amplitude of the low frequency fluctuations (ALFF)"
83   -fslmaths $wdir/prealff_func_ps_slow.nii.gz -Tmean -mul ${n2} $wdir/prealff_func_ps_alff4slow.nii.gz
84   -imcp $wdir/prealff_func_ps_alff4slow.nii.gz ${out}_ALFF
85   -
86   -## 4. Calculate fALFF
87   -echo "`basename $0`: Computing amplitude of total frequency"
88   -fslmaths $wdir/prealff_func_data_ps_sqrt.nii.gz -Tmean -mul ${N} -div 2 $wdir/prealff_func_ps_sum.nii.gz
89   -## calculate fALFF as ALFF/amplitude of total frequency
90   -echo "`basename $0`: Computing fALFF"
91   -fslmaths $wdir/prealff_func_ps_alff4slow.nii.gz -div $wdir/prealff_func_ps_sum.nii.gz ${out}_fALFF.nii.gz
92   -
93   -## 5. Z-normalisation across whole brain
94   -echo "`basename $0`: Normalizing ALFF/fALFF to Z-score across full brain"
95   -fslstats ${out}_ALFF -k ${mask}.nii.gz -m > ${out}_mean_ALFF.txt ; mean=$( cat ${out}_mean_ALFF.txt )
96   -fslstats ${out}_ALFF -k ${mask}.nii.gz -s > ${out}_std_ALFF.txt ; std=$( cat ${out}_std_ALFF.txt )
97   -echo " mean: $mean ; std: $std"
98   -fslmaths ${out}_ALFF.nii.gz -sub ${mean} -div ${std} -mas ${mask}.nii.gz ${out}_ALFF_Z.nii.gz
99   -fslstats ${out}_fALFF.nii.gz -k ${mask}.nii.gz -m > ${out}_mean_fALFF.txt ; mean=$( cat ${out}_mean_fALFF.txt )
100   -fslstats ${out}_fALFF.nii.gz -k ${mask}.nii.gz -s > ${out}_std_fALFF.txt ; std=$( cat ${out}_std_fALFF.txt )
101   -echo " mean: $mean ; std: $std"
102   -fslmaths ${out}_fALFF.nii.gz -sub ${mean} -div ${std} -mas ${mask}.nii.gz ${out}_fALFF_Z.nii.gz
103   -
104   -## 6. Register Z-transformed ALFF and fALFF maps to standard space
105   -
106   -## 7. Clean up
107   -echo "`basename $0`: Clean up temporary files"
108   -rm -f $wdir/prealff_*.nii.gz
109   -
110   -
54 rsc/scripts/cycler.sh
... ... @@ -1,54 +0,0 @@
1   -#!/bin/bash
2   -
3   -#cycler
4   -
5   -trap 'echo "$0 : An ERROR has occured."' ERR
6   -
7   -set -e
8   -
9   -Usage() {
10   - echo ""
11   - echo "Usage: `basename $0` <'cmd'> <'A B C...'> <'a b c...'< <'1 2 3...'>"
12   - echo "example: `basename $0` 'ls @^/@^^' '01 02 03' 'a b c'"
13   - echo ""
14   - exit 1
15   -}
16   -
17   -[ "$2" = "" ] && Usage
18   -
19   -cmd="$1" ; shift
20   -
21   -nlev=$#
22   -if [ $nlev -gt 4 ] ; then echo "`basename $0` : Sorry, `basename $0` does not support more than 4 levels." ; exit 1 ; fi
23   -
24   -a1="$1"
25   -a2="$2"
26   -a3="$3"
27   -a4="$4"
28   -
29   -if [ "$a2" = "" ] ; then a2="1" ; fi
30   -if [ "$a3" = "" ] ; then a3="1" ; fi
31   -if [ "$a4" = "" ] ; then a4="1" ; fi
32   -
33   -
34   -cmd=`echo $cmd | sed 's|@^^^^|\${LLL}|g'`
35   -cmd=`echo $cmd | sed 's|@^^^|\${KKK}|g'`
36   -cmd=`echo $cmd | sed 's|@^^|\${JJJ}|g'`
37   -cmd=`echo $cmd | sed 's|@^|\${III}|g'`
38   -
39   -export III JJJ KKK LLL
40   -
41   -for III in $a1 ; do
42   -for JJJ in $a2 ; do
43   -for KKK in $a3 ; do
44   -for LLL in $a4 ; do
45   -
46   - sh -c "echo $cmd"
47   -
48   -done
49   -done
50   -done
51   -done
52   -
53   -unset III JJJ KKK LLL
54   -
25 rsc/scripts/delbrokenlinks.sh
... ... @@ -1,25 +0,0 @@
160 rsc/scripts/denoise4D.sh
... ... @@ -1,160 +0,0 @@
1   -#!/bin/bash
2   -# removes nuisance confounds from 4D functional using masks
3   -
4   -trap 'echo "$0 : An ERROR has occured."' ERR
5   -
6   -set -e
7   -
8   -Usage() {
9   - echo ""
10   - 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>"
11   - echo " Options: -m just create confound matrix, don't denoise"
12   - echo ""
13   - exit 1
14   -}
15   -
16   -function row2col()
17   -{
18   - local dat=`cat $1`
19   - local i=""
20   - for i in $dat ; do echo $i ; done
21   -}
22   -
23   -if [ x$(which octave) = "x" ] ; then echo "`basename $0` : ERROR : OCTAVE does not seem to be installed on your system ! Exiting..." ; exit 1 ; fi
24   -
25   -if [ "$1" = "-m" ] ; then
26   - denoise=0
27   - shift
28   -else
29   - denoise=1
30   -fi
31   -
32   -[ "$5" = "" ] && Usage
33   -input=$(remove_ext "$1")
34   -masks="$2"
35   -movpar="$3" ;
36   -movpar_calcs="$4"
37   -output=$(remove_ext "$5")
38   -subj="$6" # optional
39   -sess="$7" # optional
40   -
41   -outdir=`dirname $output`
42   -indir=`dirname $input`
43   -formula1="output_precision(8); c" # formula1="c-mean(c)" # for WM / CSF / WB signal
44   -formula2="output_precision(8); c" # formula2="c-mean(c)" # for movpars
45   -
46   -# extract nuisance regressors from masks
47   -ts_list=""
48   -ts_list_proc=""
49   -if [ "$masks" != "none" ] ; then
50   - for mask in $masks ; do
51   - mask=$indir/$mask
52   - ts=${output}_$(basename $(remove_ext $mask))_meants
53   - echo "`basenam