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