Search in sources :

Example 6 with Plate

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

the class FileWriteSPW method export.

/**
 * Save a single byte plane of data.
 * @param plane  data
 * @param series  image no in plate
 * @param index t plane within image
 */
private void export(byte[] plane, int series, int index, String imageDescription) {
    Exception exception = null;
    if (initializationSuccess) {
        if (series != writer.getSeries()) {
            try {
                writer.setSeries(series);
            } catch (FormatException e) {
                exception = e;
            }
        }
        try {
            writer.saveBytes(index, plane);
            if (index == 0) {
                OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) omexml.getRoot();
                Plate plate = root.getPlate(0);
                Image im = root.getImage(series);
                im.setDescription(imageDescription);
            }
            expectedImages[series]++;
        } catch (FormatException | IOException e) {
            exception = e;
        }
    }
    if (exception != null) {
        System.err.println("Failed to write data!");
    }
}
Also used : OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot) IOException(java.io.IOException) Image(ome.xml.model.Image) EnumerationException(ome.xml.model.enums.EnumerationException) ServiceException(loci.common.services.ServiceException) DependencyException(loci.common.services.DependencyException) FormatException(loci.formats.FormatException) IOException(java.io.IOException) FormatException(loci.formats.FormatException) Plate(ome.xml.model.Plate)

Example 7 with Plate

use of ome.xml.model.Plate 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)

Aggregations

Plate (ome.xml.model.Plate)7 Well (ome.xml.model.Well)6 WellSample (ome.xml.model.WellSample)4 Image (ome.xml.model.Image)3 Test (org.testng.annotations.Test)3 IOException (java.io.IOException)2 OMEXMLMetadataRoot (ome.xml.meta.OMEXMLMetadataRoot)2 NonNegativeInteger (ome.xml.model.primitives.NonNegativeInteger)2 PositiveInteger (ome.xml.model.primitives.PositiveInteger)2 ArrayList (java.util.ArrayList)1 DependencyException (loci.common.services.DependencyException)1 ServiceException (loci.common.services.ServiceException)1 FormatException (loci.formats.FormatException)1 LongAnnotation (ome.xml.model.LongAnnotation)1 OME (ome.xml.model.OME)1 StructuredAnnotations (ome.xml.model.StructuredAnnotations)1 TimestampAnnotation (ome.xml.model.TimestampAnnotation)1 XMLAnnotation (ome.xml.model.XMLAnnotation)1 EnumerationException (ome.xml.model.enums.EnumerationException)1 Timestamp (ome.xml.model.primitives.Timestamp)1