Dear Griselda,
> I have converted a set of Interfile SPECT images to Analyze format using
> the MRIcro program. The original images had negative values outside the
> brain, which have been preserved after the conversion.
> I would now like to convert those values to zero before performing
> statistical analyses on the data using SPM. Does anyone know of a good
> way to do that? I fear that if I leave the negative values unchanged,
> these could influence the global normalization using proportional
> scaling.
You could use some code like:
P = spm_get(Inf, 'img', 'Images to remove -ve values');
VP = spm_vol(P);
for i = 1:length(VP)
img = spm_read_vols(VP(i));
img(img < 0) = 0;
spm_write_vol(VP(i), img);
end
Best,
Matthew
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|