Pawel-
Just to note some 3dcalc-isms that might help in your merging (though I reiterate that I am not recommending going down this route):
This would merge 2 dsets, DSET1 and DSET2, giving DSET1 "preference in the merging---that is, take DSET1's values, and in places where DSET1 is zero, fill in with DSET2's values:
3dcalc \
-a DSET1 \
-b DSET2 \
-expr 'a+ not(a)*b' \
-prefix DSET_MERGED
This would do the same thing, offsetting DSET2's values by some constant like 500, with that chosen under the assumption that the max of DSET1 is less than 500 (which could be found with, say, "3dinfo"):
3dcalc \
-a DSET1 \
-b DSET2 \
-expr 'a+ not(a)*(500+b)' \
-prefix DSET_MERGED
--pt