From b1c90ed9438a476e25d32250aabaa3644ba9ca89 Mon Sep 17 00:00:00 2001
From: Nicola Vigano <nicola.vigano@esrf.fr>
Date: Wed, 21 Jan 2015 14:34:42 +0100
Subject: [PATCH] 6D-Volume Downsampling: implemented in the algorithm factory

Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr>
---
 .../gtRecGrainsDefaultParameters.m            |  5 ++++-
 .../Gt6DReconstructionAlgorithmFactory.m      | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/5_reconstruction/gtRecGrainsDefaultParameters.m b/5_reconstruction/gtRecGrainsDefaultParameters.m
index 7d802853..8931aedb 100644
--- a/5_reconstruction/gtRecGrainsDefaultParameters.m
+++ b/5_reconstruction/gtRecGrainsDefaultParameters.m
@@ -11,8 +11,11 @@ function par_rec = gtRecGrainsDefaultParameters(algo)
                 'options', []);
 
         case {'6DL1', '6DTV', '6DTVL1'}
+            par_6D_rec_opts = struct( ...
+                'grid_edge', 7, 'super_sampling', 1, 'num_interp', 1, ...
+                'lambda', 1e-1, 'volume_downscaling', 1);
             par_rec = struct(...
                 'algorithm', upper(algo), 'num_iter', 50, 'list', [], ...
-                'options', struct('grid_edge', 7, 'super_sampling', 1, 'num_interp', 1, 'lambda', 1e-3) );
+                'options',  par_6D_rec_opts);
     end
 end
diff --git a/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m b/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m
index f567806c..9b797134 100644
--- a/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m
+++ b/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m
@@ -6,6 +6,8 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
 
         det_index = 1;
 
+        volume_downscaling = 1;
+
         parameters;
     end
 
@@ -211,6 +213,22 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
                 volume_size = self.getVolSize(blob_size, self.vol_type);
             end
 
+            if (self.volume_downscaling > 1)
+                volume_size = round(volume_size / self.volume_downscaling);
+                for ii = 1:num_geoms
+                    geometries{ii}(:, 4:12) = geometries{ii}(:, 4:12) / self.volume_downscaling;
+                end
+                if (~isempty(geometries_ss))
+                    for ii = 1:num_geoms
+                        geom_ss = geometries_ss{ii};
+                        for ii_ss = 1:numel(geom_ss)
+                            geom_ss{ii_ss}(:, 4:12) = geometries{ii}(:, 4:12) / self.volume_downscaling;
+                        end
+                        geometries_ss{ii} = geom_ss;
+                    end
+                end
+            end
+
             fprintf('Creating initial volumes: ')
             c = tic();
             zero_volumes = cell(num_geoms, 1);
@@ -227,6 +245,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
                 'ss_geometries', geometries_ss, ...
                 'ss_offsets', offsets_ss, ...
                 'use_astra_projectors', true, ...
+                'volume_ss', self.volume_downscaling, ...
                 varargin{:} );
         end
     end
-- 
GitLab