> The traditional approach of storing all volume masks in a standard AFNI .HEAD/.BRIK file format would take much space (1e5 full-brain subbrik volumes, which would mean about 10-100GB of data using bytes) and is inefficient as almost all values would be zero (not in the mask).
Using compression works extremely well with masks. (I think gzip includes run-length compression) For example a compressed mask can save 98.9% of disk space compared to an uncompressed mask:
3dcalc -datum byte -a TT_icbm452+tlrc. -expr 'step(a)'
++ 3dcalc: AFNI version=AFNI_2008_07_18_1710 (Jul 14 2009) [64-bit]
++ Authored by: A cast of thousands
++ Output dataset ./calc+tlrc.BRIK
gzip -v calc+tlrc.BRIK
calc+tlrc.BRIK: 98.9% -- replaced with calc+tlrc.BRIK.gz
--judd