From c1691583ee84ca4043c91a3d8e3816f9426d7c79 Mon Sep 17 00:00:00 2001 From: ac <andrew.r.cohen@drexel.edu> Date: Wed, 21 May 2025 10:13:54 -0400 Subject: [PATCH] quantize pair fix --- src/MATLAB/+NCD/ncd_ssf_volume.m | 7 ++++--- src/MATLAB/+NCD/quantizePair.m | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/MATLAB/+NCD/ncd_ssf_volume.m b/src/MATLAB/+NCD/ncd_ssf_volume.m index cfcfab3..939d13a 100644 --- a/src/MATLAB/+NCD/ncd_ssf_volume.m +++ b/src/MATLAB/+NCD/ncd_ssf_volume.m @@ -1,6 +1,7 @@ -% i1 and i2 are signal kymos (x,y,t,c)outdir -% we want images {t}(x,y,c) -% package to cell array by t and then pass to in memory FLI%F compressor +% i1 and i2 are each 3.3D images, e.g. (x,y,z) or (x,y,t), etc. +% package to cell array by z or t and then pass to in memory FLIF compressor +% if images are not uint8, they will be quantized to uint8 (FLIF does not +% like floats) function ncd = ncd_ssf_volume(i1,i2) [i1,i2] = NCD.quantizePair(i1,i2); diff --git a/src/MATLAB/+NCD/quantizePair.m b/src/MATLAB/+NCD/quantizePair.m index 4233c1c..527353a 100644 --- a/src/MATLAB/+NCD/quantizePair.m +++ b/src/MATLAB/+NCD/quantizePair.m @@ -1,11 +1,19 @@ % clip image pairs and quantize, per channel (x,y,z,c) +% best practice -- quantize all embedded data jointly +% if images already quantized (uint8), just return them +% otherwise quantize image pair function [i1q,i2q] = quantizePair(i1,i2,clipLimits) + if isa(i1,'uint8') && isa(i2,'uint8') + i1q = i1; + i2q = i2; return end + if ~exist('clipLimits','var') clipLimits = [0,100]; end + if size(i1,4) ~= size(i2,4) fprintf(2,'WARNING : quantizePair : input images of different color channel dimension\n'); end -- GitLab