Hi Jerome,
You will probably have to manually round the SPM image. Rounding in imcalc
[e.g round(i1 .* (i1>=0))] may not be sufficient for whatever reason.
You can use a little piece of code like that:
V = spm_vol('output.img');
VV = spm_read_vols(V);
VV = round(VV);
V.fname = ['int_' V.fname];
spm_write_vol(V,VV);
Then, you can check correctness of the operation using
clear V VV;
V = spm_vol('int_output.img');
VV = spm_read_vols(V);
unique(VV(find(VV)))
Finally, it appears that the SPM Display function does not show the real
voxel values due to its inner interpolation utility, but the image written
on disk will actually contains integers only.
Best,
Romain
> Hi All,
>
> we are trying to process labelled images using imcalc, but after
> processing, the resulting image does not keep integer values.
>
> here is an example of the function we use: i1 .* (i1>=0)
>
> We use Nearest neighbour interpolation
>
> resulting voxels have values of, for example 84.00009.
>
> Any suggestions on how to keep integer values?
>
> Thanks
>
> Jerome
>
>
>
>
>
> --
> ==================================================================
> Jérôme Redouté
> Ph.D. - Ingénieur de Recherche - Université Claude Bernard - Lyon1
> CERMEP - Imagerie du vivant
> 59 Bd Pinel. 69677 Bron - FRANCE
> tel : 33 (0)4 72 68 86 18 (bureau)
> tel : 33 (0)4 72 68 86 00 (standard)
> fax : 33 (0)4 72 68 86 10
> ==================================================================
>
|