public static double CalculateNorm (Bitmap bitmap) {
ComplexF[] matrix = GetImageFFTArray(bitmap);
double norm = 0;
int size_x = 4; //ARGB values
int size_y = bitmap.Width;
int size_z = bitmap.Height;
for (int x=1; x<=size_x; x++) {
double norm_y = 0;
for (int y=1; y<=size_y; y++) {
double norm_z = 0;
for (int z=1; z<=size_z; z++) {
ComplexF cur = matrix[(size_x-x)+size_x*(size_y-y)+size_x*size_y*(size_z-z)];
norm_z += cur.GetModulusSquared ();// * z;
}
norm_y += norm_z;// * y;
}
norm += norm_y;// * x;
}
return norm;
}