|
1 | 1 | package qupath.ext.omero.core.apis;
|
2 | 2 |
|
3 | 3 | import com.drew.lang.annotations.Nullable;
|
4 |
| -import javafx.beans.property.*; |
| 4 | +import javafx.beans.property.ReadOnlyBooleanProperty; |
| 5 | +import javafx.beans.property.ReadOnlyIntegerProperty; |
5 | 6 | import org.slf4j.Logger;
|
6 | 7 | import org.slf4j.LoggerFactory;
|
7 | 8 | import qupath.ext.omero.core.entities.annotations.AnnotationGroup;
|
|
14 | 15 | import qupath.ext.omero.core.entities.search.SearchQuery;
|
15 | 16 | import qupath.ext.omero.core.entities.search.SearchResult;
|
16 | 17 | import qupath.ext.omero.core.entities.shapes.Shape;
|
17 |
| -import qupath.lib.images.servers.*; |
18 |
| -import qupath.ext.omero.core.WebClient; |
19 | 18 | import qupath.ext.omero.core.WebUtilities;
|
20 | 19 | import qupath.ext.omero.core.entities.imagemetadata.ImageMetadataResponse;
|
21 | 20 | import qupath.ext.omero.core.entities.permissions.Group;
|
22 | 21 | import qupath.ext.omero.core.entities.permissions.Owner;
|
23 | 22 | import qupath.ext.omero.core.entities.repositoryentities.serverentities.image.Image;
|
| 23 | +import qupath.lib.images.servers.PixelType; |
| 24 | +import qupath.lib.images.servers.TileRequest; |
24 | 25 |
|
25 | 26 | import java.awt.image.BufferedImage;
|
26 | 27 | import java.net.URI;
|
@@ -75,12 +76,11 @@ private ApisHandler(URI host, JsonApi jsonApi, boolean canSkipAuthentication) {
|
75 | 76 | * <p>Attempt to create a request handler.</p>
|
76 | 77 | * <p>This function is asynchronous.</p>
|
77 | 78 | *
|
78 |
| - * @param client the corresponding web client |
79 | 79 | * @param host the base server URI (e.g. <a href="https://idr.openmicroscopy.org">https://idr.openmicroscopy.org</a>)
|
80 | 80 | * @return a CompletableFuture with the request handler, an empty Optional if an error occurred
|
81 | 81 | */
|
82 |
| - public static CompletableFuture<Optional<ApisHandler>> create(WebClient client, URI host) { |
83 |
| - return JsonApi.create(client, host).thenApplyAsync(jsonApi -> { |
| 82 | + public static CompletableFuture<Optional<ApisHandler>> create(URI host) { |
| 83 | + return JsonApi.create(host).thenApplyAsync(jsonApi -> { |
84 | 84 | if (jsonApi.isPresent()) {
|
85 | 85 | try {
|
86 | 86 | return Optional.of(new ApisHandler(host, jsonApi.get(), jsonApi.get().canSkipAuthentication().get()));
|
@@ -280,17 +280,27 @@ public CompletableFuture<Optional<Image>> getImage(long imageID) {
|
280 | 280 | }
|
281 | 281 |
|
282 | 282 | /**
|
283 |
| - * See {@link JsonApi#getNumberOfOrphanedImages()}. |
| 283 | + * <p>Attempt to get the number of orphaned images of this server.</p> |
| 284 | + * |
| 285 | + * @return a CompletableFuture with the number of orphaned images, or 0 if it couldn't be retrieved |
284 | 286 | */
|
285 | 287 | public CompletableFuture<Integer> getNumberOfOrphanedImages() {
|
286 |
| - return jsonApi.getNumberOfOrphanedImages(); |
| 288 | + return getOrphanedImagesIds().thenApply(jsonApi::getNumberOfOrphanedImages); |
287 | 289 | }
|
288 | 290 |
|
289 | 291 | /**
|
290 |
| - * See {@link JsonApi#populateOrphanedImagesIntoList(List)}. |
| 292 | + * <p> |
| 293 | + * Populate all orphaned images of this server to the list specified in parameter. |
| 294 | + * This function populates and doesn't return a list because the number of images can |
| 295 | + * be large, so this operation can take tens of seconds. |
| 296 | + * </p> |
| 297 | + * <p>The list can be updated from any thread.</p> |
| 298 | + * |
| 299 | + * @param children the list which should be populated by the orphaned images. It should |
| 300 | + * be possible to add elements to this list |
291 | 301 | */
|
292 | 302 | public void populateOrphanedImagesIntoList(List<Image> children) {
|
293 |
| - jsonApi.populateOrphanedImagesIntoList(children); |
| 303 | + getOrphanedImagesIds().thenAccept(orphanedImageIds -> jsonApi.populateOrphanedImagesIntoList(children, orphanedImageIds)); |
294 | 304 | }
|
295 | 305 |
|
296 | 306 | /**
|
|
0 commit comments