Integral over solid angle in Cartesian coordinates I have an integral that is an average of some (unknown) function $f$ over solid angle:
$$\bar{f} = \frac{1}{4\pi} \iint\limits_\Omega f \sin\theta~\mathrm{d}\theta~\mathrm{d}\phi$$
I use the physics convention where $\theta$ is the polar angle and $\phi$ is the azimuthal angle.
For computational reasons, it would be useful to recast this as a volume integral in Cartesian coordinates (the exact reasons are somewhat out of the scope of this question).
My hangup is that I essentially want to recast a surface integral as a volume integral. The divergence theorem comes to mind, but I'm not sure how to do the transformation without making any assumptions about $f$.
My attempt:
If we write the equation as
$$ \bar{f} = \frac{1}{4\pi} \iint\limits_S f \left(\frac{\hat{r} \cdot \hat{n}}{r^2}\right) \mathrm{d}S $$
for a surface $S$ (a formula I found here), we could define $\vec{F} = f \hat{r} / r^2$ and then use the divergence theorem to write as a volume integral. Does this make any assumptions about $f$? What exactly is the surface $S$ in this context?

The most obvious choice for the surface is a sphere of radius $1$. For the sphere $\hat n=\hat r$, so $\hat r\cdot\hat n=1$. Also $r=1$, so $1/r^2=1$ on the surface. Note that you still want to use your expression for $\vec F$.
