From 45c1ed341f0bb5a10fbd1f7931458d34c228723f Mon Sep 17 00:00:00 2001
From: Nicola Vigano <nicola.vigano@esrf.fr>
Date: Fri, 8 Apr 2016 12:26:43 +0200
Subject: [PATCH] Gvdm-FwdProj: added single center projection support

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

diff --git a/zUtil_Deformation/gtDefFwdProjGvdm.m b/zUtil_Deformation/gtDefFwdProjGvdm.m
index 0a54b0e8..2784e7ab 100755
--- a/zUtil_Deformation/gtDefFwdProjGvdm.m
+++ b/zUtil_Deformation/gtDefFwdProjGvdm.m
@@ -65,10 +65,16 @@ function bl = gtDefFwdProjGvdm(grain, ref_sel, gv, fedpars, parameters, det_ind,
     num_oversampling = size(gv.d, 3);
     gvpow = gv.pow(1, uinds);
 
+    element_wise_gcs = size(gv.cs, 2) ~= 1;
+
     bl = gtFwdSimBlobDefinition('blob', nbl);
 
     for ii_ss = 1:num_oversampling
-        gvcs = gv.cs(:, uinds, ii_ss);
+        if (element_wise_gcs)
+            gvcs = gv.cs(:, uinds, ii_ss);
+        else
+            gvcs = gv.cs(:, 1, ii_ss);
+        end
 
         gvd = gv.d(:, uinds, ii_ss);
 
@@ -116,7 +122,7 @@ function bl = gtDefFwdProjGvdm(grain, ref_sel, gv, fedpars, parameters, det_ind,
             dvec_lab = gtFedPredictDiffVecMultiple(pllab, labgeo.beamdir');
 
             rot_s2l = permute(rot_l2s, [2 1 3]);
-            gvcs_lab = gtGeoSam2Lab(gvcs', rot_s2l, labgeo, samgeo, false);
+            gvcs_lab = gtGeoSam2Lab(gvcs', rot_s2l, labgeo, samgeo, false, [], element_wise_gcs);
 
             uvw_bl = gtFedPredictUVWMultiple([], dvec_lab, gvcs_lab', ...
                 detgeo.detrefpos', detgeo.detnorm', detgeo.Qdet, ...
-- 
GitLab