/** * Gets a {@link Geometry} from an input {@link ROI}. * * @param roi the ROI * @return a {@link Geometry} instance from the provided input; null in case the input roi * is neither a geometry, nor a shape. */ private Geometry getGeometry(ROI roi) { if (roi instanceof ROIGeometry) { return ((ROIGeometry) roi).getAsGeometry(); } else if (roi instanceof ROIShape) { final Shape shape = ((ROIShape) roi).getAsShape(); final Geometry geom = ShapeReader.read(shape, 0, new GeometryFactory()); geom.apply(Y_INVERSION); return geom; } return null; } }
/** * Gets a {@link Geometry} from an input {@link ROI}. * * @param roi the ROI * @return a {@link Geometry} instance from the provided input; null in case the input roi * is neither a geometry, nor a shape. */ private Geometry getGeometry(ROI roi) { if (roi instanceof ROIGeometry) { return ((ROIGeometry) roi).getAsGeometry(); } else if (roi instanceof ROIShape) { final Shape shape = ((ROIShape) roi).getAsShape(); final Geometry geom = ShapeReader.read(shape, 0, new GeometryFactory()); geom.apply(Y_INVERSION); return geom; } return null; } }
return add(geometry); } else if (roi instanceof ROIShape) { Shape shape = ((ROIShape) roi).getAsShape(); Geometry geometry = JTS.toGeometry(shape); return add(geometry);
private void printRoiShape(ROIShape rs1) { PathIterator pt1 = rs1.getAsShape().getPathIterator(null); float [] coords = new float[2]; System.out.print("POLYGON (("); while (!pt1.isDone()){ pt1.currentSegment(coords); System.out.print(coords[0] + " " + coords[1] + ","); pt1.next(); } System.out.println("))/n"); }
private static void printRoiShape(final ROIShape rs1, final String title) { printShape(rs1.getAsShape(), title); }
/** * Gets a {@link Geometry} from an input {@link ROI}. * * @param roi the ROI * @return a {@link Geometry} instance from the provided input; * null in case the input roi is neither a geometry, nor a shape. */ private Geometry getGeometry(ROI roi){ if (roi instanceof ROIGeometry){ return ((ROIGeometry) roi).getAsGeometry(); } else if (roi instanceof ROIShape){ final Shape shape = ((ROIShape) roi).getAsShape(); final Geometry geom = ShapeReader.read(shape, 0, geomFactory); geom.apply(Y_INVERSION); return geom; } return null; }
/** * Gets a {@link Geometry} from an input {@link ROI}. * * @param roi the ROI * @return a {@link Geometry} instance from the provided input; * null in case the input roi is neither a geometry, nor a shape. */ private Geometry getGeometry(ROI roi){ if (roi instanceof ROIGeometry){ return ((ROIGeometry) roi).getAsGeometry(); } else if (roi instanceof ROIShape){ final Shape shape = ((ROIShape) roi).getAsShape(); final Geometry geom = ShapeReader.read(shape, 0, geomFactory); geom.apply(Y_INVERSION); return geom; } return null; }
/** * Gets a {@link Geometry} from an input {@link ROI}. * * @param roi the ROI * @return a {@link Geometry} instance from the provided input; * null in case the input roi is neither a geometry, nor a shape. */ private Geometry getGeometry(ROI roi){ if (roi instanceof ROIGeometry){ return ((ROIGeometry) roi).getAsGeometry(); } else if (roi instanceof ROIShape){ final Shape shape = ((ROIShape) roi).getAsShape(); final Geometry geom = ShapeReader.read(shape, 0, geomFactory); geom.apply(Y_INVERSION); return geom; } return null; }
/** * Gets a {@link Geometry} from an input {@link ROI}. * * @param roi the ROI * @return a {@link Geometry} instance from the provided input; * null in case the input roi is neither a geometry, nor a shape. */ private Geometry getGeometry(ROI roi){ if (roi instanceof ROIGeometry){ return ((ROIGeometry) roi).getAsGeometry(); } else if (roi instanceof ROIShape){ final Shape shape = ((ROIShape) roi).getAsShape(); final Geometry geom = ShapeReader.read(shape, 0, geomFactory); geom.apply(Y_INVERSION); return geom; } return null; }