Just to add a little more, if what you want to do is calculate similarity rather than some overlap measure, you could also consider using 3dAllineate's -allcostX option. This option returns the cost metric value typically used for alignment. This option doesn't try to align but just reports the initial cost and exits. Several correlation type metrics are available along with mutual information metrics and many others. The values are made to be something that minimizes, so lower values or more negative values are more similar. These values will not match the values from 3ddot because of differences in masks, weights, smoothing and negating to make it minimize.
-allcostX = Compute and print ALL available cost functionals for the
un-warped inputs, and then quit.
-allcostX1D p q = Compute ALL available cost functionals for the set of
parameters given in the 1D file 'p' (12 values per row),
write them to the 1D file 'q', then exit.