use of omero.gateway.facility.BrowseFacility in project imagej-omero by imagej.
the class DefaultOMEROService method uploadTable.
@Override
public long uploadTable(final OMEROCredentials credentials, final String name, final Table<?, ?> imageJTable, final long imageID) throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
final TableData omeroTable = convertOMEROTable(imageJTable);
long id = -1;
try (final OMEROSession session = new DefaultOMEROSession(credentials)) {
// Get image
final BrowseFacility browseFacility = session.getGateway().getFacility(BrowseFacility.class);
final ImageData image = browseFacility.getImage(session.getSecurityContext(), imageID);
// attach table to image
final TablesFacility tablesFacility = session.getGateway().getFacility(TablesFacility.class);
final TableData stored = tablesFacility.addTable(session.getSecurityContext(), image, name, omeroTable);
id = stored.getOriginalFileId();
}
return id;
}
use of omero.gateway.facility.BrowseFacility in project imagej-omero by imagej.
the class ModuleAdapter method createOutputLinks.
/**
* Attempts to attach the outputs to the appropriate items.
*/
private void createOutputLinks(final HashMap<String, Object> inputMap, final HashMap<String, TableData> tables) throws ExecutionException, ServerError, DSOutOfServiceException, DSAccessException {
final ExperimenterData user = createUser();
final BrowseFacility browse = gateway.getFacility(BrowseFacility.class);
final DataManagerFacility dm = gateway.getFacility(DataManagerFacility.class);
final SecurityContext ctx = new SecurityContext(user.getGroupId());
final List<ImageData> outImages = getOutputImages(user.getId(), browse, ctx);
final List<ImageData> inputImages = getInputImages(inputMap, browse, ctx);
if (!outImages.isEmpty()) {
attachImagesToDatasets(inputImages, outImages, dm, browse, ctx);
}
if (!tables.isEmpty()) {
if (inputImages.isEmpty())
throw new IllegalArgumentException("Input image(s) required to upload table to OMERO");
attachTablesToImages(inputImages, tables, ctx, dm);
}
}
Aggregations