3dcalc not allow enough variables

Hi AFNI experts,

I tried to overlay one hundred masks by using 3dcalc -a1 “image1” -a2 “image2” …-a100 “image100” expr ‘a1+a28…+a100100’ -prefix overlay
However, 3dcalc only takes -a…-z for input files but not ‘a1’. How can I get around the small allowable variable number (26 from a to z) and combine one hundreds masks. Suggestions are appreciated.


Hi Veda,

I do not see any benefit to multiplying each mask by a different scalar.
The main gain of that might be to be able to evaluate combinations of
masks based on the binary representation of the sum, combining
values up to 2^100 is not feasible. So I would expect that just counting
masks at each voxel might be the most useful option.

Assuming that, consider using “3dmask_tool -count”, as is done in
example 3c, say:

3dmask_tool -input full_mask.*+tlrc.HEAD -prefix mask.counts -count

Does that seem reasonable? The 3dmask_tool -help for other options.

  • rick

Thanks Rick. It worked perfectly.