added the condition if the window is all zeros, i.e. masked by the image preprocessing, then it returns velocity = 0.0, 0.0 and sig2noise = 0.0