Skip to content
Snippets Groups Projects
Commit 98f689dc authored by Nicola Vigano's avatar Nicola Vigano
Browse files

SoftThresholding: finally fixed ill cases (no threshold or multiple threshold passed)


This generates a warning, in ill cases

Signed-off-by: default avatarNicola Vigano <nicola.vigano@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@641 4c865b51-4357-4376-afb4-474e03ccb993
parent 0f25bf30
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,15 @@ function img = gtSoftThreshold(img, thr)
% GTSOFTTHRESHOLD Applies soft thresholding to the image
% img = gtSoftThreshold(img, thr)
thr = min(thr(:));
if (numel(thr) > 1)
warning('THRESHOLDING:wrong_argument', ...
'Expected one threshold, but got: %d', length(thr))
thr = min(thr(:));
elseif (isempty(thr))
warning('THRESHOLDING:wrong_argument', ...
'Expected one threshold, an EMPTY array was passed!')
thr = 0;
end
tempImg = abs(img) - thr;
tempImg = (tempImg + abs(tempImg)) / 2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment