Skip to content
Snippets Groups Projects
Commit 03b7cb37 authored by Rita Nunes's avatar Rita Nunes
Browse files

changed the script to be compatible with any image format

parent 72e1bab0
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ input_file=$1 ...@@ -21,7 +21,7 @@ input_file=$1
output_file=$2 output_file=$2
current_dir=`pwd` current_dir=`pwd`
if [ ! -e $input_file.hdr ]; then if [ ! `imtest $input_file` ]; then
echo Cant find $input_file echo Cant find $input_file
exit exit
fi fi
...@@ -36,7 +36,7 @@ if [ ! -e bvecs ]; then ...@@ -36,7 +36,7 @@ if [ ! -e bvecs ]; then
exit exit
fi fi
avwsplit $input_file.hdr avwsplit $input_file
vol=0 vol=0
num_vols=`expr $# - 2` num_vols=`expr $# - 2`
...@@ -51,39 +51,31 @@ while [ $vol -lt $num_vols ]; do ...@@ -51,39 +51,31 @@ while [ $vol -lt $num_vols ]; do
v=$3 v=$3
shift shift
if [ -e vol000${v}.hdr ]; then if [ `imtest vol000${v}` ]; then
rm vol000${v}.hdr -f imrm vol000${v}
rm vol000${v}.img -f
fi fi
if [ -e vol00${v}.hdr ]; then if [ `imtest vol00${v}` ]; then
rm vol00${v}.hdr -f imrm vol00${v}
rm vol00${v}.img -f
fi fi
echo $v > tmp1 echo $v > tmp1
cat dodgy_vols tmp1 > tmp2 cat dodgy_vols tmp1 > tmp2
cat tmp2 > dodgy_vols cat tmp2 > dodgy_vols
rm tmp* -f
vol=`expr $vol + 1` vol=`expr $vol + 1`
done done
echo "addpath('/usr/people/dtiuser/etc/FMRIB_bvals_bvecs/')">tmp3 echo Removing dodgy volumes from bvals and bvecs
echo "remove_vols('$current_dir')">tmp4 matlab -nodisplay -nojvm -nosplash 1> matlab.out1 2>&1 <<EOF
cat tmp3 tmp4 >tmp.m addpath('/usr/people/dtiuser/etc/FMRIB_bvals_bvecs/');
cat tmp.m | matlab remove_vols('$current_dir');
rm tmp* -f exit
EOF
rm matlab.out1 -f
echo "Merging Volumes" echo "Merging Volumes"
avwmerge -t $output_file vol*.hdr avwmerge -t $output_file `$FSLDIR/bin/imglob -oneperimage vol*`
rm vol* -f rm vol* -f
rm dodgy_vols -f rm dodgy_vols -f
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment