本文整理汇总了Java中ij.gui.PolygonRoi.getFloatPolygon方法的典型用法代码示例。如果您正苦于以下问题:Java PolygonRoi.getFloatPolygon方法的具体用法?Java PolygonRoi.getFloatPolygon怎么用?Java PolygonRoi.getFloatPolygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.PolygonRoi
的用法示例。
在下文中一共展示了PolygonRoi.getFloatPolygon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writePolygonRoi
import ij.gui.PolygonRoi; //导入方法依赖的package包/类
/** 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);
}
}
示例2: smoothPolygonRoi
import ij.gui.PolygonRoi; //导入方法依赖的package包/类
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);
}
示例3: getShape
import ij.gui.PolygonRoi; //导入方法依赖的package包/类
private Shape getShape(PolygonRoi r)
{
Path2D.Float path = new Path2D.Float();
FloatPolygon p = r.getFloatPolygon();
path.moveTo(p.xpoints[0], p.ypoints[0]);
for (int i = 1; i < p.xpoints.length; i++)
{
path.lineTo(p.xpoints[i], p.ypoints[i]);
}
return path;
}