From e4b78ed95112c658c8391a9a984b6fad27fadf4e Mon Sep 17 00:00:00 2001
From: Nicola Vigano <nicola.vigano@esrf.fr>
Date: Wed, 8 Apr 2015 18:50:38 +0200
Subject: [PATCH] 6D-Reconstruction: fixed yet another bug in the geometry
 determination at the 360<->0 w border

Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr>
---
 .../Gt6DReconstructionAlgorithmFactory.m      | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m b/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m
index a3a759d7..cbf2667d 100644
--- a/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m
+++ b/zUtil_Deformation/Gt6DReconstructionAlgorithmFactory.m
@@ -48,7 +48,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
             % We should use sub-w interpolation, especially for num_inerp=1
             [w_tab, ref_ws] = self.get_w_tab(grains_props, omegas);
 
-            [slice_lims, lims, abs_lims, extreemes_blobs_w, extreemes_projs_w] ...
+            [w_tab, slice_lims, lims, abs_lims, extreemes_blobs_w, extreemes_projs_w] ...
                 = self.get_sub_blob_lims(w_tab, bl, ref_ws, slices_interp, padding);
 
             [sub_blob_slices, proj_coeffs] = self.get_sub_blobs(bl, slices_interp, padding);
@@ -100,7 +100,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
 
                 orients_props_ss = self.get_selected_props(orients_props_ss, sel_incl_indx);
                 w_tab_ss = self.get_w_tab(orients_props_ss);
-                [slice_lims_ss, lims_ss, abs_lims_ss, extreemes_blobs_w_ss, extreemes_projs_w_ss] ...
+                [w_tab_ss, slice_lims_ss, lims_ss, abs_lims_ss, extreemes_blobs_w_ss, extreemes_projs_w_ss] ...
                     = self.get_sub_blob_lims(w_tab_ss, bl, ref_ws, slices_interp, padding);
 
                 [overflow_ss_b, overflow_ss_o] = self.compute_overflow(w_tab_ss, extreemes_blobs_w_ss);
@@ -191,6 +191,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
                     orient_props_ss = [orient_props_ss{:}];
                     orient_props_ss = self.get_selected_props(orient_props_ss, sel_incl_indx);
                     w_tab_oss = self.get_w_tab(orient_props_ss);
+                    w_tab_oss = self.fix_360_w_border(w_tab_oss, ref_ws);
                     [geometries_ss{ii}, offsets_ss{ii}] = self.makeSubBlobGeometries( ...
                         orient_props_ss, proj_coeffs, extreemes_blobs_w_tot, ...
                         w_tab_oss, abs_lims_tot, slice_lims_tot);
@@ -355,8 +356,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
             end
         end
 
-        function [sliceLims, lims, absLims, extreemes_blobs_w, extreemes_projs_w] ...
-                = get_sub_blob_lims(self, w_tab, bl, ref_int_ws, slices_interp, padding)
+        function w_tab = fix_360_w_border(self, w_tab, ref_int_ws)
             num_images = gtGetTotNumberOfImages(self.parameters);
 
             % Let's treat those blobs at the w edge 360->0
@@ -370,6 +370,11 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
                 - num_images .* (w_tab(gt_ref_int, :) > opposite_int_ws_repmat(gt_ref_int, :));
             w_tab(lt_ref_int, :) = w_tab(lt_ref_int, :) ...
                 + num_images .* (w_tab(lt_ref_int, :) < opposite_int_ws_repmat(lt_ref_int, :));
+        end
+
+        function [w_tab, sliceLims, lims, absLims, extreemes_blobs_w, extreemes_projs_w] ...
+                = get_sub_blob_lims(self, w_tab, bl, ref_int_ws, slices_interp, padding)
+            w_tab = self.fix_360_w_border(w_tab, ref_int_ws);
 
             % Let's add extreme values
             extreemes_projs_w = [ ...
@@ -390,11 +395,7 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
 
             % Let's treat those blobs at the w edge 360->0
             % (from the blobs perspective)
-            opposite_int_ws_repmat = opposite_int_ws(:, [1 1]);
-            extreemes_blobs_w(gt_ref_int, :) = extreemes_blobs_w(gt_ref_int, :) ...
-                - num_images .* (extreemes_blobs_w(gt_ref_int, :) > opposite_int_ws_repmat(gt_ref_int, :));
-            extreemes_blobs_w(lt_ref_int, :) = extreemes_blobs_w(lt_ref_int, :) ...
-                + num_images .* (extreemes_blobs_w(lt_ref_int, :) < opposite_int_ws_repmat(lt_ref_int, :));
+            extreemes_blobs_w = self.fix_360_w_border(extreemes_blobs_w, ref_int_ws);
 
             % Blob limits in the full omega stack
             absLims = [ ...
-- 
GitLab