本文整理汇总了Java中ij.gui.Roi.getPolygon方法的典型用法代码示例。如果您正苦于以下问题:Java Roi.getPolygon方法的具体用法?Java Roi.getPolygon怎么用?Java Roi.getPolygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Roi
的用法示例。
在下文中一共展示了Roi.getPolygon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRoiPoints
import ij.gui.Roi; //导入方法依赖的package包/类
static Point2D[] getRoiPoints(Roi roi) {
Polygon poly = roi.getPolygon();
int[] xp = poly.xpoints;
int[] yp = poly.ypoints;
// copy vertices for all non-zero-length polygon segments:
List<Point> points = new ArrayList<Point>(xp.length);
points.add(new Point(xp[0], yp[0]));
int last = 0;
for (int i = 1; i < xp.length; i++) {
if (xp[last] != xp[i] || yp[last] != yp[i]) {
points.add(new Point(xp[i], yp[i]));
last = i;
}
}
// remove last point if the closing segment has zero length:
if (xp[last] == xp[0] && yp[last] == yp[0]) {
points.remove(last);
}
return points.toArray(new Point2D[0]);
}
示例2: subtractInverse
import ij.gui.Roi; //导入方法依赖的package包/类
public void subtractInverse(final Canvas3D canvas, final Roi roi) {
final Polygon p = roi.getPolygon();
final Transform3D volToIP = new Transform3D();
volumeToImagePlate(canvas, volToIP);
final Point2d onCanvas = new Point2d();
final Point3i pos = new Point3i(0, 0, 0);
for (int z = 0; z < zDim; z++) {
for (int y = 0; y < yDim; y++) {
for (int x = 0; x < xDim; x++) {
volumePointInCanvas(canvas, volToIP, x, y, z, onCanvas);
if (!p.contains(onCanvas.x, onCanvas.y)) {
setNoCheckNoUpdate(x, y, z, BG);
}
}
}
IJ.showStatus("Filling...");
IJ.showProgress(z, zDim);
}
updateData();
}
示例3: makePoint
import ij.gui.Roi; //导入方法依赖的package包/类
/** Creates a point selection. */
public static void makePoint(int x, int y) {
ImagePlus img = getImage();
Roi roi = img.getRoi();
if (shiftKeyDown() && roi!=null && roi.getType()==Roi.POINT) {
Polygon p = roi.getPolygon();
p.addPoint(x, y);
img.setRoi(new PointRoi(p.xpoints, p.ypoints, p.npoints));
} else
img.setRoi(new PointRoi(x, y));
}
示例4:
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Fills the projection of the specified ROI with the given fillValue. Does
* nothing if the given ROI is null. Works not only on the internally created
* image (the resampled one), but also on the original image.
*
* @param canvas
* @param roi
* @param fillValue
*/
public void
fillRoi(final Canvas3D canvas, final Roi roi, final byte fillValue)
{
if (roi == null) return;
final Polygon p = roi.getPolygon();
final Transform3D volToIP = new Transform3D();
canvas.getImagePlateToVworld(volToIP);
volToIP.invert();
volumeToImagePlate(volToIP);
final VoltexVolume vol = renderer.getVolume();
final Point2d onCanvas = new Point2d();
for (int z = 0; z < vol.zDim; z++) {
for (int y = 0; y < vol.yDim; y++) {
for (int x = 0; x < vol.xDim; x++) {
volumePointInCanvas(canvas, volToIP, x, y, z, onCanvas);
if (p.contains(onCanvas.x, onCanvas.y)) {
vol.setNoCheckNoUpdate(x, y, z, fillValue);
}
}
}
IJ.showStatus("Filling...");
IJ.showProgress(z, vol.zDim);
}
vol.updateData();
// also fill the original image
final ImagePlus image = c.getImage();
final int factor = c.getResamplingFactor();
if (image == null || factor == 1) return;
final ij3d.Volume volu = new ij3d.Volume(image);
for (int z = 0; z < volu.zDim; z++) {
for (int y = 0; y < volu.yDim; y++) {
for (int x = 0; x < volu.xDim; x++) {
volumePointInCanvas(canvas, volToIP, x / factor, y / factor, z /
factor, onCanvas);
if (p.contains(onCanvas.x, onCanvas.y)) {
volu.set(x, y, z, fillValue);
}
}
}
IJ.showStatus("Filling...");
IJ.showProgress(z, volu.zDim);
}
}