June 01, 2010

SPM99 Gem 3: NaNing zero values

Subject: Re: normalization of contrast images
From: John Ashburner 
Date: Wed, 2 Aug 2000 14:37:38 +0100 (BST)
To: spm@mailbase.ac.uk, gpagnon@emory.edu
  

[...]

| And, while I am at it, does anybody know how to convert a mask that
| has zeros outside the brain to a mask that has NaN outside the brain?
| I tried ImCalc with something like 'i1(find(i1==0))=NaN', but it
| doesn't like it.

By default, ImCalc outputs the data as 16 bit integer with scalefactors.
There is no NaN representation for this, so the data would need to be
written as floating point or double precision floating point.  I think
you can do this by typing something like:
        P     = spm_get(1,'*.img');
        Q     = 'output.img';
        f     = 'i1.*(i1./i1)';
        flags = {0,0,spm_type('float'),1};
        spm_imcalc_ui(P,Q,f,flags);

Best regards,
-John
  

Note you can NaN-out voxels below a threshold, say, 3:

f = 'i1 + 0./(i1>3)'

Also note that this is a general way for making spm_imcalc write out images with float or double precision; concisely

f = 'sqrt(i1)'; % whatever you like
spm_imcalc_ui('in.img','out.img',f,{[],[],spm_type('float')});

Using  [],[] instead of  0,0 ensures that default values will be used for those two flags.


- No comments Not publicly viewable


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

Search this blog

Tags

Most recent comments

  • Hi, Folks, conversion to HTML still works for PPT 2011 under OS 10.10 (as on my computer), with coup… by Andrew Fisher on this entry
  • HTML pages are different from PPT. It is possible to convert PPT in HTML page but it will create a p… by Ramjas on this entry
  • Hi This doesn't really address the issue at hand (powerpoint to html), but an alternative and very e… by Rose on this entry
  • @Michael. You are a SAINT. BLESS. by emma riley on this entry
  • I look this up every couple of years, and always struggle with it, so here are some notes for improv… by johann beda on this entry

Blog archive

Loading…
Not signed in
Sign in

Powered by BlogBuilder
© MMXIX