# 3D Mean Filter: How is it computed?

Hi,

Could anyone expalin me how the 3D mean filter works in Fiji (ImageJ)?

In the ImageJ documentation the only description is: “3D filtering using ellipsoidal neighbourhood” I dont really get how it calculates the voxels in the kernel. (https://imagejdocu.tudor.lu/doku.php?id=plugin:filter:3d_filters:start)

How many voxels are taken in the kernel? And how are they calculated?

1 Like

Hello Pedro -

I assume that you are talking about the filter that is run from:
`Process > Filters > Mean 3D...`.

Let `xo`, `yo`, and `zo` be the integer voxel coordinates of the output
(filtered) voxel. Then the value of this voxel is given by the mean
of the input voxels with coordinates `xi`, `yi`, and `zi` for which

``````((xi - xo) / rx)^2 + ((yi -yo) / ry)^2 + ((zi - zo) / rz)^2 <= 1.
``````

That is, we average over the input voxels that lie in the ellipsoid
centered on the location of the output voxel that is aligned along
the `x`, `y`, and `z` directions and has axes of (half) lengths `rx`, `ry`,
and `rz`.

(You can find this in the `createKernelEllipsoid()` method of
StackProcessor.)

Thanks, mm

3 Likes