Is there a filter that can be used to average slices?

In the following example, a user would be expected to have such a
filter. It takes the slices objects as input arguments the output
would be the spatial mean of them.

This filter would be good for scientific researchers who want to see
the spatial mean of some variables.