Hi,
How about something like that:
flnm='yourfile'
fllst=''
cnt=0
startvol=0
while [ $cnt -lt 28 ]
do
cmean="mnimg_$startvol"
fllst="$fllst $cmean"
fslroi $flnm tmp_3vol $startvol 3
fslmaths tmp_3vol -Tmean $cmean
cnt=$(($cnt+1))
startvol=$(($startvol+3))
done
rm tmp_3vol*
fslmerge -t out_series $fllst
I hope this gives the output you want (i did not test it though ;-) ).
good luck,
wolf
On 07/21/2010 05:59 PM, Moran Artzi wrote:
> Hi,
> I have a 4D image with 84 repetitions and I want to create a new 4D file with only 28 volumes whereas each one of the "new" volumes is the mean value of 3 "old" volumes
> i.e.
> mean(old-vol_1; old-vol_2; old-vol_3) = new-vol_1
> mean(old-vol_4; old-vol_5; old-vol_6) = new-vol_2
>
> In there any way to do this (from fsl command line) ?
>
> Many thanks
> Moran
>
|