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

6D-reconsturction: moved to the use of GtPSF for the PSF applications.


This now supports also asymmetric PSFs.

Signed-off-by: default avatarNicola Vigano <nicola.vigano@esrf.fr>
parent 473a8c6e
No related branches found
No related tags found
No related merge requests found
......@@ -103,6 +103,16 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
end
end
if (~isempty(self.psf))
fprintf('\b\b: Done. (%2.1f s)\n - Initializing PSF(s)..', toc(c))
c = tic();
for ii_p = 1:numel(self.psf)
psf_d = self.psf{ii_p};
self.psf{ii_p} = GtPSF();
self.psf{ii_p}.set_psf_direct(psf_d, proj_size);
end
end
fprintf('\b\b: Done. (%2.1f s)\n - Weights:\n', toc(c));
c = tic();
self.initializeWeights();
......@@ -222,7 +232,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
self.statistics.tic('cp_dual_update_detector');
proj_bls = self.compute_fwd_projection(nextEnhancedSolution);
[proj_bls, psf_time] = self.apply_psf(proj_bls);
[proj_bls, psf_time] = self.apply_psf(proj_bls, true);
self.statistics.add_timestamp(psf_time, 'cp_dual_update_detector', 'cp_dual_detector_PSF');
p = self.update_dual_detector(p, proj_bls, sigma1, sigma1_1);
self.statistics.toc('cp_dual_update_detector');
......@@ -268,7 +278,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
% Computing update primal
self.statistics.tic('cp_primal_update');
[p_blurr, psf_time] = self.apply_psf(p);
[p_blurr, psf_time] = self.apply_psf(p, false);
self.statistics.add_timestamp(psf_time, 'cp_primal_update', 'cp_primal_PSF');
nextEnhancedSolution = self.compute_bwd_projection(...
......@@ -633,7 +643,7 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
fprintf(' + Projecting ones vols..');
c = tic();
self.fwd_weights = self.getRowsSum();
self.fwd_weights = self.apply_psf(self.fwd_weights);
self.fwd_weights = self.apply_psf(self.fwd_weights, true);
fprintf('\b\b (%3.1f s)\n', toc(c));
fprintf(' + Computing back-projection weights..');
......@@ -735,14 +745,16 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
end
end
function [proj_data, psf_time] = apply_psf(self, proj_data)
function [proj_data, psf_time] = apply_psf(self, proj_data, is_direct)
if (~isempty(self.psf))
c = tic();
for n = 1:numel(proj_data)
if (numel(self.psf) == 1)
proj_data{n} = convn(proj_data{n}, self.psf{1}, 'same');
proj_data{n} = self.psf{1}.apply(proj_data{n}, is_direct);
% proj_data{n} = convn(proj_data{n}, self.psf{1}, 'same');
else
proj_data{n} = convn(proj_data{n}, self.psf{n}, 'same');
proj_data{n} = self.psf{n}.apply(proj_data{n}, is_direct);
% proj_data{n} = convn(proj_data{n}, self.psf{n}, 'same');
end
end
psf_time = toc(c);
......
......@@ -40,6 +40,16 @@ classdef GtPSF < handle
end
end
function imgs = apply(self, imgs, is_direct)
self.check_incoming_images(imgs);
if (self.use_otf)
imgs = self.apply_otf(imgs, is_direct);
else
imgs = self.apply_psf(imgs, is_direct);
end
end
function imgs = apply_psf_direct(self, imgs)
self.check_incoming_images(imgs);
......
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