I am sorry but I have another question rather than an answer to this issue.
Masking with the unsmoothed image will not preserve totals because those
elements smoothed outside the mask will be subsequently masked away and
converted to NaNs. Does anybody know a way around this issue. In
particular dealing with data with large lesions. If you mask the lesion out
then the non-lesion voxels resulting from smoothing will be affected by
zeros. If you leave the lesion in then the smoothed results will be
affected by misclassified lesion voxels.
Best wishes
Simon
************************************************************
Mr P Simon Jones
Computer Associate
University of Cambridge Department of Clinical Neurosciences
R3 Neurosciences - Box 83
Addenbrooke's Hospital
Hills Road
Cambridge CB2 2QQ UK
Direct Tel: +44 (0)1223 216082
Tel: +44 (0)1223 586661
Fax: +44 (0)1223 217909
-----Original Message-----
From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]] On
Behalf Of Rik Henson
Sent: 12 January 2009 13:22
To: [log in to unmask]
Subject: Re: [SPM] Retaining NaN's after smoothing
Dear Rik -
Together with Volkmar's reminder about changing the default data format for
spm_imcalc to one that allows NaN, I have found the following equation for
imcalc to seem to work for re-inserting NaN's into an image after smoothing:
% Given Pin as original image filename (eg Pin=spm_select;)...
[pth,nam,ext] = fileparts(Pin); Pout = fullfile(pth,['s' nam ext]);
spm_smooth(spm_vol(Pin),Pout,[5 5 10]);
spm_imcalc_ui(strvcat(Pin,Pout),Pout,'((i1+eps).*i2)./(i1+eps)',{[],[],'floa
t32',0});
But there must be a simpler way, and if someone knows it, do let the list
know!
Best wishes
Rik
;-)
Volkmar Glauche wrote:
> Dear Rik,
>
> what is the data type of your images? To get NaNs in imcalc, the
> output image must be a float/double data type - the integer data types
> don't have a NaN representation. If you used the batch system for
> running smooth and imcalc, you can select the output data type. The
> default for imcalc is "int16", which you need to change in order to
> get the NaNs back.
>
> Volkmar
>
> Quoting Rik Henson <[log in to unmask]>:
>
>> Dear colleagues -
>>
>> I've been pulling out (what's left of) my hair for the last hour...
>> does anyone know an easy way to retain NaNs after smoothing an image
>> that contains NaNs (outside a single contiguous object)? I've been
>> trying spm_smooth followed by spm_imcalc_ui with the original image
>> as a mask, with no luck. What's really annoying me is that I'm sure I
>> found an easy way once before. I did search and find this email from
>> Christian:
>>
>> https://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=ind06&L=SPM&P=R817015
>>
>> but not sure this is what I need, and there must be a simpler way?
>>
>> Rik
>>
>> --
>>
>> -------------------------------------------------------
>>
>> DR RICHARD HENSON MRC Cognition & Brain Sciences Unit
>> 15 Chaucer Road
>> Cambridge, CB2 7EF
>> England EMAIL: [log in to unmask]
>> URL: http://www.mrc-cbu.cam.ac.uk/people/rik.henson/personal
>>
>> TEL +44 (0)1223 355 294 x522
>> FAX +44 (0)1223 359 062
>> MOB +44 (0)794 1377 345
>>
>> -------------------------------------------------------
--
-------------------------------------------------------
Dr Richard Henson
MRC Cognition & Brain Sciences Unit
15 Chaucer Road
Cambridge
CB2 7EF, UK
Office: +44 (0)1223 355 294 x522
Mob: +44 (0)794 1377 345
Fax: +44 (0)1223 359 062
http://www.mrc-cbu.cam.ac.uk/people/rik.henson/personal
-------------------------------------------------------
|