Search in sources :

Example 6 with OMEModelImpl

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

the class PumpWithLightSourceSettingsTest method testLightSourceType.

@Test
public void testLightSourceType() 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 7 with OMEModelImpl

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

the class MapAnnotationTest method testMapAnnotationValueContent.

@Test
public void testMapAnnotationValueContent() 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();
    assertNotNull(ome);
    assertEquals(ome.getImage(0).getPixels().getID(), "Pixels:0");
    assertNotNull(ome.getImage(0).getLinkedAnnotation(0));
    MapAnnotation mapAnnotation = (MapAnnotation) ome.getImage(0).getLinkedAnnotation(0);
    List<MapPair> dataMap = mapAnnotation.getValue();
    assertEquals(6, dataMap.size());
    assertEquals("a", dataMap.get(0).getName());
    assertEquals("1", dataMap.get(0).getValue());
    assertEquals("d", dataMap.get(1).getName());
    assertEquals("2", dataMap.get(1).getValue());
    assertEquals("c", dataMap.get(2).getName());
    assertEquals("3", dataMap.get(2).getValue());
    assertEquals("b", dataMap.get(3).getName());
    assertEquals("4", dataMap.get(3).getValue());
    assertEquals("e", dataMap.get(4).getName());
    assertEquals("5", dataMap.get(4).getValue());
    assertEquals("c", dataMap.get(5).getName());
    assertEquals("6", dataMap.get(5).getValue());
}
Also used : MapPair(ome.xml.model.MapPair) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) MapAnnotation(ome.xml.model.MapAnnotation) 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 8 with OMEModelImpl

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

the class MapAnnotationTest method testMapAnnotationValid.

@Test
public void testMapAnnotationValid() 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 9 with OMEModelImpl

use of ome.xml.model.OMEModelImpl 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 10 with OMEModelImpl

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

the class InOutCurrentTest method testValidOMENode.

@Test
public void testValidOMENode() throws EnumerationException {
    model = new OMEModelImpl();
    // Read string XML in as a DOM tree and parse into the object hierarchy
    ome = new OMEXMLMetadataRoot(document.getDocumentElement(), model);
    model.resolveReferences();
    assertNotNull(ome);
    assertEquals(1, ome.sizeOfImageList());
}
Also used : OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot) OMEModelImpl(ome.xml.model.OMEModelImpl) Test(org.testng.annotations.Test)

Aggregations

OMEModelImpl (ome.xml.model.OMEModelImpl)10 OMEModel (ome.xml.model.OMEModel)9 DocumentBuilder (javax.xml.parsers.DocumentBuilder)8 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)8 OME (ome.xml.model.OME)8 Test (org.testng.annotations.Test)8 Document (org.w3c.dom.Document)8 Element (org.w3c.dom.Element)7 MapPair (ome.xml.model.MapPair)3 OMEXMLMetadataRoot (ome.xml.meta.OMEXMLMetadataRoot)2 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)1 TransformerException (javax.xml.transform.TransformerException)1 ServiceException (loci.common.services.ServiceException)1 GenericExcitationSource (ome.xml.model.GenericExcitationSource)1 ImagingEnvironment (ome.xml.model.ImagingEnvironment)1 MapAnnotation (ome.xml.model.MapAnnotation)1 BeforeClass (org.testng.annotations.BeforeClass)1 SAXException (org.xml.sax.SAXException)1