From 32e25ea72fe29f8661c7a28c4670fb9d8335ba5f Mon Sep 17 00:00:00 2001
From: Wolfgang Ludwig <wolfgang.ludwig@esrf.fr>
Date: Sat, 30 Mar 2013 20:06:56 +0100
Subject: [PATCH] Fix problem with selected image in
 gtSetupSegmentation_doublethr Add 3rd parameter to gtMathVectorAngles

---
 2_difspot/gtSetupSegmentation_doublethr.m | 14 ++++++++------
 zUtil_Maths/gtMathsVectorsAngles.m        |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/2_difspot/gtSetupSegmentation_doublethr.m b/2_difspot/gtSetupSegmentation_doublethr.m
index 11e6fe08..4a3b2cba 100644
--- a/2_difspot/gtSetupSegmentation_doublethr.m
+++ b/2_difspot/gtSetupSegmentation_doublethr.m
@@ -321,18 +321,20 @@ fnames = fnames(ind);
 
 
 % get 4 evenly spaced images
-check = inputwdefault('Do you have any suggested numbers ofr images? [y/n]','n');
+check = inputwdefault('Do you have any suggested numbers for images? [y/n]','n');
+getfulls = 1;
 if strcmp(check, 'y')
     getfulls = input('Insert image numbers in squared brackets (the first 4 are used):');
 end
-% remove duplicates if existing
-getfulls = unique(getfulls);
+
 if length(getfulls) < 4
     getfulls = [getfulls, round(1:(length(fnames)/(4-length(getfulls))):length(fnames)) length(fnames)];
 elseif length(getfulls) > 4
   % remove exceeding numbers
     getfulls(5:end,:) = [];
 end
+% remove duplicates if existing
+getfulls = unique(getfulls);
 disp('Using those images to segment: ')
 disp(getfulls)
 
@@ -516,13 +518,13 @@ set(h_imp,'Position', [10 h_figpos(4)-30 150 30]);
 % change the full image
     function sfChangeFull(fig, eventdata)
         StackIndex = find([u1 u2 u3 u4 u5] == eventdata.NewValue);
-        full_im    = fullstack(:, :, StackIndex);
+        full    = fullstack(:, :, StackIndex);
 
         ThreshFull = threshstack(:,:,StackIndex);
         Values.ShowThresholded = false;
 
         subplot(1,2,1)
-        imshow(full_im, gtAutolim(full_im))
+        imshow(full, gtAutolim(full))
 
         % open impixelinfo in upper left corner
         figpos = get(fig,'Position');
@@ -542,7 +544,7 @@ set(h_imp,'Position', [10 h_figpos(4)-30 150 30]);
         if (Values.ShowThresholded)
             % check just the first pixel
             if (ValuesChanged || isnan(ThreshFull(1)))
-                ThreshFull = sfDoThresholding(full, Values);
+                ThreshFull = sfDoThresholding(full, Values);  %changed here
                 threshstack(:, :, StackIndex) = ThreshFull;
             else
                 % if we already have a non NaN ThreshFull
diff --git a/zUtil_Maths/gtMathsVectorsAngles.m b/zUtil_Maths/gtMathsVectorsAngles.m
index 8f157f11..472e5afb 100644
--- a/zUtil_Maths/gtMathsVectorsAngles.m
+++ b/zUtil_Maths/gtMathsVectorsAngles.m
@@ -10,4 +10,4 @@ disp('   angrad = gtMathsVectorsAnglesRad(v1,v2,colvec)')
 disp('   angdeg = gtMathsVectorsAnglesDeg(v1,v2,colvec)')
 
 error('Function is out-of-date!')
-end
\ No newline at end of file
+end
-- 
GitLab