From 58885444bd86e8b421086f17f625b4f8128d4678 Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Mon, 26 Jun 2023 11:32:21 -0500 Subject: [PATCH] Set thickness threshold based on input range (#332) * Set threshold based on input maximum * Take minimum into account for threshold --- .../main/java/org/bonej/wrapperPlugins/ThicknessWrapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modern/wrapperPlugins/src/main/java/org/bonej/wrapperPlugins/ThicknessWrapper.java b/Modern/wrapperPlugins/src/main/java/org/bonej/wrapperPlugins/ThicknessWrapper.java index d4bb6c70..94bd3d5b 100644 --- a/Modern/wrapperPlugins/src/main/java/org/bonej/wrapperPlugins/ThicknessWrapper.java +++ b/Modern/wrapperPlugins/src/main/java/org/bonej/wrapperPlugins/ThicknessWrapper.java @@ -39,6 +39,7 @@ import static org.bonej.wrapperPlugins.wrapperUtils.Common.cancelMacroSafe; import ij.ImagePlus; +import ij.process.ImageStatistics; import ij.process.LUT; import ij.process.StackStatistics; @@ -207,6 +208,8 @@ private void prepareRun(final boolean foreground) { this.foreground = foreground; final String suffix = foreground ? "_Tb.Th" : "_Tb.Sp"; localThickness.setTitleSuffix(suffix); + ImageStatistics stats = inputImage.getStatistics(); + localThickness.threshold = (int) (stats.min + stats.max + 1) / 2; localThickness.inverse = !foreground; }