Fourier transform of multiple ROI not working

3 views (last 30 days)
The for loop plots 30 ROI on my image, calculates the FFT of an demeaned ROI, and stores it in a 3D matrix. I then average and normalize all my fft transformed ROIs. However, when i go to plot my image, I am not sure what I am doing wrong here. My plot should be donut shaped.
for i = 1:nROI
rectBW = createMask(drawrectangle(gca, 'Position', [x1(i),y1(i),ROIsize,ROIsize]));
roi = NoiseImg1;
roi(rectBW == 0) = 0;
r = mean(roi);
demean_roi = roi - r;
NPS1 = fftshift(fft2(demean_roi)).^2;
NPSdata1(:,:,i) = NPS1;
end
avgNPS1 = mean(NPSdata1,3) .* (voxelspace(1)^2/(ROIsize^2));
figure; %Nx = Ny = image size, fs = 1/pixelsize
imagesc([-(fs/2) (fs/2) * (Nx-2)/Nx], [-(fs/2) (fs/2) * (Ny-2)/Ny], abs(avgNPS1)); colorbar; colormap hot;
title('NPS 1 (mm^2*HU^2)'); axis image;
xlabel('Spatial Frequency in X (mm^{-1})'); ylabel('Spatial Frequency in Y (mm^{-1})');

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!