AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
bob cox
December 16, 2002 08:06PM
"3dcalc -help" is the only real documentation for this program. (BTW, you can peruse all the "-help" outputs formatted as Web pages from this page:
[afni.nimh.nih.gov]
which is linked to from the main AFNI page.)

If you want to extract just the voxels with a particular value, say 3, the "bool" function is best. For this example, something like
3dcalc -a zzz+orig -expr 'a*(1-bool(a-3))' -prefix zzz3 -nscale
will do the trick. Since bool(a-3)=0 when a=3 and =1 when a isn't 3, then 1-bool(a-3) is 1 when a=3 and 0 otherwise. Multiplying 1-bool(a-3) by a again makes the result equal to 3 (if you just want a 0-1 mask, you can replace the expression by '1-bool(a-3)'.

A little thought should show you how to use the step() function to select ranges of values. For example, 'step(a-2)*step(6-a)' will be 1 for a>2 and for a<6, which is to say for a=3, 4, or 5.

bob cox
Subject Author Posted

step(x) function in 3dcalc

Christine Smith December 16, 2002 07:08PM

Re: step(x) function in 3dcalc

bob cox December 16, 2002 08:06PM