Skip to content
Snippets Groups Projects
Commit 6b6d40f7 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

PSF/OTF: fixed OTF application for the case where circular convolution might be an issue

parent 4abe1865
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ classdef GtPSF < handle
image_size = [];
use_otf = true;
otf_padding = 0;
data_type = 'single';
end
......@@ -95,11 +96,15 @@ classdef GtPSF < handle
num_psfs = size(psf, 2);
psf_edge = (size(psf, 1) - 1) / 2;
otf = zeros([self.image_size(1), num_psfs, self.image_size(2)], self.data_type);
self.otf_padding = psf_edge;
comp_img_size = [self.image_size(1) + 2 * psf_edge, ...
num_psfs, self.image_size(2) + 2 * psf_edge];
otf = zeros(comp_img_size, self.data_type);
center_otf = floor(self.image_size / 2) + 1;
lims_otf_lower = center_otf - psf_edge;
lims_otf_upper = center_otf + psf_edge;
lims_otf_lower = center_otf;
lims_otf_upper = center_otf + 2 * psf_edge;
otf(lims_otf_lower(1):lims_otf_upper(1), :, lims_otf_lower(2):lims_otf_upper(2)) = psf;
......@@ -152,6 +157,8 @@ classdef GtPSF < handle
end
function imgs = apply_otf(self, imgs, is_direct)
imgs = padarray(imgs, [self.otf_padding, 0, self.otf_padding]);
imgs = ifftshift(imgs, 1);
imgs = ifftshift(imgs, 3);
......@@ -177,6 +184,9 @@ classdef GtPSF < handle
imgs = fftshift(imgs, 3);
imgs = real(imgs);
imgs = imgs((self.otf_padding+1):(end-self.otf_padding), :, ...
(self.otf_padding+1):(end-self.otf_padding));
end
function imgs = apply_psf(self, imgs, is_direct)
......
......@@ -13,11 +13,11 @@ function [otf, psf] = gtOTFGetMeasured(opt, varargin)
% 8: for testing
% 9: for fits
% Optional Input:
% m : number of row samples
% n : number of column samples
% oversampling : samplerate is fixed by oversamp, sigmas expressed in pixels,
% changing n changes the width of the window and sampling rate
% in frequency space
% size : number of column/row samples
% oversampling : samplerate is fixed by oversampling, sigmas expressed in
% pixels, changing size changes the width of the window and sampling
% rate in frequency space
% p : user specified fitting parameters
%
% Derived from a modified version of the function: mncf from
% Wolfgang/Peter's matlab functions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment