From 24b37e9acbfa2ac04c5bc36eb30923ab4bc01de6 Mon Sep 17 00:00:00 2001 From: Nicola Vigano <nicola.vigano@esrf.fr> Date: Mon, 30 Jan 2017 23:54:56 +0100 Subject: [PATCH] 6D-Reconstruction: Implemented use of latest developments in blobs<->sinos transforms Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr> --- zUtil_Deformation/Gt6DVolumeToBlobProjector.m | 83 +++++++++++++++++-- 1 file changed, 74 insertions(+), 9 deletions(-) diff --git a/zUtil_Deformation/Gt6DVolumeToBlobProjector.m b/zUtil_Deformation/Gt6DVolumeToBlobProjector.m index 6ed02ea8..60aea74e 100644 --- a/zUtil_Deformation/Gt6DVolumeToBlobProjector.m +++ b/zUtil_Deformation/Gt6DVolumeToBlobProjector.m @@ -9,12 +9,18 @@ classdef Gt6DVolumeToBlobProjector < Gt6DVolumeProjector bwd_weights = {}; blob_sinogram_c_functions = true; + + have_multi_sino_functions = false; end methods (Access = public) function self = Gt6DVolumeToBlobProjector(vols_size, detector_size, blobs_depths, varargin) self = self@Gt6DVolumeProjector(vols_size, detector_size, varargin{:}); + self.have_multi_sino_functions = ... + (exist('gt6DMultipleSinosToBlobs_c', 'file') == 3) ... + && (exist('gt6DBlobsToMultipleSinos_c', 'file') == 3); + self.blobs_depths = blobs_depths; end @@ -78,10 +84,14 @@ classdef Gt6DVolumeToBlobProjector < Gt6DVolumeProjector num_orients = numel(n); if (num_orients > 1) - bs_time = 0; - for ii_o = 1:num_orients - [blobs, bs_time_o] = self.process_sino_fwd(blobs, sino{ii_o}, n(ii_o)); - bs_time = bs_time + bs_time_o; + if (self.blob_sinogram_c_functions && self.have_multi_sino_functions) + [blobs, bs_time] = self.process_sinos_fwd(blobs, sino, n); + else + bs_time = 0; + for ii_o = 1:num_orients + [blobs, bs_time_o] = self.process_sino_fwd(blobs, sino{ii_o}, n(ii_o)); + bs_time = bs_time + bs_time_o; + end end else [blobs, bs_time] = self.process_sino_fwd(blobs, sino, n); @@ -95,11 +105,15 @@ classdef Gt6DVolumeToBlobProjector < Gt6DVolumeProjector num_orients = numel(n); if (num_orients > 1) - sino = cell(num_orients, 1); - bs_time = 0; - for ii_o = 1:num_orients - [sino{ii_o}, bs_time_o] = self.process_sino_bwd(blobs, n(ii_o)); - bs_time = bs_time + bs_time_o; + if (self.blob_sinogram_c_functions && self.have_multi_sino_functions) + [sino, bs_time] = self.process_sinos_bwd(blobs, n); + else + sino = cell(num_orients, 1); + bs_time = 0; + for ii_o = 1:num_orients + [sino{ii_o}, bs_time_o] = self.process_sino_bwd(blobs, n(ii_o)); + bs_time = bs_time + bs_time_o; + end end else [sino, bs_time] = self.process_sino_bwd(blobs, n); @@ -135,6 +149,26 @@ classdef Gt6DVolumeToBlobProjector < Gt6DVolumeProjector bs_time = toc(c); end + function [blobs, bs_time] = process_sinos_fwd(self, blobs, sinos, ns) + % Here we add the individual sinograms to the blobs + + if (self.using_super_sampling()) + offs = self.ss_offsets(ns); + else + offs = self.offsets(ns); + end + + c = tic(); + try + blobs = gt6DMultipleSinosToBlobs_c(... + blobs, sinos, offs, self.num_threads); + catch mexc + fprintf('Error raised by one of orientations:%s\n', sprintf(' %d', ns)) + rethrow(mexc) + end + bs_time = toc(c); + end + function [sino, bs_time] = process_sino_bwd(self, blobs, n) % Here we extract the individual sinograms from the blobs @@ -164,6 +198,37 @@ classdef Gt6DVolumeToBlobProjector < Gt6DVolumeProjector end bs_time = toc(c); end + + function [sino, bs_time] = process_sinos_bwd(self, blobs, n) + % Here we extract the individual sinograms from the blobs + + if (self.using_super_sampling()) + offs = self.ss_offsets(n); + geom = self.ss_geometries(n); + else + offs = self.offsets(n); + geom = self.geometries(n); + end + + num_orients = numel(n); + ones_n_ors = ones(num_orients, 1); + + sinogram_size = [ ... + self.proj_size(ones_n_ors, 1), zeros(num_orients, 1), self.proj_size(ones_n_ors, 2)]; + for ii_o = 1:num_orients + sinogram_size(ii_o, 2) = size(geom{ii_o}, 1); + end + + c = tic(); + try + sino = gt6DBlobsToMultipleSinos_c( ... + sinogram_size, blobs, offs, self.num_threads); + catch mexc + fprintf('Error raised by orientation: %d\n', n) + rethrow(mexc) + end + bs_time = toc(c); + end end methods (Access = public, Static) -- GitLab