diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java index 20d46f6f18af940d10248e032b3b7b99b0da1738..b2691bee8a6fca5fae8581306ab19062c2606723 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/generic/server/AbstractImagesDownloadServlet.java @@ -122,7 +122,11 @@ abstract class AbstractImagesDownloadServlet extends AbstractDatasetDownloadServ private static Integer tryGetIntParam(HttpServletRequest request, String paramName) { - String value = getParam(request, paramName); + String value = request.getParameter(paramName); + if (value == null) + { + return null; + } try { return Integer.valueOf(value); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java index d9e8ebd3a3e6ebc132f4b5add99a133197314f45..b480205be9ebb191186c105f55421591192feeb2 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientService.java @@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages; @@ -103,7 +103,7 @@ public interface IScreeningClientService extends IClientService throws UserFailureException; /** Lists all images for a given well in the given dataset */ - public List<ChannelStackImageReference> listImageChannelStacks(String datasetCode, + public List<ImageChannelStackReference> listImageChannelStacks(String datasetCode, String datastoreCode, WellLocation wellLocation); /** diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java index 1f2f678291b251ee95ac0423d47dfd36175c9bd0..ced06948de770a2198498b77f2492192550575d4 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/IScreeningClientServiceAsync.java @@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages; @@ -92,7 +92,7 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync */ public void listImageChannelStacks(String datasetCode, String datastoreCode, WellLocation wellLocation, - AsyncCallback<List<ChannelStackImageReference>> abstractAsyncCallback); + AsyncCallback<List<ImageChannelStackReference>> abstractAsyncCallback); /** * @see IScreeningClientService#registerLibrary(LibraryRegistrationInfo) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ImageUrlUtils.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ImageUrlUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..199e3682f3f085372a3e6aa112ea9af7e01a4ab8 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/ImageUrlUtils.java @@ -0,0 +1,120 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; + +import com.extjs.gxt.ui.client.widget.Component; +import com.extjs.gxt.ui.client.widget.Html; +import com.extjs.gxt.ui.client.widget.LayoutContainer; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.renderers.SimpleImageHtmlRenderer; +import ch.systemsx.cisd.openbis.generic.shared.basic.URLMethodWithParameters; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants; + +/** + * Generates URLs pointing to the images on Data Store server. + * + * @author Tomasz Pylak + */ +public class ImageUrlUtils +{ + /** + * Creates a widget which displays the URL to the specified image on DSS and adds it to the + * container. + */ + public static void addImageUrlWidget(LayoutContainer container, String sessionId, + WellImages images, String channel, int row, int col, int imageWidth, int imageHeight) + { + String imageURL = + createDatastoreImageUrl(sessionId, images, channel, row, col, imageWidth, + imageHeight); + addUrlWidget(container, imageURL, imageHeight); + } + + /** + * Creates a widget which displays the URL to the specified image on DSS and adds it to the + * container. + */ + public static void addImageUrlWidget(LayoutContainer container, String sessionId, + WellImages images, String channel, ImageChannelStackReference channelStackRef, + int imageWidth, int imageHeight) + { + String imageURL = + createDatastoreImageUrl(sessionId, images, channel, channelStackRef, imageWidth, + imageHeight); + addUrlWidget(container, imageURL, imageHeight); + } + + /** generates URL of an image on Data Store server */ + private static String createDatastoreImageUrl(String sessionID, WellImages images, + String channel, ImageChannelStackReference channelStackRef, int width, int height) + { + URLMethodWithParameters methodWithParameters = + createBasicImageURL(sessionID, images, channel); + + methodWithParameters + .addParameter("channelStackId", channelStackRef.getChannelStackTechId()); + String linkURL = methodWithParameters.toString(); + methodWithParameters.addParameter("mode", "thumbnail" + width + "x" + height); + + String imageURL = methodWithParameters.toString(); + return SimpleImageHtmlRenderer.createEmbededImageHtml(imageURL, linkURL); + } + + /** creates a widget which displays the specified URL and adds it to the container */ + private static void addUrlWidget(LayoutContainer container, String url, int height) + { + Component tileContent = new Html(url); + tileContent.setHeight("" + height); + PlateStyleSetter.setPointerCursor(tileContent); + container.add(tileContent); + } + + /** generates URL of an image on Data Store server */ + private static String createDatastoreImageUrl(String sessionID, WellImages images, + String channel, int tileRow, int tileCol, int width, int height) + { + URLMethodWithParameters methodWithParameters = + createBasicImageURL(sessionID, images, channel); + + methodWithParameters.addParameter("wellRow", images.getWellLocation().getRow()); + methodWithParameters.addParameter("wellCol", images.getWellLocation().getColumn()); + methodWithParameters.addParameter("tileRow", tileRow); + methodWithParameters.addParameter("tileCol", tileCol); + String linkURL = methodWithParameters.toString(); + methodWithParameters.addParameter("mode", "thumbnail" + width + "x" + height); + + String imageURL = methodWithParameters.toString(); + return SimpleImageHtmlRenderer.createEmbededImageHtml(imageURL, linkURL); + } + + private static URLMethodWithParameters createBasicImageURL(String sessionID, WellImages images, + String channel) + { + URLMethodWithParameters methodWithParameters = + new URLMethodWithParameters(images.getDownloadUrl() + "/" + + ScreeningConstants.DATASTORE_SCREENING_SERVLET_URL); + methodWithParameters.addParameter("sessionID", sessionID); + methodWithParameters.addParameter("dataset", images.getDatasetCode()); + methodWithParameters.addParameter("channel", channel); + if (channel.equals(ScreeningConstants.MERGED_CHANNELS)) + { + methodWithParameters.addParameter("mergeChannels", "true"); + } + return methodWithParameters; + } +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java index 18f83c1663e571c27c8723a918fc3f271ffbba32..c826f64c66976b749eaa2f4950b3b6b43465d7b9 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentDialog.java @@ -16,23 +16,12 @@ package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.Map.Entry; import com.extjs.gxt.ui.client.Style.Scroll; -import com.extjs.gxt.ui.client.event.Events; -import com.extjs.gxt.ui.client.event.Listener; -import com.extjs.gxt.ui.client.event.SliderEvent; -import com.extjs.gxt.ui.client.widget.Component; import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.Html; -import com.extjs.gxt.ui.client.widget.Label; import com.extjs.gxt.ui.client.widget.LayoutContainer; -import com.extjs.gxt.ui.client.widget.Slider; import com.extjs.gxt.ui.client.widget.Text; import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.extjs.gxt.ui.client.widget.layout.RowLayout; @@ -45,18 +34,16 @@ import com.google.gwt.user.client.ui.Widget; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.LinkRenderer; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.renderers.SimpleImageHtmlRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.listener.OpenEntityDetailsTabClickListener; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolder; -import ch.systemsx.cisd.openbis.generic.shared.basic.URLMethodWithParameters; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.Dict; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.ScreeningViewContext; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.ChannelChooser.DefaultChannelState; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers.ChannelChooser.IChanneledViewerFactory; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetImagesReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation; @@ -65,7 +52,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterials import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria.SingleExperimentSearchCriteria; /** - * A dialog which shows the content of the well. + * A dialog which shows the content of the well (static or a timepoints movie). * * @author Tomasz Pylak */ @@ -79,6 +66,9 @@ public class WellContentDialog extends Dialog private static final int NO_IMAGES_DIALOG_HEIGHT_PX = 160; + /** + * A dialog which shows the content of the well (static or a timepoints movie). + */ public static void showContentDialog(final WellData wellData, DefaultChannelState channelState, final ScreeningViewContext viewContext) { @@ -90,30 +80,100 @@ public class WellContentDialog extends Dialog final WellImages imagesOrNull = wellData.tryGetImages(); if (imagesOrNull != null && imagesOrNull.isMultidimensional()) { - showTimepointImageViewer(contentDialog, wellData, imagesOrNull, channelState, + showTimepointImageDialog(contentDialog, wellData, imagesOrNull, channelState, viewContext); } else { - if (imagesOrNull != null) + showStaticImageDialog(contentDialog, wellData, imagesOrNull, channelState, viewContext); + } + } + + /** + * Creates a view for the specified channel. + * + * @param channel Channel numbers start with 1. Channel 0 consists of all other channels merged. + */ + public static Widget createImageViewerForChannel(IViewContext<?> viewContext, + WellContent wellContent, int imageWidthPx, int imageHeightPx, String channel) + { + DatasetImagesReference images = wellContent.tryGetImages(); + if (images == null) + { + return new Text("Images not acquired."); + } + WellLocation locationOrNull = wellContent.tryGetLocation(); + if (locationOrNull == null) + { + return new Text("Incorrect well code."); + } + if (images.getImageParameters().getChannelsNames().contains(channel) == false + && channel.equals(ScreeningConstants.MERGED_CHANNELS) == false) + { + return new Text("No images available for this channel."); + } + WellImages wellImages = new WellImages(images, locationOrNull); + String sessionId = getSessionId(viewContext); + return createTilesGrid(wellImages, channel, sessionId, imageWidthPx, imageHeightPx); + } + + // --------------- STATIC IMAGES VIEWER + + private static void showStaticImageDialog(final WellContentDialog contentDialog, + final WellData wellData, final WellImages imagesOrNull, + DefaultChannelState channelState, final ScreeningViewContext viewContext) + { + if (imagesOrNull != null) + { + LayoutContainer imageViewer = + createStaticImageViewer(imagesOrNull, channelState, viewContext); + contentDialog.addComponent(imageViewer); + } + contentDialog.setupContentAndShow(wellData); + } + + private static LayoutContainer createStaticImageViewer(final WellImages images, + DefaultChannelState channelState, final IViewContext<?> viewContext) + { + final IChanneledViewerFactory viewerFactory = new IChanneledViewerFactory() + { + public LayoutContainer create(String channel) + { + String sessionId = getSessionId(viewContext); + return createTilesGrid(images, channel, sessionId, getImageWidth(images), + getImageHeight(images)); + } + }; + return ChannelChooser.createViewerWithChannelChooser(viewerFactory, channelState, images + .getChannelsNames()); + } + + private static LayoutContainer createTilesGrid(WellImages images, String channel, + String sessionId, int imageWidth, int imageHeight) + { + LayoutContainer container = new LayoutContainer(new TableLayout(images.getTileColsNum())); + for (int row = 1; row <= images.getTileRowsNum(); row++) + { + for (int col = 1; col <= images.getTileColsNum(); col++) { - LayoutContainer imageViewer = - createImageViewer(imagesOrNull, channelState, viewContext); - contentDialog.addComponent(imageViewer); + ImageUrlUtils.addImageUrlWidget(container, sessionId, images, channel, row, col, + imageWidth, imageHeight); } - contentDialog.setupContentAndShow(wellData); } + return container; } - private static void showTimepointImageViewer(final WellContentDialog contentDialog, + // --------------- TIMEPOINT IMAGES PLAYER + + private static void showTimepointImageDialog(final WellContentDialog contentDialog, final WellData wellData, final WellImages images, final DefaultChannelState channelState, final ScreeningViewContext viewContext) { viewContext.getService().listImageChannelStacks(images.getDatasetCode(), images.getDatastoreCode(), images.getWellLocation(), - new AbstractAsyncCallback<List<ChannelStackImageReference>>(viewContext) + new AbstractAsyncCallback<List<ImageChannelStackReference>>(viewContext) { @Override - protected void process(List<ChannelStackImageReference> channelStackImages) + protected void process(List<ImageChannelStackReference> channelStackImages) { LayoutContainer imageViewer = createTimepointImageViewer(channelStackImages, images, @@ -125,32 +185,50 @@ public class WellContentDialog extends Dialog } private static LayoutContainer createTimepointImageViewer( - List<ChannelStackImageReference> channelStackImages, WellImages images, - DefaultChannelState channelState, IViewContext<?> viewContext) + final List<ImageChannelStackReference> channelStackImages, final WellImages images, + final DefaultChannelState channelState, IViewContext<?> viewContext) { - System.out.println("result: " + channelStackImages); - float imageSizeMultiplyFactor = getImageSizeMultiplyFactor(images); - String sessionId = getSessionId(viewContext); - - return createTilesGridForStack(channelStackImages, images, channelState.getDefaultChannel(images - .getChannelsNames()), sessionId, - (int) (ONE_IMAGE_WIDTH_PX * imageSizeMultiplyFactor), - (int) (ONE_IMAGE_HEIGHT_PX * imageSizeMultiplyFactor)); + final String sessionId = getSessionId(viewContext); + final IChanneledViewerFactory viewerFactory = new IChanneledViewerFactory() + { + public LayoutContainer create(String channel) + { + return WellContentTimepointsViewer.createTilesGrid(sessionId, + channelStackImages, images, channel, getImageWidth(images), + getImageHeight(images)); + } + }; + return ChannelChooser.createViewerWithChannelChooser(viewerFactory, channelState, images + .getChannelsNames()); } - private static int getDialogWidth(final WellImages images) + // ---------------- STATIC METHODS ------------------- + + private static int getDialogWidth(WellImages images) { float imageSizeMultiplyFactor = getImageSizeMultiplyFactor(images); return (int) (ONE_IMAGE_WIDTH_PX * imageSizeMultiplyFactor) * images.getTileColsNum() + 100; } - private static int getDialogHeight(final WellImages images) + private static int getDialogHeight(WellImages images) { float imageSizeMultiplyFactor = getImageSizeMultiplyFactor(images); return Math.max((int) (ONE_IMAGE_HEIGHT_PX * imageSizeMultiplyFactor) * images.getTileRowsNum() + 100, 300); } + private static int getImageHeight(WellImages images) + { + float imageSizeMultiplyFactor = getImageSizeMultiplyFactor(images); + return (int) (ONE_IMAGE_HEIGHT_PX * imageSizeMultiplyFactor); + } + + private static int getImageWidth(WellImages images) + { + float imageSizeMultiplyFactor = getImageSizeMultiplyFactor(images); + return (int) (ONE_IMAGE_WIDTH_PX * imageSizeMultiplyFactor); + } + private static SingleExperimentSearchCriteria getExperiment(WellData wellData) { return new SingleExperimentSearchCriteria(wellData.getExperimentId().getId(), wellData @@ -164,7 +242,12 @@ public class WellContentDialog extends Dialog return 3.0F / dim; } - // ---------------- + private static String getSessionId(IViewContext<?> viewContext) + { + return viewContext.getModel().getSessionContext().getSessionID(); + } + + // ---------- DIALOG CLASS TO DISPLAY WELL PROPERTIES ------ private final WellMetadata metadataOrNull; @@ -190,7 +273,7 @@ public class WellContentDialog extends Dialog } - public void addComponent(LayoutContainer component) + private void addComponent(LayoutContainer component) { dialogContent.add(component); } @@ -299,281 +382,4 @@ public class WellContentDialog extends Dialog return LinkRenderer.getLinkWidget(entity.getCode(), listener); } - // ------------- - - private static LayoutContainer createImageViewer(final WellImages images, - DefaultChannelState channelState, final IViewContext<?> viewContext) - { - final float imageSizeMultiplyFactor = getImageSizeMultiplyFactor(images); - final IChanneledViewerFactory viewerFactory = new IChanneledViewerFactory() - { - public LayoutContainer create(String channel) - { - String sessionId = getSessionId(viewContext); - return createTilesGridWithSlider(images, channel, sessionId, - (int) (ONE_IMAGE_WIDTH_PX * imageSizeMultiplyFactor), - (int) (ONE_IMAGE_HEIGHT_PX * imageSizeMultiplyFactor)); - } - }; - return ChannelChooser.createViewerWithChannelChooser(viewerFactory, channelState, images - .getChannelsNames()); - } - - /** - * Creates a view for the specified channel. - * - * @param channel Channel numbers start with 1. Channel 0 consists of all other channels merged. - */ - public static Widget createImageViewerForChannel(IViewContext<?> viewContext, - WellContent wellContent, int imageWidthPx, int imageHeightPx, String channel) - { - DatasetImagesReference images = wellContent.tryGetImages(); - if (images == null) - { - return new Text("Images not acquired."); - } - WellLocation locationOrNull = wellContent.tryGetLocation(); - if (locationOrNull == null) - { - return new Text("Incorrect well code."); - } - if (images.getImageParameters().getChannelsNames().contains(channel) == false - && channel.equals(ScreeningConstants.MERGED_CHANNELS) == false) - { - return new Text("No images available for this channel."); - } - WellImages wellImages = new WellImages(images, locationOrNull); - String sessionId = getSessionId(viewContext); - return WellContentDialog.createTilesGrid(wellImages, channel, sessionId, imageWidthPx, - imageHeightPx); - } - - private static LayoutContainer createTilesGrid(WellImages images, String channel, - String sessionId, int imageWidth, int imageHeight) - { - LayoutContainer container = new LayoutContainer(new TableLayout(images.getTileColsNum())); - for (int row = 1; row <= images.getTileRowsNum(); row++) - { - for (int col = 1; col <= images.getTileColsNum(); col++) - { - Component tileContent; - String imageURL = - createDatastoreImageUrl(images, channel, row, col, imageWidth, imageHeight, - sessionId); - tileContent = new Html(imageURL); - tileContent.setHeight("" + imageHeight); - PlateStyleSetter.setPointerCursor(tileContent); - container.add(tileContent); - } - } - return container; - } - - private static LayoutContainer createTilesGridForStack( - List<ChannelStackImageReference> channelStackImages, WellImages images, String channel, - String sessionId, int imageWidth, int imageHeight) - { - final LayoutContainer mainContainer = new LayoutContainer(); - - final List<LayoutContainer> frames = new ArrayList<LayoutContainer>(); - Map<Float, List<ChannelStackImageReference>> channelStackImagesByTimepoint = - groupImagesByTimepoint(channelStackImages); - - int counter = 0; - for (Entry<Float, List<ChannelStackImageReference>> entry : channelStackImagesByTimepoint - .entrySet()) - { - List<ChannelStackImageReference> imageReferences = entry.getValue(); - Collections.sort(imageReferences); // TODO needed? were data already sorted? - final LayoutContainer container = - new LayoutContainer(new TableLayout(images.getTileColsNum())); - frames.add(container); - for (ChannelStackImageReference imageReference : imageReferences) - { - Component tileContent; - String imageURL = - createDatastoreImageUrl(images, channel, imageReference, imageWidth, - imageHeight, sessionId); - tileContent = new Html(imageURL); - tileContent.setHeight("" + imageHeight); - PlateStyleSetter.setPointerCursor(tileContent); - container.add(tileContent); - } - mainContainer.add(container); - if (counter > 0) - { - container.setVisible(false); - } - counter++; - } - - final Float[] timepoints = channelStackImagesByTimepoint.keySet().toArray(new Float[0]); - final Slider slider = createTimepointsSlider(frames.size() - 1, new Listener<SliderEvent>() - { - public void handleEvent(SliderEvent e) - { - int oldValue = e.getOldValue(); - int newValue = e.getNewValue(); - frames.get(oldValue).hide(); - frames.get(newValue).show(); - mainContainer.remove(mainContainer.getItem(0)); - mainContainer.insert(new Label(createTimepointLabel(timepoints, newValue)), 0); - mainContainer.layout(); - } - }); - mainContainer.insert(slider, 0); - mainContainer.insert(new Label(createTimepointLabel(timepoints, 0)), 0); - slider.setValue(0); - - return mainContainer; - } - - private static String createTimepointLabel(Float[] timepoints, int value) - { - return "Timepoint: " + timepoints[value] + "sec (" + value + "/" + (timepoints.length - 1) - + ")"; - } - - private static Map<Float, List<ChannelStackImageReference>> groupImagesByTimepoint( - List<ChannelStackImageReference> channelStackImages) - { - Map<Float, List<ChannelStackImageReference>> result = - new TreeMap<Float, List<ChannelStackImageReference>>(); - for (ChannelStackImageReference ref : channelStackImages) - { - Float t = ref.tryGetTimepoint(); - List<ChannelStackImageReference> imageReferences = result.get(t); - if (imageReferences == null) - { - imageReferences = new ArrayList<ChannelStackImageReference>(); - result.put(t, imageReferences); - } - imageReferences.add(ref); - } - return result; - } - - // TODO 2010-08-16, Piotr Buczek: remove this code - this is just to demo slider behaviour - private static LayoutContainer createTilesGridWithSlider(WellImages images, String channel, - String sessionId, int imageWidth, int imageHeight) - { - final LayoutContainer mainContainer = new LayoutContainer(); - - final List<LayoutContainer> frames = new ArrayList<LayoutContainer>(); - final List<String> channelNames = images.getChannelsNames(); - final int channels = channelNames.size() - 1; - - int counter = 0; - for (String channelName : channelNames) - { - final LayoutContainer container = - new LayoutContainer(new TableLayout(images.getTileColsNum())); - frames.add(container); - for (int row = 1; row <= images.getTileRowsNum(); row++) - { - for (int col = 1; col <= images.getTileColsNum(); col++) - { - Component tileContent; - String imageURL = - createDatastoreImageUrl(images, channelName, row, col, imageWidth, - imageHeight, sessionId); - tileContent = new Html(imageURL); - tileContent.setHeight("" + imageHeight); - PlateStyleSetter.setPointerCursor(tileContent); - container.add(tileContent); - } - } - mainContainer.add(container); - if (counter > 0) - { - container.setVisible(false); - } - counter++; - } - - final Slider slider = createTimepointsSlider(frames.size() - 1, new Listener<SliderEvent>() - { - public void handleEvent(SliderEvent e) - { - int oldValue = e.getOldValue(); - int newValue = e.getNewValue(); - frames.get(oldValue).hide(); - frames.get(newValue).show(); - mainContainer.remove(mainContainer.getItem(0)); - mainContainer.insert(new Label("Timepoint: " + newValue + "/" + channels), 0); - mainContainer.layout(); - } - }); - mainContainer.insert(slider, 0); - mainContainer.insert(new Label("Timepoint: 0/" + channels), 0); - slider.setValue(0); - - return mainContainer; - } - - private static final Slider createTimepointsSlider(int maxValue, Listener<SliderEvent> listener) - { - final Slider slider = new Slider(); - slider.setWidth(230); - slider.setIncrement(1); - slider.setMaxValue(maxValue); - slider.setClickToChange(true); - slider.addListener(Events.Change, listener); - return slider; - } - - /** generates URL of an image on Data Store server */ - private static String createDatastoreImageUrl(WellImages images, String channel, - ChannelStackImageReference channelStackRef, int width, int height, String sessionID) - { - URLMethodWithParameters methodWithParameters = - createBasicImageURL(images, channel, sessionID); - - methodWithParameters - .addParameter("channelStackId", channelStackRef.getChannelStackTechId()); - String linkURL = methodWithParameters.toString(); - methodWithParameters.addParameter("mode", "thumbnail" + width + "x" + height); - - String imageURL = methodWithParameters.toString(); - return SimpleImageHtmlRenderer.createEmbededImageHtml(imageURL, linkURL); - } - - /** generates URL of an image on Data Store server */ - private static String createDatastoreImageUrl(WellImages images, String channel, int tileRow, - int tileCol, int width, int height, String sessionID) - { - URLMethodWithParameters methodWithParameters = - createBasicImageURL(images, channel, sessionID); - - methodWithParameters.addParameter("wellRow", images.getWellLocation().getRow()); - methodWithParameters.addParameter("wellCol", images.getWellLocation().getColumn()); - methodWithParameters.addParameter("tileRow", tileRow); - methodWithParameters.addParameter("tileCol", tileCol); - String linkURL = methodWithParameters.toString(); - methodWithParameters.addParameter("mode", "thumbnail" + width + "x" + height); - - String imageURL = methodWithParameters.toString(); - return SimpleImageHtmlRenderer.createEmbededImageHtml(imageURL, linkURL); - } - - private static URLMethodWithParameters createBasicImageURL(WellImages images, String channel, - String sessionID) - { - URLMethodWithParameters methodWithParameters = - new URLMethodWithParameters(images.getDownloadUrl() + "/" - + ScreeningConstants.DATASTORE_SCREENING_SERVLET_URL); - methodWithParameters.addParameter("sessionID", sessionID); - methodWithParameters.addParameter("dataset", images.getDatasetCode()); - methodWithParameters.addParameter("channel", channel); - if (channel.equals(ScreeningConstants.MERGED_CHANNELS)) - { - methodWithParameters.addParameter("mergeChannels", "true"); - } - return methodWithParameters; - } - - private static String getSessionId(IViewContext<?> viewContext) - { - return viewContext.getModel().getSessionContext().getSessionID(); - } } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentTimepointsViewer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentTimepointsViewer.java new file mode 100644 index 0000000000000000000000000000000000000000..1e584ed3d8168e0aeaf393ef94254b4a6a761382 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/client/application/detailviewers/WellContentTimepointsViewer.java @@ -0,0 +1,199 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.screening.client.web.client.application.detailviewers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.Map.Entry; + +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.event.SliderEvent; +import com.extjs.gxt.ui.client.widget.Label; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.Slider; +import com.extjs.gxt.ui.client.widget.layout.TableLayout; + +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; + +/** + * Allows to view timepoint images of the well. + * + * @author Tomasz Pylak + */ +class WellContentTimepointsViewer +{ + + public static LayoutContainer createTilesGrid(String sessionId, + List<ImageChannelStackReference> channelStackImages, WellImages images, String channel, + int imageWidth, int imageHeight) + { + Map<Float, List<ImageChannelStackReference>> channelStackImagesByTimepoint = + groupImagesByTimepoint(channelStackImages); + + List<LayoutContainer> frames = + createTimepointFrames(channelStackImagesByTimepoint, images, channel, sessionId, + imageWidth, imageHeight); + + Float[] timepoints = channelStackImagesByTimepoint.keySet().toArray(new Float[0]); + return createMoviePlayer(frames, timepoints); + } + + private static LayoutContainer createMoviePlayer(final List<LayoutContainer> frames, + final Float[] timepoints) + { + final LayoutContainer mainContainer = new LayoutContainer(); + addAll(mainContainer, frames); + + final Slider slider = createTimepointsSlider(frames.size() - 1, new Listener<SliderEvent>() + { + public void handleEvent(SliderEvent e) + { + int oldValue = e.getOldValue(); + int newValue = e.getNewValue(); + frames.get(oldValue).hide(); + frames.get(newValue).show(); + mainContainer.remove(mainContainer.getItem(0)); + mainContainer.insert(new Label(createTimepointLabel(timepoints, newValue)), 0); + mainContainer.layout(); + } + }); + mainContainer.insert(slider, 0); + mainContainer.insert(new Label(createTimepointLabel(timepoints, 0)), 0); + slider.setValue(0); + + return mainContainer; + } + + private static List<LayoutContainer> createTimepointFrames( + Map<Float, List<ImageChannelStackReference>> channelStackImagesByTimepoint, + WellImages images, String channel, String sessionId, int imageWidth, int imageHeight) + { + final List<LayoutContainer> frames = new ArrayList<LayoutContainer>(); + int counter = 0; + for (Entry<Float, List<ImageChannelStackReference>> entry : channelStackImagesByTimepoint + .entrySet()) + { + List<ImageChannelStackReference> imageReferences = entry.getValue(); + final LayoutContainer container = + createTilesGridForTimepoint(imageReferences, images, channel, sessionId, + imageWidth, imageHeight); + frames.add(container); + if (counter > 0) + { + container.setVisible(false); + } + counter++; + } + return frames; + } + + private static void addAll(LayoutContainer container, List<LayoutContainer> frames) + { + for (LayoutContainer frame : frames) + { + container.add(frame); + } + } + + private static LayoutContainer createTilesGridForTimepoint( + List<ImageChannelStackReference> channelStackReferences, WellImages images, + String channel, String sessionId, int imageWidth, int imageHeight) + { + final LayoutContainer container = + new LayoutContainer(new TableLayout(images.getTileColsNum())); + + ImageChannelStackReference[/* tileRow */][/* tileCol */] tilesMap = + createTilesMap(channelStackReferences, images); + for (int row = 1; row <= images.getTileRowsNum(); row++) + { + for (int col = 1; col <= images.getTileColsNum(); col++) + { + ImageChannelStackReference stackRef = tilesMap[row - 1][col - 1]; + if (stackRef != null) + { + ImageUrlUtils.addImageUrlWidget(container, sessionId, images, channel, + stackRef, imageWidth, imageHeight); + } else + { + addDummyImage(container, imageWidth, imageHeight); + } + } + } + return container; + } + + private static ImageChannelStackReference[][] createTilesMap( + List<ImageChannelStackReference> stackReferences, WellImages images) + { + int rows = images.getTileRowsNum(); + int cols = images.getTileColsNum(); + ImageChannelStackReference[][] map = new ImageChannelStackReference[rows][cols]; + for (ImageChannelStackReference stackRef : stackReferences) + { + map[stackRef.getTileRow() - 1][stackRef.getTileCol() - 1] = stackRef; + } + return map; + } + + private static void addDummyImage(LayoutContainer container, int imageWidth, int imageHeight) + { + Label dummy = new Label(); + dummy.setWidth(imageWidth); + dummy.setHeight(imageHeight); + container.add(dummy); + } + + private static String createTimepointLabel(Float[] timepoints, int sequenceNumber) + { + Float timepoint = timepoints[sequenceNumber]; + int numberOfSequences = timepoints.length - 1; + return "Timepoint: " + timepoint + "sec (" + sequenceNumber + "/" + numberOfSequences + ")"; + } + + private static Map<Float, List<ImageChannelStackReference>> groupImagesByTimepoint( + List<ImageChannelStackReference> channelStackImages) + { + Map<Float, List<ImageChannelStackReference>> result = + new TreeMap<Float, List<ImageChannelStackReference>>(); + for (ImageChannelStackReference ref : channelStackImages) + { + Float t = ref.tryGetTimepoint(); + List<ImageChannelStackReference> imageReferences = result.get(t); + if (imageReferences == null) + { + imageReferences = new ArrayList<ImageChannelStackReference>(); + result.put(t, imageReferences); + } + imageReferences.add(ref); + } + return result; + } + + private static final Slider createTimepointsSlider(int maxValue, Listener<SliderEvent> listener) + { + final Slider slider = new Slider(); + slider.setWidth(230); + slider.setIncrement(1); + slider.setMaxValue(maxValue); + slider.setClickToChange(true); + slider.addListener(Events.Change, listener); + return slider; + } +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java index a65574ac2c2bd00bfb397cdf2459e0dd39fd101d..d8e5fb01d87ce403b65c86649246115970e58c5a 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ScreeningClientService.java @@ -57,7 +57,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.BuildAndEnvironmentInfo; import ch.systemsx.cisd.openbis.plugin.screening.client.web.client.IScreeningClientService; import ch.systemsx.cisd.openbis.plugin.screening.shared.IScreeningServer; import ch.systemsx.cisd.openbis.plugin.screening.shared.ResourceNames; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.LibraryRegistrationInfo; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages; @@ -283,7 +283,7 @@ public final class ScreeningClientService extends AbstractClientService implemen return server.getVocabulary(sessionToken, ScreeningConstants.PLATE_GEOMETRY); } - public List<ChannelStackImageReference> listImageChannelStacks(String datasetCode, + public List<ImageChannelStackReference> listImageChannelStacks(String datasetCode, String datastoreCode, WellLocation wellLocation) { final String sessionToken = getSessionToken(); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java index b550a89a021d88e5515d4df4aa78fbbf474c6d58..a578f567ab885c539d43d2d3508cc6035ffec744 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServer.java @@ -59,7 +59,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Plate; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellMaterialMapping; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellReferenceWithDatasets; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria; @@ -148,7 +148,7 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl materialCriteria, true); } - public List<ChannelStackImageReference> listImageChannelStacks(String sessionToken, + public List<ImageChannelStackReference> listImageChannelStacks(String sessionToken, String datasetCode, String datastoreCode, WellLocation wellLocation) { Session session = getSession(sessionToken); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java index c0868ed59a1584c27851175fd326febe4e2704c3..c56f526cdb82f54cea81ede18a2ba0bc3870d72c 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/ScreeningServerLogger.java @@ -42,7 +42,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Plate; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellMaterialMapping; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateWellReferenceWithDatasets; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria; @@ -96,7 +96,7 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree return null; } - public List<ChannelStackImageReference> listImageChannelStacks(String sessionToken, + public List<ImageChannelStackReference> listImageChannelStacks(String sessionToken, String datasetCode, String datastoreCode, WellLocation wellLocation) { logAccess(sessionToken, "listImageChannelStacks", "dataset(%s) well(%s)", datasetCode, diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateContentLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateContentLoader.java index f47bcc96a8498d6e00639a04b749ab706a0682fc..57cba039aa6389efa4dfadd2f8390048138f312f 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateContentLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/server/logic/PlateContentLoader.java @@ -40,7 +40,7 @@ import ch.systemsx.cisd.openbis.generic.shared.translator.SampleTranslator; import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; import ch.systemsx.cisd.openbis.plugin.screening.server.IScreeningBusinessObjectFactory; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Geometry; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetImagesReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; @@ -96,7 +96,7 @@ public class PlateContentLoader /** * Loads information about all channels stacks of a given well in a given dataset. */ - public static List<ChannelStackImageReference> loadImageChannelStacks(Session session, + public static List<ImageChannelStackReference> loadImageChannelStacks(Session session, IScreeningBusinessObjectFactory businessObjectFactory, String datasetCode, String datastoreCode, WellLocation wellLocation) { @@ -325,7 +325,7 @@ public class PlateContentLoader .createForContainer(plateId)); } - private List<ChannelStackImageReference> loadImageChannelStacks(String datasetCode, + private List<ImageChannelStackReference> loadImageChannelStacks(String datasetCode, String datastoreCode, WellLocation wellLocation) { IHCSDatasetLoader datasetLoader = diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java index dd04e5ace82cda2f4eedab0a1e5fe7d34ed692a5..6b72c3c9680d86bf9575984e94f3db3d751eee3e 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/IScreeningServer.java @@ -38,7 +38,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.PlateMaterialsSearchCriteriaPredicate; import ch.systemsx.cisd.openbis.plugin.screening.shared.authorization.WellContentValidator; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria; @@ -79,7 +79,7 @@ public interface IScreeningServer extends IServer @Transactional @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) - public List<ChannelStackImageReference> listImageChannelStacks(String sessionToken, + public List<ImageChannelStackReference> listImageChannelStacks(String sessionToken, @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String datasetCode, String datastoreCode, WellLocation wellLocation); diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ChannelStackImageReference.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ImageChannelStackReference.java similarity index 79% rename from screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ChannelStackImageReference.java rename to screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ImageChannelStackReference.java index d600d4d70bf49bb2dcd53a03c474b09614dd949d..f993c24131d0906cdc8162111ef4c90d1ac5970b 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ChannelStackImageReference.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/basic/dto/ImageChannelStackReference.java @@ -24,8 +24,7 @@ import com.google.gwt.user.client.rpc.IsSerializable; * * @author Tomasz Pylak */ -public class ChannelStackImageReference implements IsSerializable, - Comparable<ChannelStackImageReference> +public class ImageChannelStackReference implements IsSerializable { // technical id in the imaging db private long channelStackTechId; @@ -36,11 +35,11 @@ public class ChannelStackImageReference implements IsSerializable, // GWT only @SuppressWarnings("unused") - private ChannelStackImageReference() + private ImageChannelStackReference() { } - public ChannelStackImageReference(long channelStackTechId, int tileRow, int tileCol, + public ImageChannelStackReference(long channelStackTechId, int tileRow, int tileCol, Float tOrNull, Float zOrNull) { this.channelStackTechId = channelStackTechId; @@ -91,16 +90,4 @@ public class ChannelStackImageReference implements IsSerializable, return "channelStack=" + channelStackTechId + ", tile[" + tileRow + "," + tileCol + "]" + desc; } - - public int compareTo(ChannelStackImageReference other) - { - if (this.tileRow == other.tileRow) - { - return this.tileCol < other.tileCol ? -1 : (this.tileCol == other.tileCol ? 0 : 1); - } else - { - return this.tileRow < other.tileRow ? -1 : 1; - } - } - } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/HCSDatasetLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/HCSDatasetLoader.java index 14ec2678eec9a92673f5d9e59b88eba24520c1a6..498fd5cffb08c4dd4b62d863c13e54f676e04fa2 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/HCSDatasetLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/HCSDatasetLoader.java @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.List; import ch.systemsx.cisd.bds.hcs.Geometry; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation; import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.IImagingQueryDAO; import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.ImgChannelStackDTO; @@ -119,7 +119,7 @@ public class HCSDatasetLoader implements IHCSDatasetLoader return dataset.getIsMultidimensional(); } - public List<ChannelStackImageReference> listImageChannelStacks(WellLocation wellLocation) + public List<ImageChannelStackReference> listImageChannelStacks(WellLocation wellLocation) { int spotYRow = wellLocation.getRow(); int spotXColumn = wellLocation.getColumn(); @@ -128,9 +128,9 @@ public class HCSDatasetLoader implements IHCSDatasetLoader return convert(stacks); } - private static List<ChannelStackImageReference> convert(List<ImgChannelStackDTO> stacks) + private static List<ImageChannelStackReference> convert(List<ImgChannelStackDTO> stacks) { - List<ChannelStackImageReference> result = new ArrayList<ChannelStackImageReference>(); + List<ImageChannelStackReference> result = new ArrayList<ImageChannelStackReference>(); for (ImgChannelStackDTO stack : stacks) { result.add(convert(stack)); @@ -138,9 +138,9 @@ public class HCSDatasetLoader implements IHCSDatasetLoader return result; } - private static ChannelStackImageReference convert(ImgChannelStackDTO stack) + private static ImageChannelStackReference convert(ImgChannelStackDTO stack) { - return new ChannelStackImageReference(stack.getId(), stack.getRow(), stack.getColumn(), + return new ImageChannelStackReference(stack.getId(), stack.getRow(), stack.getColumn(), stack.getT(), stack.getZ()); } } \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/IHCSDatasetLoader.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/IHCSDatasetLoader.java index a2c6bbd0b31db7f1222719dbb2e5874d595148a8..cdddd3a5e6bb8804ba6134810ae69849376812de 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/IHCSDatasetLoader.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/IHCSDatasetLoader.java @@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.plugin.screening.shared.imaging; import java.util.List; import ch.systemsx.cisd.bds.hcs.Geometry; -import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ChannelStackImageReference; +import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ImageChannelStackReference; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation; /** @@ -44,5 +44,5 @@ public interface IHCSDatasetLoader /** * Loads information about all channels stacks of a given well. */ - List<ChannelStackImageReference> listImageChannelStacks(WellLocation wellLocation); + List<ImageChannelStackReference> listImageChannelStacks(WellLocation wellLocation); } \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingQueryDAO.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingQueryDAO.java index 59d357e52a20c146e801f9992aa6a71890ed7ad5..4c57b86fcfa0c394b3fcc83599a79922017812ea 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingQueryDAO.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingQueryDAO.java @@ -98,7 +98,7 @@ public interface IImagingQueryDAO extends TransactionQuery @Select("select * from CONTAINERS where ID = ?{1}") public ImgContainerDTO getContainerById(long containerId); - @Select("select * from CHANNEL_STACKS cs join SPOTS s on s.id = cs.spot_id where " + @Select("select cs.* from CHANNEL_STACKS cs join SPOTS s on s.id = cs.spot_id where " + "cs.ds_id = ?{1} and s.x = ?{2} and s.y = ?{3}") public List<ImgChannelStackDTO> listChannelStacks(long datasetId, int spotX, int spotY);