Hi Colm,
Attached is a script a signal processing specialist wrote for us. We
acquired DWI (b=0) and DTI scans, so the script combines the two and
changes the format.
I hope it makes sense.
Suzanna
# !/bin/bash
#
#
# ./process_all.txt dir dti_fname dwi_fname n_slices n_frames
#
# $1: dir: full data directory
# $2: dti_fname: Philips raw images assumes .REC extension, in $1/raw
# $3: dwi_fname: Philips raw images assumes .REC extension, in $1/raw
# dwi has two frames only
# $4: number of slices
# $5: total number of frames in dti file
#
# output is $3.img, $3.hdr in $1/processed
#
pwdor=`pwd`
mkdir "$1"/processed
cd "$1"/processed
/bin/rm -r -f t*
fslcreatehd 128 128 2 "$4" 1.75 1.75 2.0 2.0 0.0 0.0 0.0 4 ttt1
cp ../raw/"$3".REC ttt1.img
fslsplit ttt1
fslcreatehd 128 128 1 2 1.75 1.75 2.0 2.0 0.0 0.0 0.0 4 ttt2
slind=0
while test $slind != 10
do
mkdir temp"$slind"
cd temp"$slind"
cp ../vol000"$slind".img "$slind".img
cp ../ttt2.hdr "$slind".hdr
fslsplit "$slind"
cd ../
slind=`echo $slind + 1 |bc`
done
while test $slind != $4
do
mkdir temp"$slind"
cd temp"$slind"
cp ../vol00"$slind".img "$slind".img
cp ../ttt2.hdr "$slind".hdr
fslsplit "$slind"
cd ../
slind=`echo $slind + 1 |bc`
done
frameind=0
while test $frameind != 2
do
slind=0
while test $slind != $4
do
cat temp"$slind"/vol000"$frameind".img >> trash_big.img
slind=`echo $slind + 1 |bc`
done
frameind=`echo $frameind + 1 |bc`
done
/bin/rm -r -f temp* ttt* vol*
fslcreatehd 128 128 "$5" "$4" 1.75 1.75 2.0 2.0 0.0 0.0 0.0 4 ttt1
cp ../raw/"$2".REC ttt1.img
fslsplit ttt1
fslcreatehd 128 128 1 "$5" 1.75 1.75 2.0 2.0 0.0 0.0 0.0 4 ttt2
slind=0
while test $slind != 10
do
mkdir temp"$slind"
cd temp"$slind"
cp ../vol000"$slind".img "$slind".img
cp ../ttt2.hdr "$slind".hdr
fslsplit "$slind"
cd ../
slind=`echo $slind + 1 |bc`
done
while test $slind != $4
do
mkdir temp"$slind"
cd temp"$slind"
cp ../vol00"$slind".img "$slind".img
cp ../ttt2.hdr "$slind".hdr
fslsplit "$slind"
cd ../
slind=`echo $slind + 1 |bc`
done
framemax=`echo $5 - 1 |bc`
frameind=0
while test $frameind != 10
do
slind=0
while test $slind != $4
do
cat temp"$slind"/vol000"$frameind".img >> trash_big.img
slind=`echo $slind + 1 |bc`
done
frameind=`echo $frameind + 1 |bc`
done
while test $frameind != $framemax
do
slind=0
while test $slind != $4
do
cat temp"$slind"/vol00"$frameind".img >> trash_big.img
slind=`echo $slind + 1 |bc`
done
frameind=`echo $frameind + 1 |bc`
done
/bin/rm -r -f temp* ttt* vol*
framemax=`echo $5 + 1 |bc`
fslcreatehd 128 128 "$4" "$framemax" 1.75 1.75 2.0 2.0 0.0 0.0 0.0 4 ttt
mv ttt.hdr trash_big.hdr
eddy_correct trash_big r"$2" 0
/bin/rm -r -f t*
cd "$pwdor"
On 21 Dec 2007, at 12:12, Colm G. Connolly wrote:
> On 21 Dec 2007, at 12:15, Diana Tordesillas Gutiérrez wrote:
>
>> Thank you Suzanna for your fast reply, I found the discussion
>> about nii
>> files. Just one more question, when using the par/rec files, how
>> do you
>> get the bvecs from the scanner?
>
>
> You may need to get these from your physicist or from the Philips
> clinical support specialist. You'll need to know whether overplus
> was on or not when the images were acquired as the vectors are
> different when it's on versus when it's off.
> The bvalues are in the PAR files. The bvecs may or may not be in
> the PAR files depending on your software release.
>
> Susanna, would you mind telling me how you use fslcreatehd to
> convert to analyze format? Currently we use AFNI's to3d to create
> NIfTII files and then use 3drefit to change them into the
> orientation FSL likes.
>
> Regards,
> --
> Dr Colm G. Connolly
> School of Psychology and Institute of Neuroscience
> The Lloyd Building
> University of Dublin
> Trinity College, Dublin 2, Éire
> Fax: +353-1-671-3183
|