From 4664498e80eeee232babdd633f9964f1fe4538fe Mon Sep 17 00:00:00 2001
From: ac_fx <arc334@drexel.edu>
Date: Sun, 26 Nov 2023 11:16:36 -0500
Subject: [PATCH] SSF.clipLimits min,max

---
 matlab/+SSF/getClipQuantiles.m |  2 +-
 matlab/+SSF/quantize8.m        | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/matlab/+SSF/getClipQuantiles.m b/matlab/+SSF/getClipQuantiles.m
index d40a06d4..7ba6038c 100644
--- a/matlab/+SSF/getClipQuantiles.m
+++ b/matlab/+SSF/getClipQuantiles.m
@@ -11,7 +11,7 @@ cl = [mx-sx, mx+sx];
 % end
 
 % linear quantization
-clipLimits = linspace(cl(1),cl(2),nQuant);
+clipLimits = cl; %linspace(cl(1),cl(2),nQuant);
 
 % % equiprobable quantization
 % ep1 = length(find(voxels<=cl(1)))./length(voxels);
diff --git a/matlab/+SSF/quantize8.m b/matlab/+SSF/quantize8.m
index b74a16a4..d5dd5a70 100644
--- a/matlab/+SSF/quantize8.m
+++ b/matlab/+SSF/quantize8.m
@@ -6,6 +6,13 @@ if isa(im,'uint8')
     return
 end
 
-im = uint8(imquantize(im,clipLimits));
+% im = uint8(imquantize(im,clipLimits));
+
+im = max(im,clipLimits(1));
+im = min(im,clipLimits(end));
+im = (im - clipLimits(1)) ./ (clipLimits(end) - clipLimits(end));
+im = im2uint8(im);
 im = max(im,1);
-im(0 == im_in) = 0;
\ No newline at end of file
+im(0 == im_in) = 0;
+4;
+
-- 
GitLab