Hi Bo
For what it's worth, I attach a script for normalizing the intensity
range of an image based on the robust range within a mask (which you
need to have prepared).
Usage:
scale-generic.sh image mask output
Hope that helps
Rolf
On 10 June 2012 14:50, Suchada Tantisatirapong <[log in to unmask]> wrote:
> Hi,
>
>
>
> I’m trying to normalize intensity of structural MRI images because these
> images are acquired from different scanner, generating with different
> intensity range.
>
>
>
> I use a simple math like:
>
>
>
> New_intensity = constant* (old_intensity – min_intensity)/(max_intensity –
> min_intensity)
>
>
>
> Does FSL offer any more advance technique for normalizing image intensity?
>
>
>
> Many thanks for your reply
>
> Bo
--
Rolf A Heckemann, MD PhD
Médecin chercheur, Fondation Neurodis
CERMEP - Imagerie du Vivant
Hôpital Neurologique Pierre Wertheimer
59 Boulevard Pinel
69003 Lyon
France
2nd affiliation: Honorary Fellow, Imperial College London
#!/bin/bash
# Scale intensity of atlas images to optimal range
# Determine robust range of atlas image within mask
# Rescale image to that range -- ie. map minimum to 0 and maximum to 4095
test -e /tmp/$USER || mkdir /tmp/$USER
td=$(mktemp -d /tmp/$USER/$(basename $0).XXXXXX) || exit 1
trap 'rm -rf $td' 0 1 15
img=$1 ; shift
msk=$1 ; shift
out=$1 ; shift
scale=4095
fslmaths $img $td/image -odt float
imcp $msk $td/mask
cd $td
read min max <<< $(fslstats image -k mask -r)
fslmaths image -thr $max -bin -mul $scale peaks
fslmaths image -sub $min -thr 0 -mul $scale -div $(echo $max - $min | /usr/bin/bc ) -uthr $scale -add peaks out
cd -
imcp $td/out $out
|