Hello ITK,

i want to compute “spatial frequency” for wavelet. In these publication (DOI: 10.17694/bajece.24838,H. Boztoprak ) they define it as:

with M, N the voxel indice and F his value.

So i create a code like this which is suboptimal.

```
def SpatialFrequency(image):
SizeMatrix=image.GetSize()
Square_diff_x=0
Square_diff_y=0
Square_diff_z=0
Nvoxel=0
for x in range(SizeMatrix[0]-1):
for y in range(SizeMatrix[1]-1):
for z in range(SizeMatrix[2]-1):
Square_diff_x=Square_diff_x+(image.GetPixel(x+1,y,z)-image.GetPixel(x,y,z))**2
Square_diff_y=Square_diff_y+(image.GetPixel(x,y+1,z)-image.GetPixel(x,y,z))**2
Square_diff_z=Square_diff_z+(image.GetPixel(x,y,z+1)-image.GetPixel(x,y,z))**2
Nvoxel=Nvoxel+1
SF=(Square_diff_x/(Nvoxel)+Square_diff_y/(Nvoxel)+Square_diff_z/(Nvoxel))**0.5
return SF
```

can you help me to improve it?

Thank you,

Cyril Jaudet