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)',{[],[],'float32',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
-------------------------------------------------------
|