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};

Best regards,

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

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


Most recent comments

  • I love this quote: "Complete reporting of results, i.e. filing of statistical maps in public reposit… by Kevin Black on this entry
  • Taylor: I've just quickly scanned the BrainVoyager documentation, and it appears that the Cluster–Le… by Thomas Nichols on this entry
  • Cindy, I can see you didn't like my comments but I didn't get based on what you deemed them outrageo… by Yolanda on this entry
  • Thomas, Could you comment on the applicability of your findings to BrainVoyager's Cluster–Level Stat… by Taylor on this entry
  • Here is a sample of recent corrections from PNAS, collated by Mike Angstadt. Correction for Crockett… by Thomas Nichols on this entry

Blog archive

Not signed in
Sign in

Powered by BlogBuilder