@@ -0,0 +1,2056 @@
+package org.bonej.ops;%0A%0Aimport net.imagej.ops.Op;%0Aimport net.imagej.ops.special.function.AbstractBinaryFunctionOp;%0Aimport net.imglib2.IterableInterval;%0Aimport org.scijava.plugin.Plugin;%0A%0Aimport java.util.stream.Stream;%0Aimport java.util.stream.StreamSupport;%0A%0A/**%0A * Counts the total number of elements in the interval, elements within thresholds, and their fraction%0A *%0A * @author Richard Domander%0A * @apiNote The plugin assumes that foregroundCutOff.compareTo(minThreshold) %3C= 0,%0A *          and minThreshold.compareTo(maxThreshold) %3C= 0%0A */%0A@Plugin(type = Op.class, name = %22thresholdElementFraction%22)%0Apublic class ThresholdElementFraction%3CS, T extends Comparable%3CS%3E%3E extends%0A        AbstractBinaryFunctionOp%3CIterableInterval%3CT%3E, ThresholdElementFraction.Settings%3CS%3E, ThresholdElementFraction.Results%3E %7B%0A%0A    @Override%0A    public Results compute2(final IterableInterval%3CT%3E interval, final Settings%3CS%3E settings) %7B%0A        final long elements = interval.size();%0A        final Stream%3CT%3E elementStream = StreamSupport.stream(interval.spliterator(), true);%0A        final long thresholdElements = elementStream%0A                .filter(e -%3E e.compareTo(settings.minThreshold) %3E= 0 && e.compareTo(settings.maxThreshold) %3C= 0)%0A                .count();%0A%0A        return new Results(thresholdElements, elements);%0A    %7D%0A%0A    /** A helper class to make the Op binary */%0A    public static final class Settings%3CS%3E %7B%0A        public final S minThreshold;%0A        public final S maxThreshold;%0A%0A        public Settings(final S minThreshold, final S maxThreshold) %7B%0A            this.minThreshold = minThreshold;%0A            this.maxThreshold = maxThreshold;%0A        %7D%0A    %7D%0A%0A    public static final class Results %7B%0A        public final long thresholdElements;%0A        public final long elements;%0A        public final double ratio;%0A%0A        public Results(final long thresholdElements, final long elements) %7B%0A            this.thresholdElements = thresholdElements;%0A            this.elements = elements;%0A            ratio = 1.0 * thresholdElements / elements;%0A        %7D%0A    %7D%0A%7D%0A

Add op