Basically, you need the volume and surface area of a mask given that formula. Alternatively, you could probably generate a similar measure with volume, equivalent radius, and some count of voxels inside and outside the equivalent sphere. See this previous discussion on brain radius:
You can compute surface area by transform a volume or mask into a quick surface by using the command IsoSurface in AFNI. Then compute the nodal and total surface area with SurfMeasures as shown here.
IsoSurface -isorange 1 255 -input ~/abin/TT_N27+tlrc -o TT_N27_quicksurf.gii
quickspec -spec quick.spec -tn gii TT_N27_quicksurf.gii
SurfMeasures -spec quick.spec -surf_A TT_N27_quicksurf.gii -info_area -out area -overwrite -func n_area_A
----------------------------------------------------------
-- total area 0 = 100976.0
3dBrickStat -sum area.niml.dset'[1]'
100976
Also see these previous threads: