First, I used the Outer function to generate an image.
img = Abs[Cos[\[Pi]^2 Outer[Plus, Range[-1, 1, 0.002]^2, 2 Range[-1, 1, 0.002]^2]]]; // AbsoluteTiming
Image[img]
Then, I set the region outside the unit disk equals 0. This step costs 4.6045 seconds.
{Nx, Ny} = Dimensions[img]
imgCircle = Table[If[(i - Nx/2)^2 + (j - Ny/2)^2 > (Nx/2)^2, f[i, j] = 0, f[i, j] = img[[i, j]]], {i, 1, Nx}, {j, 1, Ny}]; // AbsoluteTiming
Is there a faster way to get the round sub-area of an image?