use of omero.model.FileAnnotationI in project imagej-omero by imagej.
the class ModuleAdapter method attachTablesToImages.
/**
* Attaches the tables to the input images. This also adds the Table ids to
* the omero client.
*/
private void attachTablesToImages(final List<ImageData> images, final HashMap<String, TableData> tables, final SecurityContext ctx, final DataManagerFacility dm) throws DSOutOfServiceException, DSAccessException, ExecutionException, ServerError {
final TablesFacility tablesFacility = gateway.getFacility(TablesFacility.class);
for (final String name : tables.keySet()) {
final TableData t = tablesFacility.addTable(ctx, images.get(0), name, tables.get(name));
client.setOutput(name, omero.rtypes.rlong(t.getOriginalFileId()));
}
// Adding tables again would create new tables on the server
for (int i = 1; i < images.size(); i++) {
for (final String name : tables.keySet()) {
final OriginalFile file = new OriginalFileI(tables.get(name).getOriginalFileId(), false);
final FileAnnotation anno = new FileAnnotationI();
anno.setFile(file);
FileAnnotationData annotation = new FileAnnotationData(anno);
annotation.setDescription(name);
annotation = (FileAnnotationData) dm.saveAndReturnObject(ctx, annotation);
dm.attachAnnotation(ctx, annotation, images.get(i));
}
}
}
Aggregations