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


Java Roi.POLYGON属性代码示例

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


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

示例1: writePolygonRoi

/** Write a PolygonRoi */
private void writePolygonRoi(
        final XMLStreamWriter xsw, 
        final PolygonRoi roi) 
        throws SlideSetException {
    final FloatPolygon fp = roi.getFloatPolygon();
    try {
        if(roi.getType() == Roi.POLYGON)
            xsw.writeStartElement("polygon");
        else
            xsw.writeStartElement("polyline");
        xsw.writeAttribute("class", "roi PolygonRoi");
        String coords = "";
        for(int i=0; i < fp.npoints; i++) {
            coords += String.valueOf(
                    fp.xpoints[i]) +
                    "," + String.valueOf(
                    fp.ypoints[i]) + " ";
        }
        xsw.writeAttribute("points", coords);
        applyDefaultStyles(xsw);
        xsw.writeEndElement();
    } catch(Exception e) {
        throw new SlideSetException(e);
    }
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:26,代码来源:IJ1ROIsToSVGFileWriter.java

示例2: createRoi

private Roi createRoi(ConvexHull hull, boolean forcePolygon)
{
	// Convert the Hull to the correct image scale.
	float[] x2 = hull.x.clone();
	float[] y2 = hull.y.clone();
	for (int i = 0; i < x2.length; i++)
	{
		x2[i] = image.mapX(x2[i]);
		y2[i] = image.mapY(y2[i]);
	}
	// Note: The hull can be a single point or a line
	if (!forcePolygon)
	{
		if (x2.length == 1)
			return new PointRoi(x2[0], y2[0]);
		if (x2.length == 2)
			return new Line(x2[0], y2[0], x2[1], y2[1]);
	}
	return new PolygonRoi(x2, y2, Roi.POLYGON);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:20,代码来源:OPTICS.java

示例3: smoothPolygonRoi

private static PolygonRoi smoothPolygonRoi(PolygonRoi r) {
			FloatPolygon poly = r.getFloatPolygon();
			FloatPolygon poly2 = new FloatPolygon();
			int nPoints = poly.npoints;
			for (int i = 0; i < nPoints; i += 2) {
				int iMinus = (i + nPoints - 1) % nPoints;
				int iPlus = (i + 1) % nPoints;
				poly2.addPoint((poly.xpoints[iMinus] + poly.xpoints[iPlus] + poly.xpoints[i])/3, 
						(poly.ypoints[iMinus] + poly.ypoints[iPlus] + poly.ypoints[i])/3);
			}
//			return new PolygonRoi(poly2, r.getType());
			return new PolygonRoi(poly2, Roi.POLYGON);
		}
 
开发者ID:qupath,项目名称:qupath,代码行数:13,代码来源:WatershedCellDetection.java

示例4: decodeRawData

private void decodeRawData() {
	ArrayList<Roi> rois = new ArrayList<Roi>();
	ArrayList<Findings> findings = new ArrayList<Findings>();
	
	int numComponents = Integer.parseInt(rawData[0]);
	
	int pos = 1;
	for(int i = 1; i < numComponents; i++){
		String fndg = rawData[pos];
		for(Findings f : Findings.values()){
			String[] vals = f.getValue();
			// make sure its not the "all" value
			if(vals.length > 1){
				break;
			}
			if(fndg.equals(f.getValue()[0])){
				findings.add(f);
				break;
			}
		}
		pos++;
		int numPolygonPoints = Integer.parseInt(rawData[pos]);
		pos++;
		int[] x = new int[numPolygonPoints];
		int[] y = new int[numPolygonPoints];
		for(int j = 0; j < numPolygonPoints; j++){
			String coordPair = rawData[pos];
			String[] split = coordPair.split(",");
			x[j] = (int)Double.parseDouble(split[0].substring(1));
			y[j] = (int)Double.parseDouble(split[1].substring(0,split[1].length()-1));
			pos++;
		}
		Polygon poly = new Polygon(x,y,numPolygonPoints);
		PolygonRoi roi = new PolygonRoi(poly, Roi.POLYGON);
		rois.add(roi);
	}
	this.rois = rois;
	this.findings = findings;		
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:39,代码来源:XMLparser.java

示例5: addTriplet

private void addTriplet(int count, Overlay o, AssignedPoint p1, AssignedPoint p2, AssignedPoint p3,
		int classification)
{
	float[] x = new float[3];
	float[] y = new float[3];
	x[0] = p1.x;
	x[1] = p2.x;
	x[2] = p3.x;
	y[0] = p1.y;
	y[1] = p2.y;
	y[2] = p3.y;
	PolygonRoi roi = new PolygonRoi(x, y, 3, Roi.POLYGON);
	Color color;
	switch (classification)
	{
		case TRANSLOCATION:
			color = Color.CYAN;
			break;
		case NO_TRANSLOCATION:
			color = Color.MAGENTA;
			break;
		case UNKNOWN:
		default:
			color = Color.YELLOW;
	}
	roi.setStrokeColor(color);
	o.add(roi);

	TextRoi text = new TextRoi(Maths.max(x) + 1, Maths.min(y),
			Integer.toString(count) + CLASSIFICATION[classification].charAt(0));
	text.setStrokeColor(color);
	o.add(text);
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:33,代码来源:TranslocationFinder.java

示例6: getFeatureShapeDescriptorsNew

/**
 * returns ShapeNames features (>= model version 10)
 *
 * @param shape
 * @return
 */
private List<Double> getFeatureShapeDescriptorsNew(Shape shape) {
    List<Double> feats = new ArrayList<Double>(getShapeNames().length);
    double ratio = Double.NaN;
    double perimeter = Double.NaN;
    double area = Double.NaN;
    double circularity = Double.NaN;
    double solidity = Double.NaN;
    double convexity = Double.NaN;
    double compactness = Double.NaN;
    double roundness = Double.NaN;
    double centerX = Double.NaN;
    double centerY = Double.NaN;
    double centroidX = Double.NaN;
    double centroidY = Double.NaN;
    if (shape instanceof Polygon) {
        Polygon p = (Polygon) shape;
        PolygonMetrics pm = new PolygonMetrics(p);
        PolygonRoi pr = new PolygonRoi(p, Roi.POLYGON);
        Polygon convexHull = pr.getConvexHull();
        double[] ferets = pr.getFeretValues();
        double majorAxis = ferets[0];
        //double minorAxis = ferets[2];

        area = pm.getArea();
        perimeter = pm.getPerimeter();
        roundness = pm.getRoundnessNew(area, majorAxis);
        circularity = pm.getCircularity(area, perimeter);
        solidity = pm.getSolidity(convexHull, area);
        convexity = pm.getConvexity(convexHull, perimeter);
        compactness = pm.getCompactness(area, majorAxis);
        ratio = pm.getAspectRatio(ferets);

        // centerX/Y
        Point2D center = pm.getCenter();
        centerX = Math.abs(center.getX());
        centerY = Math.abs(center.getY());

    }

    feats.add(roundness);
    feats.add(circularity);
    feats.add(solidity);
    feats.add(convexity);
    feats.add(compactness);
    feats.add(area);
    feats.add(perimeter);
    feats.add(ratio);
    feats.add(centerX);
    feats.add(centerY);
    return feats;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:57,代码来源:ObjectFeatureBuilderTiled.java

示例7: roiFromWand

private static Roi roiFromWand(Wand wand) {
	return new PolygonRoi(wand.xpoints, wand.ypoints, wand.npoints, Roi.POLYGON);
}
 
开发者ID:qupath,项目名称:qupath,代码行数:3,代码来源:TMADearrayer.java


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