I have an image, which has an inherent mask built into it. The exact shape isn't super important, but it looks something like a circ multiplied by a rect. I would like to calculate the 2D Fourier transform of only the masked region. If I calculate the Fourier transform over the full image it will have spatial frequencies associated with the mask, not the underlying image. Does anyone know how to do this?
I don't think what you're asking for is possible. If you take the Fourier transform with the existing mask / window function you're going to get the spectral content of the underlying image convolved with the spectral response of the mask due to multiplication in the time domain being equivalent to convolution in the frequency domain.
An alternative is to take the Fourier transform or a subset of the masked image, but this will just result in what is effectively a new mask being applied to the underlying image.