or instead just load the data into matlab using the SPM routines
(spm_read_vols) and save the data out again using the FSL functions
installed on your system in ${FSLDIR}/etc/matlab
e.g. save_avw(X,'filename','f',[ 3 3 6 3])
saves the data as a 4d file with voxel dims of 3x3x6 and a TR of 3
This way it will automatically write the data using the file type
specified in your environment variable FSLOUTPUTTYPE.
cheers
christian
On 9 Mar 2006, at 08:35, Volkmar Glauche wrote:
> 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
--
Christian F. Beckmann
Oxford University Centre for Functional
Magnetic Resonance Imaging of the Brain,
John Radcliffe Hospital, Headington, Oxford OX3 9DU, UK
Email: [log in to unmask] - http://www.fmrib.ox.ac.uk/~beckmann/
Phone: +44(0)1865 222551 Fax: +44(0)1865 222717
|