From 06f6c4a722c2bcff303b2561386c7f08317be6ab Mon Sep 17 00:00:00 2001 From: preischig <preischig@xnovotech.com> Date: Wed, 26 Mar 2014 17:17:30 +0100 Subject: [PATCH] GtThreshold: bug fix in computing segmentation threshold. The computed threshold was not a continuous function of the parameters -> very bad! Imagine if meanvol = 1, and using default values for percentile 1 and 2: if stdvol = 1.00001 -> threshold_val = 0.25 if stdvol = 0.99999 -> threshold_val = 0.8 This is corrected now by using percentile2 only. Signed-off-by: preischig <preischig@xnovotech.com> --- 4_grains/GtThreshold.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/4_grains/GtThreshold.m b/4_grains/GtThreshold.m index 62a26066..371e3d7d 100644 --- a/4_grains/GtThreshold.m +++ b/4_grains/GtThreshold.m @@ -249,11 +249,13 @@ classdef GtThreshold < handle stdvol = std( vol(indexes) ); meanvol = mean( vol(indexes) ); - if (stdvol > meanvol) - threshold_val = obj.param.rec.percentile1/100 * meanvol; - else - threshold_val = meanvol - obj.param.rec.percentile2/100 * stdvol; - end + %if (stdvol > meanvol) + % threshold_val = obj.param.rec.percentile1/100 * meanvol; + %else + % threshold_val = meanvol - obj.param.rec.percentile2/100 * stdvol; + %end + % The above cases are not continuous! Use this instead: + threshold_val = meanvol - obj.param.rec.percentile2/100 * stdvol; center(1) = round(size(vol, 1) / 2); center(2) = round(size(vol, 2) / 2); -- GitLab