Skip to content

Commit

Permalink
Set thickness threshold based on input range (#332)
Browse files Browse the repository at this point in the history
* Set threshold based on input maximum

* Take minimum into account for threshold
  • Loading branch information
gselzer authored and mdoube committed Apr 5, 2024
1 parent a856b4f commit 5888544
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 5888544

Please sign in to comment.