当前位置: 首页>>代码示例>>Java>>正文


Java Roi.getPolygon方法代码示例

本文整理汇总了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]);
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:21,代码来源:FourierDescriptorFromPolygon.java

示例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();
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:23,代码来源:Mask.java

示例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));
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:12,代码来源:IJJazzOMR.java

示例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);
	}
}
 
开发者ID:fiji,项目名称:3D_Viewer,代码行数:57,代码来源:VoltexGroup.java


注:本文中的ij.gui.Roi.getPolygon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。