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


Java Roi.FREEROI属性代码示例

本文整理汇总了Java中ij.gui.Roi.FREEROI属性的典型用法代码示例。如果您正苦于以下问题:Java Roi.FREEROI属性的具体用法?Java Roi.FREEROI怎么用?Java Roi.FREEROI使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ij.gui.Roi的用法示例。


在下文中一共展示了Roi.FREEROI属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doWand

/** Traces the boundary of the area with pixel values within
* 'tolerance' of the value of the pixel at the starting location.
* 'tolerance' is in uncalibrated units.
* 'mode' can be "4-connected", "8-connected" or "Legacy".
* "Legacy" is for compatibility with previous versions of ImageJ;
* it is ignored if 'tolerance' > 0.
*/
public static int doWand(int x, int y, double tolerance, String mode) {
	ImagePlus img = getImage();
	ImageProcessor ip = img.getProcessor();
	if ((img.getType()==ImagePlus.GRAY32) && Double.isNaN(ip.getPixelValue(x,y)))
		return 0;
	int imode = Wand.LEGACY_MODE;
	if (mode!=null) {
		if (mode.startsWith("4"))
			imode = Wand.FOUR_CONNECTED;
		else if (mode.startsWith("8"))
			imode = Wand.EIGHT_CONNECTED;
	}
	Wand w = new Wand(ip);
	double t1 = ip.getMinThreshold();
	if (t1==ImageProcessor.NO_THRESHOLD || (ip.getLutUpdateMode()==ImageProcessor.NO_LUT_UPDATE&& tolerance>0.0))
		w.autoOutline(x, y, tolerance, imode);
	else
		w.autoOutline(x, y, t1, ip.getMaxThreshold(), imode);
	if (w.npoints>0) {
		Roi previousRoi = img.getRoi();
		int type = Wand.allPoints()?Roi.FREEROI:Roi.TRACED_ROI;
		Roi roi = new PolygonRoi(w.xpoints, w.ypoints, w.npoints, type);
		img.killRoi();
		img.setRoi(roi);
		// add/subtract this ROI to the previous one if the shift/alt key is down
		if (previousRoi!=null)
			roi.update(shiftKeyDown(), altKeyDown());
	}
	return w.npoints;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:37,代码来源:IJJazzOMR.java

示例2: roiMeasurements

private void roiMeasurements(final ImagePlus imp, final double min, final double max) {
	final Roi initialRoi = imp.getRoi();
	final int xMin = imp.getImageStack().getRoi().x;
	double[] feretValues = new double[3];
	this.feretAngle = new double[this.al];
	this.feretMax = new double[this.al];
	this.feretMin = new double[this.al];
	this.perimeter = new double[this.al];
	this.principalDiameter = new double[this.al];
	this.secondaryDiameter = new double[this.al];
	final int initialSlice = imp.getCurrentSlice();
	// for the required slices...
	for (int s = this.startSlice; s <= this.endSlice; s++) {
		final ImageProcessor ip = imp.getImageStack().getProcessor(s);
		final Wand w = new Wand(ip);
		w.autoOutline(xMin, (int) Math.round(this.sliceCentroids[1][s] / this.vH), min, max, Wand.EIGHT_CONNECTED);
		if (this.emptySlices[s] || w.npoints == 0) {
			this.feretMin[s] = Double.NaN;
			this.feretAngle[s] = Double.NaN;
			this.feretMax[s] = Double.NaN;
			this.perimeter[s] = Double.NaN;
			this.principalDiameter[s] = Double.NaN;
			this.secondaryDiameter[s] = Double.NaN;
			continue;
		}

		final int type = Wand.allPoints() ? Roi.FREEROI : Roi.TRACED_ROI;
		final PolygonRoi roi = new PolygonRoi(w.xpoints, w.ypoints, w.npoints, type);
		feretValues = roi.getFeretValues();
		this.feretMin[s] = feretValues[2] * this.vW;
		this.feretAngle[s] = feretValues[1] * Math.PI / 180;
		this.feretMax[s] = feretValues[0] * this.vW;
		this.perimeter[s] = roi.getLength() * this.vW;

		if (this.doOriented && orienteer != null) {
			final double[][] points = new double[w.npoints][2];
			for (int i = 0; i < w.npoints; i++) {
				points[i][0] = w.xpoints[i] * this.vW;
				points[i][1] = w.ypoints[i] * this.vH;
			}
			final double[] diameters = orienteer.getDiameters(points);
			this.principalDiameter[s] = diameters[0];
			this.secondaryDiameter[s] = diameters[1];
		}
		feretValues = null;
	}
	IJ.setSlice(initialSlice);
	imp.setRoi(initialRoi);
	return;
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:50,代码来源:SliceGeometry.java


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