public Element asXMLElement(Document document) { return asXMLElement(document, null); }
public void setROIName(String name, int ROIIndex) { // Parents: {u'OME': None} // Name is not a reference OME o0 = root; if (o0.sizeOfROIList() == ROIIndex) { o0.addROI(new ROI()); } ROI o1 = o0.getROI(ROIIndex); o1.setName(name); }
public void setImageDescription(String description, int imageIndex) { // Parents: {u'OME': None} // Description is not a reference OME o0 = root; if (o0.sizeOfImageList() == imageIndex) { o0.addImage(new Image()); } Image o1 = o0.getImage(imageIndex); o1.setDescription(description); }
public void setPlateStatus(String status, int plateIndex) { // Parents: {u'OME': None} // Status is not a reference OME o0 = root; if (o0.sizeOfPlateList() == plateIndex) { o0.addPlate(new Plate()); } Plate o1 = o0.getPlate(plateIndex); o1.setStatus(status); }
@Test public void testOmeNode() { Assert.assertNotNull(ome); Assert.assertEquals(1, ome.sizeOfDatasetList()); Assert.assertEquals(5, ome.sizeOfExperimenterGroupList()); Assert.assertEquals(7, ome.sizeOfExperimenterList()); Assert.assertEquals(1, ome.sizeOfImageList()); Assert.assertEquals(1, ome.sizeOfInstrumentList()); Assert.assertEquals(2, ome.sizeOfPlateList()); Assert.assertEquals(1, ome.sizeOfProjectList()); Assert.assertEquals(5, ome.sizeOfROIList()); Assert.assertEquals(4, ome.sizeOfScreenList()); Assert.assertNull(ome.getCreator()); Assert.assertNull(ome.getUUID()); Assert.assertNotNull(ome.getStructuredAnnotations()); }
public void setInstrumentID(String id, int instrumentIndex) { // Parents: {u'OME': None} // ID is not a reference OME o0 = root; if (o0.sizeOfInstrumentList() == instrumentIndex) { o0.addInstrument(new Instrument()); } Instrument o1 = o0.getInstrument(instrumentIndex); model.addModelObject(id, o1); o1.setID(id); }
/** Sets the Map value associated with this annotation */ public void setMapAnnotationValue(List<MapPair> value, int mapAnnotationIndex) { OME o0 = root; if (o0.getStructuredAnnotations() == null) { o0.setStructuredAnnotations(new StructuredAnnotations()); } StructuredAnnotations o1 = o0.getStructuredAnnotations(); if (o1.sizeOfMapAnnotationList() == mapAnnotationIndex) { o1.addMapAnnotation(new MapAnnotation()); } MapAnnotation o2 = o1.getMapAnnotation(mapAnnotationIndex); o2.setValue(value); }
@Test public void testDate() { Assert.assertNotNull(ome); Assert.assertEquals(1, ome.sizeOfImageList()); Image image = ome.getImage(0); Assert.assertNotNull(image); Assert.assertEquals(IMAGE_DATE, image.getAcquisitionDate()); } }
public SPWModelMock(boolean makeLightSources) { ome = new OME(); annotations = new StructuredAnnotations(); ome.addInstrument(makeInstrument(makeLightSources)); for (int i = 0; i < WELL_ROWS.getValue() * WELL_COLS.getValue(); i++) { ome.addImage(makeImage(i)); } ome.addPlate(makePlate()); ome.setStructuredAnnotations(annotations); }
@Test public void validateUpgrade() throws ServiceException { assertEquals(1, ome.sizeOfImageList()); Image image = ome.getImage(0); assertNotNull(image.getAcquisitionDate()); assertEquals(1, ome.sizeOfROIList()); ROI roi = ome.getROI(0); Union union = roi.getUnion(); assertEquals(1, union.sizeOfShapeList()); Shape shape = union.getShape(0); assertTrue(shape instanceof Label); assertNotNull(shape.getText()); }
@Test public void testGenericExcitationSourceValid() throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = factory.newDocumentBuilder(); Document document = parser.newDocument(); // Produce a valid OME DOM element hierarchy Element root = ome.asXMLElement(document); SPWModelMock.postProcess(root, document, false); OMEModel model = new OMEModelImpl(); ome = new OME(document.getDocumentElement(), model); model.resolveReferences(); }
@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()); }
@Test public void validateUpgrade() throws ServiceException { assertEquals(1, ome.sizeOfImageList()); // StringAnnotation --> CommentAnnotation StructuredAnnotations structuredAnnotations = ome.getStructuredAnnotations(); assertNotNull(structuredAnnotations); assertEquals(1, structuredAnnotations.sizeOfCommentAnnotationList()); CommentAnnotation commentAnnotation = structuredAnnotations.getCommentAnnotation(0); assertEquals("StringAnnotation:0", commentAnnotation.getID()); assertEquals("Transform", commentAnnotation.getNamespace()); assertEquals("Foobar", commentAnnotation.getValue()); }
/** * Creates and returns the root element. Creates an image w/o metadata. * * @return See above. */ public OME createImage() { ome.addImage(createImage(0)); return ome; }
@Test (groups = {"11-06-u-annotation"}, dependsOnMethods = {"testOmeNode"}) public void testAnnotations() { Assert.assertNotNull(ome); annotations = ome.getStructuredAnnotations(); Assert.assertEquals(2, annotations.sizeOfXMLAnnotationList()); Assert.assertEquals(0, annotations.sizeOfBooleanAnnotationList()); Assert.assertEquals(0, annotations.sizeOfCommentAnnotationList()); Assert.assertEquals(0, annotations.sizeOfDoubleAnnotationList()); Assert.assertEquals(0, annotations.sizeOfFileAnnotationList()); Assert.assertEquals(0, annotations.sizeOfListAnnotationList()); Assert.assertEquals(0, annotations.sizeOfLongAnnotationList()); Assert.assertEquals(0, annotations.sizeOfTagAnnotationList()); Assert.assertEquals(0, annotations.sizeOfTermAnnotationList()); Assert.assertEquals(0, annotations.sizeOfTimestampAnnotationList()); }
/** Creates and populates the instrument. */ private void populateInstrument() { if (instrument != null) return; instrument = createInstrument(true); ome.addInstrument(instrument); }
@Test public void testOmeNode() { Assert.assertNotNull(ome); Assert.assertEquals(0, ome.sizeOfDatasetList()); Assert.assertEquals(0, ome.sizeOfExperimenterGroupList()); Assert.assertEquals(0, ome.sizeOfExperimenterList()); Assert.assertEquals(1, ome.sizeOfImageList()); Assert.assertEquals(1, ome.sizeOfInstrumentList()); Assert.assertEquals(0, ome.sizeOfPlateList()); Assert.assertEquals(0, ome.sizeOfProjectList()); Assert.assertEquals(0, ome.sizeOfROIList()); Assert.assertEquals(0, ome.sizeOfScreenList()); Assert.assertNull(ome.getCreator()); Assert.assertNull(ome.getUUID()); Assert.assertNull(ome.getStructuredAnnotations()); }
public void setPlateExternalIdentifier(String externalIdentifier, int plateIndex) { // Parents: {u'OME': None} // ExternalIdentifier is not a reference OME o0 = root; if (o0.sizeOfPlateList() == plateIndex) { o0.addPlate(new Plate()); } Plate o1 = o0.getPlate(plateIndex); o1.setExternalIdentifier(externalIdentifier); }
public void setInstrumentID(String id, int instrumentIndex) { // Parents: {u'OME': None} // ID is not a reference OME o0 = root; if (o0.sizeOfInstrumentList() == instrumentIndex) { o0.addInstrument(new Instrument()); } Instrument o1 = o0.getInstrument(instrumentIndex); model.addModelObject(id, o1); o1.setID(id); }