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
output_file=$2
current_dir=`pwd`
if [ ! -e $input_file.hdr ]; then
if [ ! `imtest $input_file` ]; then
echo Cant find $input_file
exit
fi
......@@ -36,7 +36,7 @@ if [ ! -e bvecs ]; then
exit
fi
avwsplit $input_file.hdr
avwsplit $input_file
vol=0
num_vols=`expr $# - 2`
......@@ -51,39 +51,31 @@ while [ $vol -lt $num_vols ]; do
v=$3
shift
if [ -e vol000${v}.hdr ]; then
rm vol000${v}.hdr -f
rm vol000${v}.img -f
if [ `imtest vol000${v}` ]; then
imrm vol000${v}
fi
if [ -e vol00${v}.hdr ]; then
rm vol00${v}.hdr -f
rm vol00${v}.img -f
if [ `imtest vol00${v}` ]; then
imrm vol00${v}
fi
echo $v > tmp1
cat dodgy_vols tmp1 > tmp2
cat tmp2 > dodgy_vols
rm tmp* -f
vol=`expr $vol + 1`
done
echo "addpath('/usr/people/dtiuser/etc/FMRIB_bvals_bvecs/')">tmp3
echo "remove_vols('$current_dir')">tmp4
cat tmp3 tmp4 >tmp.m
cat tmp.m | matlab
rm tmp* -f
echo Removing dodgy volumes from bvals and bvecs
matlab -nodisplay -nojvm -nosplash 1> matlab.out1 2>&1 <<EOF
addpath('/usr/people/dtiuser/etc/FMRIB_bvals_bvecs/');
remove_vols('$current_dir');
exit
EOF
rm matlab.out1 -f
echo "Merging Volumes"
avwmerge -t $output_file vol*.hdr
avwmerge -t $output_file `$FSLDIR/bin/imglob -oneperimage vol*`
rm vol* -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