public String getShapeType(int ROIIndex, int shapeIndex) { Shape o = (Shape) root.getROI(ROIIndex).getUnion().getShape(shapeIndex); String className = o.getClass().getName(); return className.substring( className.lastIndexOf('.') + 1, className.length()); }
/** * Creates an ROI. * * @param index The index of the ROI in the file. * @param z The selected z-section. * @param c The selected channel. * @param t The selected time-point. */ public ROI createROI(int index, int z, int c, int t) { ROI roi = new ROI(); roi.setName("ROI name:"+index); roi.setID("ROI:"+index); int n = SHAPES.length; int j = index; if (index > 0) j += n; Union union = new Union(); for (int i = 0; i < n; i++) { j += i; Shape shape = createShape(j, SHAPES[i], z, c, t); shape.setID("Shape:" + index + ":" + j); union.addShape(shape); } roi.setUnion(union); return roi; }
@Test (groups = {"11-06-u-roi"}, dependsOnMethods = {"testOmeNode"}) public void testROI2AndUnion() { Assert.assertNotNull(ome); roi2 = ome.getROI(2); Assert.assertNull(roi2.getDescription()); Assert.assertNull(roi2.getName()); union2 = roi2.getUnion(); Assert.assertNotNull(union2); Assert.assertEquals(8, union2.sizeOfShapeList()); }
public void setROIDescription(String description, int ROIIndex) { // Parents: {u'OME': None} // Description is not a reference OME o0 = root; if (o0.sizeOfROIList() == ROIIndex) { o0.addROI(new ROI()); } ROI o1 = o0.getROI(ROIIndex); o1.setDescription(description); }
public void setEllipseFillColor(Color fillColor, int ROIIndex, int shapeIndex) { // Parents: None // FillColor is not a reference OME o0 = root; if (o0.sizeOfROIList() == ROIIndex) { o0.addROI(new ROI()); } ROI o1 = o0.getROI(ROIIndex); if (o1.getUnion() == null) { o1.setUnion(new Union()); } Union o2 = o1.getUnion(); if (o2.sizeOfShapeList() == shapeIndex) { o2.addShape(new Ellipse()); } Ellipse o3 = (Ellipse) o2.getShape(shapeIndex); o3.setFillColor(fillColor); }
if (!element.hasAttribute("ID") && getID() == null) setID(String.valueOf( element.getAttribute("ID"))); model.addModelObject(getID(), this); setName(String.valueOf( element.getAttribute("Name"))); getChildrenByTagName(element, "Union"); if (Union_nodeList.size() > 1) setUnion(new Union( (Element) Union_nodeList.get(0), model)); getChildrenByTagName(element, "AnnotationRef"); for (Element AnnotationRef_element : AnnotationRef_nodeList) getChildrenByTagName(element, "Description"); if (Description_nodeList.size() > 1) setDescription( String.valueOf(Description_nodeList.get(0).getTextContent()));
private ROI makeROI() { ROI roi = new ROI(); roi.setID(InOutCurrentTest.ROI_ID); CommentAnnotation roiAnnotation = new CommentAnnotation(); roiAnnotation.setID(InOutCurrentTest.ROI_ANNOTATION_ID); roiAnnotation.setValue(InOutCurrentTest.ROI_ANNOTATION_VALUE); roiAnnotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE); roi.linkAnnotation(roiAnnotation); annotations.addCommentAnnotation(roiAnnotation); Union shapeUnion = new Union(); Rectangle rect = new Rectangle(); rect.setID(InOutCurrentTest.SHAPE_ID); rect.setX(InOutCurrentTest.RECTANGLE_X); rect.setY(InOutCurrentTest.RECTANGLE_Y); rect.setWidth(InOutCurrentTest.RECTANGLE_WIDTH); rect.setHeight(InOutCurrentTest.RECTANGLE_HEIGHT); shapeUnion.addShape(rect); roi.setUnion(shapeUnion); return roi; } }
public String getROIID(int ROIIndex) { // Parents: {u'OME': None} // ID is not a reference return root.getROI(ROIIndex).getID(); }
@Test(dependsOnMethods={"testValidOMENode"}) public void testValidROINode() { ROI roi = ome.getROI(0); assertNotNull(roi); assertEquals(ROI_ID, roi.getID()); Union shapeUnion = roi.getUnion(); assertNotNull(shapeUnion); assertEquals(1, shapeUnion.sizeOfShapeList()); Shape s = shapeUnion.getShape(0); assertNotNull(s); assertEquals(SHAPE_ID, s.getID()); assertTrue(s instanceof Rectangle); Rectangle rect = (Rectangle) s; assertEquals(RECTANGLE_X, rect.getX()); assertEquals(RECTANGLE_Y, rect.getY()); assertEquals(RECTANGLE_WIDTH, rect.getWidth()); assertEquals(RECTANGLE_HEIGHT, rect.getHeight()); }
public String getROIAnnotationRef(int ROIIndex, int annotationRefIndex) { // Parents: {u'OME': None} // AnnotationRef is reference and occurs more than once return root.getROI(ROIIndex).getLinkedAnnotation(annotationRefIndex).getID(); }
public String getROIName(int ROIIndex) { // Parents: {u'OME': None} // Name is not a reference return root.getROI(ROIIndex).getName(); }
public String getROIDescription(int ROIIndex) { // Parents: {u'OME': None} // Description is not a reference return root.getROI(ROIIndex).getDescription(); }
public Element asXMLElement(Document document) { return asXMLElement(document, null); }
public void setEllipseFontStyle(FontStyle fontStyle, int ROIIndex, int shapeIndex) { // Parents: None // FontStyle is not a reference OME o0 = root; if (o0.sizeOfROIList() == ROIIndex) { o0.addROI(new ROI()); } ROI o1 = o0.getROI(ROIIndex); if (o1.getUnion() == null) { o1.setUnion(new Union()); } Union o2 = o1.getUnion(); if (o2.sizeOfShapeList() == shapeIndex) { o2.addShape(new Ellipse()); } Ellipse o3 = (Ellipse) o2.getShape(shapeIndex); o3.setFontStyle(fontStyle); }
if (!element.hasAttribute("ID") && getID() == null) setID(String.valueOf( element.getAttribute("ID"))); model.addModelObject(getID(), this); setName(String.valueOf( element.getAttribute("Name"))); getChildrenByTagName(element, "Union"); if (Union_nodeList.size() > 1) setUnion(new Union( (Element) Union_nodeList.get(0), model)); getChildrenByTagName(element, "AnnotationRef"); for (Element AnnotationRef_element : AnnotationRef_nodeList) getChildrenByTagName(element, "Description"); if (Description_nodeList.size() > 1) setDescription( String.valueOf(Description_nodeList.get(0).getTextContent()));
public String getROIID(int ROIIndex) { // Parents: {u'OME': None} // ID is not a reference return root.getROI(ROIIndex).getID(); }