Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the PixelsService to be runtime configured #142

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ dependencies {
implementation 'io.zipkin.reporter2:zipkin-sender-okhttp3:2.10.0'
implementation 'ch.qos.logback:logback-classic:1.3.14'
implementation 'org.slf4j:log4j-over-slf4j:1.7.32'
implementation 'com.glencoesoftware.omero:omero-zarr-pixel-buffer:0.3.0'
implementation 'com.glencoesoftware.omero:omero-ms-core:0.8.0'
implementation 'com.glencoesoftware.omero:omero-zarr-pixel-buffer:0.4.0-SNAPSHOT'
implementation 'com.glencoesoftware.omero:omero-ms-core:0.9.0-SNAPSHOT'
implementation 'io.vertx:vertx-web:3.8.1'
implementation 'io.vertx:vertx-config:3.8.1'
implementation 'io.vertx:vertx-config-yaml:3.8.1'
Expand Down
1 change: 1 addition & 0 deletions src/dist/conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ omero.server:
# The following should be set to match your OMERO.web settings
# See https://docs.openmicroscopy.org/omero/5.6.3/sysadmins/config.html#omero-client-viewer-interpolate-pixels
# and https://docs.openmicroscopy.org/omero/5.6.3/sysadmins/config.html#omero-client-viewer-initial-zoom-level
omero.pixeldata.pixels_service: "ZarrPixelsService"
omero.pixeldata.zarr_cache_size: "500"
omero.client.viewer.initial_zoom_level: "0"
omero.client.viewer.interpolate_pixels: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package com.glencoesoftware.omero.ms.image.region;

import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -59,15 +61,15 @@ public class HistogramRequestHandler {
HistogramCtx histogramCtx;

/** OMERO server pixels service. */
private PixelsService pixelsService;
private ZarrPixelsService pixelsService;

/**
* Constructor. Populates histogramCtx and pixelsService
* @param histogramCtx
* @param pixelsService
*/
public HistogramRequestHandler(HistogramCtx histogramCtx,
PixelsService pixelsService) {
ZarrPixelsService pixelsService) {
this.histogramCtx = histogramCtx;
this.pixelsService = pixelsService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package com.glencoesoftware.omero.ms.image.region;

import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -76,7 +78,7 @@ public class ImageDataRequestHandler {
private ImageDataCtx imageDataCtx;

/** OMERO server pixels service. */
private PixelsService pixelsService;
private ZarrPixelsService pixelsService;

/** Initial Zoom level from server settings **/
private int initZoom;
Expand All @@ -92,7 +94,7 @@ public class ImageDataRequestHandler {
* @param interpolate Interpolation server setting
*/
public ImageDataRequestHandler(ImageDataCtx imageDataCtx,
PixelsService pixelsService,
ZarrPixelsService pixelsService,
int initZoom, boolean interpolate) {
this.imageDataCtx = imageDataCtx;
this.pixelsService = pixelsService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public void deploy(JsonObject config, Promise<Void> prom) {
context = new ClassPathXmlApplicationContext(
"classpath:ome/config.xml",
"classpath:ome/services/datalayer.xml",
"classpath*:blitz/*PixelBuffer.xml",
"classpath*:beanRefContext.xml");
preferences =
(PreferenceContext) this.context.getBean("preferenceContext");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package com.glencoesoftware.omero.ms.image.region;

import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -90,7 +92,7 @@ public class ImageRegionRequestHandler {
protected final List<RenderingModel> renderingModels;

/** OMERO server pixels service. */
protected final PixelsService pixelsService;
protected final ZarrPixelsService pixelsService;

/** Reference to the projection service. */
private final ProjectionService projectionService;
Expand All @@ -112,7 +114,7 @@ public ImageRegionRequestHandler(
LutProvider lutProvider,
LocalCompress compressionSrv,
int maxTileLength,
PixelsService pixelsService) {
ZarrPixelsService pixelsService) {
this.compressionSrv = compressionSrv;
this.lutProvider = lutProvider;
this.families = families;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.glencoesoftware.omero.ms.core.OmeroMsAbstractVerticle;
import com.glencoesoftware.omero.ms.core.OmeroRequest;
import com.glencoesoftware.omero.ms.core.RedisCacheVerticle;
import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import Glacier2.CannotCreateSessionException;
import Glacier2.PermissionDeniedException;
Expand Down Expand Up @@ -92,7 +93,7 @@ public class ImageRegionVerticle extends OmeroMsAbstractVerticle {
/** Configured maximum size size in either dimension */
private final int maxTileLength;

private final PixelsService pixelsService;
private final ZarrPixelsService pixelsService;

/** Scaling service for thumbnails */
private final IScale iScale;
Expand All @@ -104,7 +105,7 @@ public ImageRegionVerticle(
LocalCompress compressionService,
LutProvider lutProvider,
int maxTileLength,
PixelsService pixelsService,
ZarrPixelsService pixelsService,
IScale iScale)
{
this.compressionService = compressionService;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

package com.glencoesoftware.omero.ms.image.region;

import com.glencoesoftware.omero.ms.core.ZarrPixelBuffer;
import com.glencoesoftware.omero.zarr.ZarrPixelBuffer;
import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import java.awt.Point;
import java.awt.image.BufferedImage;
Expand Down Expand Up @@ -69,15 +70,15 @@ public class ShapeMaskRequestHandler {
private final ShapeMaskCtx shapeMaskCtx;

/** Configured Pixels service */
private final PixelsService pixelsService;
private final ZarrPixelsService pixelsService;

/**
* Default constructor.
* @param shapeMaskCtx {@link ShapeMaskCtx} object
* @param pixelsService configured pixels service
*/
public ShapeMaskRequestHandler(
ShapeMaskCtx shapeMaskCtx, PixelsService pixelsService) {
ShapeMaskCtx shapeMaskCtx, ZarrPixelsService pixelsService) {
log.info("Setting up handler");
this.shapeMaskCtx = shapeMaskCtx;
this.pixelsService = pixelsService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.glencoesoftware.omero.ms.core.OmeroMsAbstractVerticle;
import com.glencoesoftware.omero.ms.core.OmeroRequest;
import com.glencoesoftware.omero.ms.core.RedisCacheVerticle;
import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import Glacier2.CannotCreateSessionException;
import Glacier2.PermissionDeniedException;
Expand Down Expand Up @@ -55,12 +56,12 @@ public class ShapeMaskVerticle extends OmeroMsAbstractVerticle {
private int port;

/** Configured Pixels service */
private final PixelsService pixelsService;
private final ZarrPixelsService pixelsService;

/**
* Default constructor.
*/
public ShapeMaskVerticle(PixelsService pixelsService)
public ShapeMaskVerticle(ZarrPixelsService pixelsService)
{
this.pixelsService = pixelsService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package com.glencoesoftware.omero.ms.image.region;

import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import java.awt.image.BufferedImage;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -74,7 +76,7 @@ public ThumbnailsRequestHandler(
LutProvider lutProvider,
LocalCompress compressionSrv,
int maxTileLength,
PixelsService pixelsService,
ZarrPixelsService pixelsService,
IScale iScale) {
super(thumbnailCtx,
families,
Expand Down
19 changes: 4 additions & 15 deletions src/main/resources/beanRefContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,10 @@
</bean>

<bean id="metrics" class="ome.system.metrics.NullMetrics"/>

<bean name="/OMERO/Pixels" class="com.glencoesoftware.omero.ms.image.region.PixelsService"
parent="filesystem">
<!-- index=0 "path" comes from parent -->
<constructor-arg index="2" value="${omero.pixeldata.memoizer.dir}"/>
<constructor-arg index="3" ref="MemoizerWait"/>
<constructor-arg index="4" ref="omeroFilePathResolver"/>
<constructor-arg index="5" ref="backOff"/>
<constructor-arg index="6" ref="tileSizes"/>
<constructor-arg index="7" ><null /></constructor-arg>
<constructor-arg index="8" value="${omero.pixeldata.zarr_cache_size:500}" />
<constructor-arg index="9" value="${omero.pixeldata.max_plane_width:3192}" />
<constructor-arg index="10" value="${omero.pixeldata.max_plane_height:3192}" />
<property name="metrics" ref="metrics"/>
</bean>

<bean id="internal-ome.api.IQuery" class="com.glencoesoftware.omero.ms.core.NoopQueryImpl"/>

<alias name="${omero.pixeldata.pixels_service:ZarrPixelsService}" alias="/OMERO/Pixels"/>

<bean id="iscale" class="ome.logic.JavaImageScalingService"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

package com.glencoesoftware.omero.ms.image.region;

import com.glencoesoftware.omero.ms.core.ZarrPixelBuffer;
import com.glencoesoftware.omero.zarr.ZarrPixelBuffer;
import com.glencoesoftware.omero.zarr.ZarrPixelsService;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -409,10 +410,10 @@ public void createPixelBuffer() throws IOException, ApiUsageException {
output.resolve("0"), 1024, 1024,
Caffeine.newBuilder()
.maximumSize(0)
.buildAsync(PixelsService::getZarrMetadata),
.buildAsync(ZarrPixelsService::getZarrMetadata),
Caffeine.newBuilder()
.maximumSize(0)
.buildAsync(PixelsService::getZarrArray));
.buildAsync(ZarrPixelsService::getZarrArray));
}

@Before
Expand Down
Loading