I am reading both lists, so here we go: you will have to check details,
but roughly it would work like this:
% This code is for SPM5
% get Volume info for original image)
Vin = spm_vol(spm_select);
% Vin.pinfo now holds scaling/other intensity info, see help for spm_vol
% read data into matrix
X = spm_read_vols(Vin);
% prepare output volume
Vout = rmfield(Vin,'private');
Vout.fname = 'my_new_fname.img';
Vout.dt(1) = spm_type('float32'); % or 'float64' - see spm_type for datatypes
Vout.pinfo(1) = 1; % set scaling to 1
Vout = spm_write_vol(Vout, X);
On Wed, 8 Mar 2006, Ged Ridgway wrote:
> Mark Jenkinson wrote:
> > Dear Ged,
> >
> > I'm a little confused here.
> > The glmax field in an Analyze image doesn't have a concrete definition
> > and is often unrelated to the actual range of intensity values contained
> > in the image. Do you know what the range of values are that are
> > contained
> > in the raw file (unscaled) - easily obtained using avwstats - versus the
> > range of values that SPM uses (scaled)?
>
> Hope the following helps:
>
> avwstats img -R
> 0.000000 28735.000000
>
> avwhd img | grep glmax
> glmax 32767
>
> avwhd img | grep unused
> unused1 0
> funused1 0.0000
> funused2 0.0000
> funused3 0.0000
>
> SPM5 display:
> Intensity Y = 3.0515e-05 X
>
> Max, taken roughly from display (can't see a sensible way of getting the stats
> from spm5, or even loading the volume into a matrix)
> 0.9 so roughly consistent with 28735*3.0515e-05
--
Volkmar Glauche
-
Department of Neurology [log in to unmask]
Universitaetsklinikum Freiburg Phone 49(0)761-270-5331
Breisacher Str. 64 Fax 49(0)761-270-5416
79106 Freiburg
|