Replaced by ImagePlus.setAutoThreshold().
(ImagePlus imp, String method)
| 1563 | |
| 1564 | /** Replaced by ImagePlus.setAutoThreshold(). */ |
| 1565 | public static void setAutoThreshold(ImagePlus imp, String method) { |
| 1566 | ImageProcessor ip = imp.getProcessor(); |
| 1567 | if (ip instanceof ColorProcessor) |
| 1568 | throw new IllegalArgumentException("Non-RGB image required"); |
| 1569 | ip.setRoi(imp.getRoi()); |
| 1570 | if (method!=null) { |
| 1571 | try { |
| 1572 | if (method.indexOf("stack")!=-1) |
| 1573 | setStackThreshold(imp, ip, method); |
| 1574 | else |
| 1575 | ip.setAutoThreshold(method); |
| 1576 | } catch (Exception e) { |
| 1577 | log(e.getMessage()); |
| 1578 | } |
| 1579 | } else |
| 1580 | ip.setAutoThreshold(ImageProcessor.ISODATA2, ImageProcessor.RED_LUT); |
| 1581 | ThresholdAdjuster.setMethod(method); |
| 1582 | imp.updateAndDraw(); |
| 1583 | } |
| 1584 | |
| 1585 | private static void setStackThreshold(ImagePlus imp, ImageProcessor ip, String method) { |
| 1586 | boolean darkBackground = method.contains("dark"); |
no test coverage detected