Hi Ben,
> Now, if I write the image all NaN's are converted to 0. The problem
> seems to be the datatype of the Image (int16). How can I change the
> datatype of the image to float. Changing the private part
> (V.private.dat.dtype) of the volume to FLOAT32-LE and adjusting the
> slope prior to saving is not working for me.
The datatype of the image is saved in the header. If you do
V = spm_vol(spm_select)
then V.dt encodes the format to write the image in (see spm_type.m for
further details, including the ability to represent NaN's). For example,
if you do
V = spm_vol(spm_select);
vol = spm_read_vols(V);
V.dt = [16 0];
[p nm e v] = spm_fileparts(V.fname);
V.fname = [p filesep 'float_' nm e];
spm_write_vol(V,vol);
then you change the datatype of the image you selected to float, which
is prepended to the original filename (or so I hope :) As the datatype
of the actual imaging data 'vol' has not changed, this of course does
not make much sense, but perhaps it gives you some hints.
Best,
Marko
--
=====================================================================
Marko Wilke (Dr.med./M.D.)
[log in to unmask]
Universitäts-Kinderklinik University Children's Hospital
Abt. III (Neuropädiatrie) Dept. III (Pediatric neurology)
Hoppe-Seyler-Str. 1, D - 72076 Tübingen
Tel.: (+49) 07071 29-83416 Fax: (+49) 07071 29-5473
=====================================================================
|