Search in sources :

Example 1 with TiffData

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

the class InOutCurrentTest method testValidTiffDataNode.

@Test(dependsOnMethods = { "testValidPixelsNode" })
public void testValidTiffDataNode() {
    TiffData tiffData = ome.getImage(0).getPixels().getTiffData(0);
    UUID uuid = tiffData.getUUID();
    assertEquals(TIFF_DATA_UUID, uuid.getValue());
}
Also used : TiffData(ome.xml.model.TiffData) UUID(ome.xml.model.UUID) Test(org.testng.annotations.Test)

Example 2 with TiffData

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

the class ObjectBasedOMEModelMock method makeImage.

private Image makeImage() {
    // Create <Image/>
    Image image = new Image();
    image.setID(InOutCurrentTest.IMAGE_ID);
    ListAnnotation listAnnotation = new ListAnnotation();
    listAnnotation.setID(InOutCurrentTest.IMAGE_LIST_ANNOTATION_ID);
    listAnnotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE);
    annotations.addListAnnotation(listAnnotation);
    BooleanAnnotation annotation = new BooleanAnnotation();
    annotation.setID(InOutCurrentTest.IMAGE_ANNOTATION_ID);
    annotation.setValue(InOutCurrentTest.IMAGE_ANNOTATION_VALUE);
    annotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE);
    listAnnotation.linkAnnotation(annotation);
    image.linkAnnotation(listAnnotation);
    annotations.addBooleanAnnotation(annotation);
    // Create <Pixels/>
    Pixels pixels = new Pixels();
    pixels.setID(InOutCurrentTest.PIXELS_ID);
    pixels.setSizeX(new PositiveInteger(InOutCurrentTest.SIZE_X));
    pixels.setSizeY(new PositiveInteger(InOutCurrentTest.SIZE_Y));
    pixels.setSizeZ(new PositiveInteger(InOutCurrentTest.SIZE_Z));
    pixels.setSizeC(new PositiveInteger(InOutCurrentTest.SIZE_C));
    pixels.setSizeT(new PositiveInteger(InOutCurrentTest.SIZE_T));
    pixels.setDimensionOrder(InOutCurrentTest.DIMENSION_ORDER);
    pixels.setType(InOutCurrentTest.PIXEL_TYPE);
    // Create <TiffData/>
    TiffData tiffData = new TiffData();
    // Create <UUID/>
    UUID uuid = new UUID();
    uuid.setValue(InOutCurrentTest.TIFF_DATA_UUID);
    tiffData.setUUID(uuid);
    pixels.addTiffData(tiffData);
    // Create <Channel/> under <Pixels/>
    for (int i = 0; i < InOutCurrentTest.SIZE_C; i++) {
        Channel channel = new Channel();
        channel.setID("Channel:" + i);
        if (i == 0) {
            XMLAnnotation channelAnnotation = new XMLAnnotation();
            channelAnnotation.setID(InOutCurrentTest.CHANNEL_ANNOTATION_ID);
            channelAnnotation.setValue(InOutCurrentTest.CHANNEL_ANNOTATION_VALUE);
            channelAnnotation.setNamespace(InOutCurrentTest.GENERAL_ANNOTATION_NAMESPACE);
            channel.linkAnnotation(channelAnnotation);
            annotations.addXMLAnnotation(channelAnnotation);
        }
        pixels.addChannel(channel);
    }
    // Put <Pixels/> under <Image/>
    image.setPixels(pixels);
    return image;
}
Also used : BooleanAnnotation(ome.xml.model.BooleanAnnotation) PositiveInteger(ome.xml.model.primitives.PositiveInteger) TiffData(ome.xml.model.TiffData) Channel(ome.xml.model.Channel) ListAnnotation(ome.xml.model.ListAnnotation) XMLAnnotation(ome.xml.model.XMLAnnotation) Image(ome.xml.model.Image) UUID(ome.xml.model.UUID) Pixels(ome.xml.model.Pixels)

Example 3 with TiffData

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

the class OMEXMLServiceImpl method removeTiffData.

/**
 * @see OMEXMLService#removeTiffData(OMEXMLMetadata)
 */
@Override
public void removeTiffData(OMEXMLMetadata omexmlMeta) {
    omexmlMeta.resolveReferences();
    OMEXMLMetadataRoot root = (OMEXMLMetadataRoot) omexmlMeta.getRoot();
    List<Image> images = root.copyImageList();
    for (Image img : images) {
        Pixels pix = img.getPixels();
        List<TiffData> tiffData = pix.copyTiffDataList();
        for (TiffData tiff : tiffData) {
            pix.removeTiffData(tiff);
        }
        pix.setMetadataOnly(null);
    }
    omexmlMeta.setRoot(root);
}
Also used : TiffData(ome.xml.model.TiffData) OMEXMLMetadataRoot(ome.xml.meta.OMEXMLMetadataRoot) Image(ome.xml.model.Image) Pixels(ome.xml.model.Pixels)

Aggregations

TiffData (ome.xml.model.TiffData)3 Image (ome.xml.model.Image)2 Pixels (ome.xml.model.Pixels)2 UUID (ome.xml.model.UUID)2 OMEXMLMetadataRoot (ome.xml.meta.OMEXMLMetadataRoot)1 BooleanAnnotation (ome.xml.model.BooleanAnnotation)1 Channel (ome.xml.model.Channel)1 ListAnnotation (ome.xml.model.ListAnnotation)1 XMLAnnotation (ome.xml.model.XMLAnnotation)1 PositiveInteger (ome.xml.model.primitives.PositiveInteger)1 Test (org.testng.annotations.Test)1