|
|
@ -14,6 +14,7 @@ import ij.measure.Calibration; |
|
|
|
import ij.measure.ResultsTable; |
|
|
|
import ij.measure.ResultsTable; |
|
|
|
import ij.measure.Measurements; |
|
|
|
import ij.measure.Measurements; |
|
|
|
import java.awt.event.*; |
|
|
|
import java.awt.event.*; |
|
|
|
|
|
|
|
import java.awt.geom.GeneralPath; |
|
|
|
import java.text.*; |
|
|
|
import java.text.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
@ -1560,6 +1561,46 @@ public class IJ { |
|
|
|
return w.npoints; |
|
|
|
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", |
|
|
|
/** 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". */ |
|
|
|
"Transparent", "Transparent2", "AND", "OR", "XOR", "Add", "Subtract", "Multiply", or "Divide". */ |
|
|
|
public static void setPasteMode(String mode) { |
|
|
|
public static void setPasteMode(String mode) { |
|
|
|