Search in sources :

Example 11 with OME

use of ome.xml.model.OME in project bioformats by openmicroscopy.

the class ImagingEnvironmentMapTest method testGenericExcitationSourceValid.

@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();
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) OME(ome.xml.model.OME) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) OMEModel(ome.xml.model.OMEModel) OMEModelImpl(ome.xml.model.OMEModelImpl) Test(org.testng.annotations.Test)

Example 12 with OME

use of ome.xml.model.OME in project bioformats by openmicroscopy.

the class PrintROIs method printROI.

/**
 * Print all of the shapes associated with the specified ROI.
 */
public static void printROI(IMetadata omexml, int roi) {
    String roiID = omexml.getROIID(roi);
    System.out.println("ROI #" + roi + " (ID = " + roiID + ")");
    System.out.println("  Name = " + omexml.getROIName(roi));
    int shapeCount = omexml.getShapeCount(roi);
    System.out.println("  Number of shapes = " + shapeCount);
    // Note that it is not possible to retrieve the shape's type
    // from the IMetadata object; you must use the underlying model
    // objects to determine the shape type.
    OME root = (OME) omexml.getRoot();
    Union allShapes = root.getROI(roi).getUnion();
    for (int shape = 0; shape < shapeCount; shape++) {
        Shape shapeObject = allShapes.getShape(shape);
        printShape(shapeObject);
    }
}
Also used : Shape(ome.xml.model.Shape) OME(ome.xml.model.OME) Point(ome.xml.model.Point) Union(ome.xml.model.Union)

Example 13 with OME

use of ome.xml.model.OME in project bioformats by openmicroscopy.

the class BackReferenceTest method testPlateWellReferences.

@Test
public void testPlateWellReferences() {
    metadata.setPlateID("Plate:0", 0);
    metadata.setWellID("Well:0:0", 0, 0);
    OME root = (OME) metadata.getRoot();
    Plate plate = root.getPlate(0);
    Well well = plate.getWell(0);
    assertNotNull(plate);
    assertNotNull(well);
    assertEquals(plate, well.getPlate());
}
Also used : OME(ome.xml.model.OME) Well(ome.xml.model.Well) Plate(ome.xml.model.Plate) Test(org.testng.annotations.Test)

Example 14 with OME

use of ome.xml.model.OME in project bioformats by openmicroscopy.

the class FakeReader method populateSPW.

private int populateSPW(MetadataStore store, int screens, int plates, int rows, int cols, int fields, int acqs, boolean withMicrobeam) {
    final XMLMockObjects xml = new XMLMockObjects();
    OME ome = null;
    if (screens == 0) {
        ome = xml.createPopulatedPlate(plates, rows, cols, fields, acqs, withMicrobeam);
    } else {
        ome = xml.createPopulatedScreen(screens, plates, rows, cols, fields, acqs, withMicrobeam);
    }
    if (withMicrobeam)
        roiCount = roiCount + plates;
    ;
    getOmeXmlMetadata().setRoot(new OMEXMLMetadataRoot(ome));
    // copy populated SPW metadata into destination MetadataStore
    getOmeXmlService().convertMetadata(omeXmlMetadata, store);
    domains = new String[] { FormatTools.HCS_DOMAIN };
    return ome.sizeOfImageList();
}
Also used : XMLMockObjects(ome.specification.XMLMockObjects) OME(ome.xml.model.OME) OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot)

Aggregations

OME (ome.xml.model.OME)14 Test (org.testng.annotations.Test)9 DocumentBuilder (javax.xml.parsers.DocumentBuilder)8 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)8 OMEModel (ome.xml.model.OMEModel)8 OMEModelImpl (ome.xml.model.OMEModelImpl)8 Document (org.w3c.dom.Document)8 Element (org.w3c.dom.Element)7 MapPair (ome.xml.model.MapPair)3 Point (ome.xml.model.Point)3 ImagePlus (ij.ImagePlus)2 EllipseRoi (ij.gui.EllipseRoi)2 Line (ij.gui.Line)2 OvalRoi (ij.gui.OvalRoi)2 PointRoi (ij.gui.PointRoi)2 PolygonRoi (ij.gui.PolygonRoi)2 Roi (ij.gui.Roi)2 ShapeRoi (ij.gui.ShapeRoi)2 TextRoi (ij.gui.TextRoi)2 OMEXMLMetadata (loci.formats.ome.OMEXMLMetadata)2