Browse Source

Merge pull request #346 in CORE/base-third from ~ZHOUPING/base-third:research/10.0 to research/10.0

* commit '7e23890fd844ffb58bdcc35c92d031f336b5e448':
  KERNEL-1298 编译问题
research/10.0
zhouping 5 years ago
parent
commit
d12971a56a
  1. 41
      fine-imageJ/src/main/java/ij/IJ.java

41
fine-imageJ/src/main/java/ij/IJ.java

@ -14,6 +14,7 @@ import ij.measure.Calibration;
import ij.measure.ResultsTable;
import ij.measure.Measurements;
import java.awt.event.*;
import java.awt.geom.GeneralPath;
import java.text.*;
import java.util.*;
import java.awt.*;
@ -1560,6 +1561,46 @@ public class IJ {
return w.npoints;
}
// function is copied from old third-base.jar
public static GeneralPath doWand4Path(ImagePlus img, int selectX, int selectY) {
String mode = "Legacy";
double tolerance = 0.0D;
GeneralPath path = new GeneralPath();
ImageProcessor ip = img.getProcessor();
if (img.getType() == 2 && Double.isNaN((double) ip.getPixelValue(selectX, selectY))) {
return new GeneralPath();
} else {
int imode = 1;
if (mode != null) {
if (mode.startsWith("4")) {
imode = 4;
} else if (mode.startsWith("8")) {
imode = 8;
}
}
Wand w = new Wand(ip);
double t1 = ip.getMinThreshold();
if (t1 != -808080.0D && (ip.getLutUpdateMode() != 2 || tolerance <= 0.0D)) {
w.autoOutline(selectX, selectY, t1, ip.getMaxThreshold(), imode);
} else {
w.autoOutline(selectX, selectY, tolerance, imode);
}
if (w.npoints > 0) {
for (int i = 0; i < w.npoints; ++i) {
if (i == 0) {
path.moveTo((float) w.xpoints[i], (float) w.ypoints[i]);
} else {
path.lineTo((float) w.xpoints[i], (float) w.ypoints[i]);
}
}
}
return path;
}
}
/** Sets the transfer mode used by the <i>Edit/Paste</i> command, where mode is "Copy", "Blend", "Average", "Difference",
"Transparent", "Transparent2", "AND", "OR", "XOR", "Add", "Subtract", "Multiply", or "Divide". */
public static void setPasteMode(String mode) {

Loading…
Cancel
Save