Hi,
fslmaths img.nii.gz -sub `fslstats img.nii.gz -R | cut -d " " -f 1` newimg.nii.gz
would do the trick. Or
V=`fslstats img.nii.gz -R | cut -d " " -f 1`
fslmaths img.nii.gz -sub $V newimg.nii.gz
Both of these would make the range 0 to 31 (note that you need
to *subtract* -9, not add it). To make it, instead, 1 to 32 you'd just
have "-add 1" in the line too.
To do something with twice the value you can do:
V2=`echo "$V * 2" | bc -l`
and then use $V2 instead of $V.
For more explanation and tips on scripting, have a look at:
http://www.fmrib.ox.ac.uk/fslcourse/lectures/scripting/index.html
All the best,
Mark
On 17 May 2011, at 17:21, Moran Artzi wrote:
> Dear experts,
>
> I have images with dynamic range of (i.e.) ( -9) to (+22).
> I want to shift this image to POSITIVE values only.
> The Value need to be add calculated as:
> V=`fslstats img.nii.gz -R | cut -d " " -f 1`
> How can I integrate this value in order to null my image (i.e. add the V value)?
> How can I add or subtract the value V*2?
>
> Many thanks
> Moran
>
|