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());
}
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;
}
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);
}
Aggregations