diff --git a/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceAPI.java b/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceAPI.java index a50e2a5..b66bfdb 100644 --- a/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceAPI.java +++ b/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceAPI.java @@ -20,6 +20,7 @@ import qupath.lib.images.servers.PixelType; import java.io.IOException; +import java.util.ArrayList; import java.util.List; /** @@ -131,30 +132,14 @@ public PixelAPIReader createReader(long id, ImageServerMetadata metadata) throws throw new IllegalArgumentException("The provided image cannot be read by this API"); } - return new IceReader( - List.of( - new LoginCredentials( - sessionUuid, - sessionUuid, - apisHandler.getWebServerURI().getHost(), - apisHandler.getServerPort() - ), - new LoginCredentials( - sessionUuid, - sessionUuid, - apisHandler.getServerURI(), - apisHandler.getServerPort() - ), - new LoginCredentials( - sessionUuid, - sessionUuid, - serverAddress.get(), - serverPort.get() - ) - ), - id, - metadata.getChannels() - ); + List credentials = new ArrayList<>(); + credentials.add(new LoginCredentials(sessionUuid, sessionUuid, apisHandler.getWebServerURI().getHost(), apisHandler.getServerPort())); + credentials.add(new LoginCredentials(sessionUuid, sessionUuid, apisHandler.getServerURI(), apisHandler.getServerPort())); + if (serverAddress.get() != null) { + credentials.add(new LoginCredentials(sessionUuid, sessionUuid, serverAddress.get(), serverPort.get())); + } + + return new IceReader(credentials, id, metadata.getChannels()); } @Override diff --git a/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceReader.java b/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceReader.java index 8d818b1..5132a10 100644 --- a/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceReader.java +++ b/src/main/java/qupath/ext/omero/core/pixelapis/ice/IceReader.java @@ -145,15 +145,25 @@ public String toString() { } private Optional connect(List loginCredentials) { - for (LoginCredentials loginCredential: loginCredentials) { + for (int i=0; i