Ejemplo n.º 1
0
 @Override
 public double runThresholder(ImageHandler input, InputImages images) {
   double thld1 = threshold1.getThreshold(input, images, nbCPUs, debug);
   double thld2 = threshold2.getThreshold(input, images, nbCPUs, debug);
   if (debug) ij.IJ.log("thld1:" + thld1 + " thld2:" + thld2);
   if (operation.getSelectedItem().equals(methods[0])) {
     return Math.max(thld2, thld1);
   } else if (operation.getSelectedItem().equals(methods[1])) {
     return Math.min(thld2, thld1);
   } else if (operation.getSelectedItem().equals(methods[1])) {
     double coeffd = coeff.getDoubleValue(0.5d);
     return thld1 * (1 - coeffd) + thld2 * coeffd;
   } else return thld1;
 }
Ejemplo n.º 2
0
 @Override
 public ImageHandler runPreFilter(
     int currentStructureIdx, ImageHandler input, InputImages images) {
   double scaleZ = input.getScaleZ();
   double scaleXY = input.getScaleXY();
   String unit = input.getUnit();
   if (!useScale.isSelected()) input.setScale(scaleXY, scaleXY, unit);
   ImageHandler res =
       getStructure(
           input, Math.max(sscale.getFloatValue(1), 1), Math.max(iscale.getFloatValue(1), 1))[
           choice.getSelectedIndex()];
   if (!useScale.isSelected()) {
     res.setScale(scaleXY, scaleZ, unit);
     input.setScale(scaleXY, scaleZ, unit);
   }
   return res;
 }
Ejemplo n.º 3
0
 public ThresholderOperation() {
   operation.setHelp("Choose operation performed on computed thresholds", true);
   coeff.setHelp(
       "returned threshold is a ponderated mean value of thld1 & thld2: thld1 * (1-coeff) + thld2*coeff",
       true);
 }