Search in sources :

Example 1 with TimestampAnnotation

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

the class ObjectBasedOMEModelMock method makePlate.

private Plate makePlate() {
    Plate plate = new Plate();
    plate.setID(InOutCurrentTest.PLATE_ID);
    plate.setRows(InOutCurrentTest.WELL_ROWS);
    plate.setColumns(InOutCurrentTest.WELL_COLS);
    plate.setRowNamingConvention(InOutCurrentTest.WELL_ROW);
    plate.setColumnNamingConvention(InOutCurrentTest.WELL_COL);
    TimestampAnnotation plateAnnotation = new TimestampAnnotation();
    plateAnnotation.setID(InOutCurrentTest.PLATE_ANNOTATION_ID);
    plateAnnotation.setValue(new Timestamp(InOutCurrentTest.PLATE_ANNOTATION_VALUE));
    plateAnnotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE);
    plate.linkAnnotation(plateAnnotation);
    annotations.addTimestampAnnotation(plateAnnotation);
    int wellSampleIndex = 0;
    for (int row = 0; row < InOutCurrentTest.WELL_ROWS.getValue(); row++) {
        for (int col = 0; col < InOutCurrentTest.WELL_COLS.getValue(); col++) {
            Well well = new Well();
            well.setID(String.format("Well:%d_%d", row, col));
            well.setRow(new NonNegativeInteger(row));
            well.setColumn(new NonNegativeInteger(col));
            if (row == 0 && col == 0) {
                LongAnnotation annotation = new LongAnnotation();
                annotation.setID(InOutCurrentTest.WELL_ANNOTATION_ID);
                annotation.setValue(InOutCurrentTest.WELL_ANNOTATION_VALUE);
                annotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE);
                well.linkAnnotation(annotation);
                annotations.addLongAnnotation(annotation);
            }
            WellSample sample = new WellSample();
            sample.setID(String.format("WellSample:%d_%d", row, col));
            sample.setIndex(new NonNegativeInteger(wellSampleIndex));
            sample.linkImage(ome.getImage(0));
            well.addWellSample(sample);
            plate.addWell(well);
            wellSampleIndex++;
        }
    }
    return plate;
}
Also used : TimestampAnnotation(ome.xml.model.TimestampAnnotation) NonNegativeInteger(ome.xml.model.primitives.NonNegativeInteger) Well(ome.xml.model.Well) LongAnnotation(ome.xml.model.LongAnnotation) WellSample(ome.xml.model.WellSample) Timestamp(ome.xml.model.primitives.Timestamp) Plate(ome.xml.model.Plate)

Example 2 with TimestampAnnotation

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

the class InOutCurrentTest method testValidPlateAnnotation.

@Test(dependsOnMethods = { "testValidPlateNode" })
public void testValidPlateAnnotation() {
    Annotation n = ome.getPlate(0).getLinkedAnnotation(0);
    assertNotNull(n);
    assertEquals(PLATE_ANNOTATION_ID, n.getID());
    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE);
    assertTrue(n instanceof TimestampAnnotation);
    TimestampAnnotation timestamp = (TimestampAnnotation) n;
    assertEquals(timestamp.getValue(), PLATE_ANNOTATION_VALUE);
}
Also used : TimestampAnnotation(ome.xml.model.TimestampAnnotation) ListAnnotation(ome.xml.model.ListAnnotation) CommentAnnotation(ome.xml.model.CommentAnnotation) Annotation(ome.xml.model.Annotation) LongAnnotation(ome.xml.model.LongAnnotation) TimestampAnnotation(ome.xml.model.TimestampAnnotation) XMLAnnotation(ome.xml.model.XMLAnnotation) BooleanAnnotation(ome.xml.model.BooleanAnnotation) Test(org.testng.annotations.Test)

Aggregations

LongAnnotation (ome.xml.model.LongAnnotation)2 TimestampAnnotation (ome.xml.model.TimestampAnnotation)2 Annotation (ome.xml.model.Annotation)1 BooleanAnnotation (ome.xml.model.BooleanAnnotation)1 CommentAnnotation (ome.xml.model.CommentAnnotation)1 ListAnnotation (ome.xml.model.ListAnnotation)1 Plate (ome.xml.model.Plate)1 Well (ome.xml.model.Well)1 WellSample (ome.xml.model.WellSample)1 XMLAnnotation (ome.xml.model.XMLAnnotation)1 NonNegativeInteger (ome.xml.model.primitives.NonNegativeInteger)1 Timestamp (ome.xml.model.primitives.Timestamp)1 Test (org.testng.annotations.Test)1