Skip to content
Snippets Groups Projects
Commit c38cb1a7 authored by tpylak's avatar tpylak
Browse files

LMS-1645 dynamix: list channel stacks and allow to fetch images by channel stack id

SVN: 17469
parent 64fb1cec
No related branches found
No related tags found
No related merge requests found
Showing
with 305 additions and 75 deletions
......@@ -16,8 +16,8 @@
package ch.systemsx.cisd.openbis.dss.etl;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDatasetDownloadServlet.Size;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelStackReference;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.IHCSDatasetLoader;
/**
......@@ -29,6 +29,6 @@ public interface IHCSImageDatasetLoader extends IHCSDatasetLoader
* @param chosenChannel start from 1
* @return image (with absolute path, page and color)
*/
AbsoluteImageReference tryGetImage(String chosenChannel, Location wellLocation,
Location tileLocation, Size thumbnailSizeOrNull);
AbsoluteImageReference tryGetImage(String chosenChannel,
ImageChannelStackReference channelStackReference, Size thumbnailSizeOrNull);
}
\ No newline at end of file
......@@ -31,7 +31,6 @@ import com.sun.media.jai.codec.ImageEncoder;
import com.sun.media.jai.codec.TIFFEncodeParam;
import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.io.ByteArrayBasedContent;
import ch.systemsx.cisd.common.io.IContent;
......@@ -40,7 +39,9 @@ import ch.systemsx.cisd.openbis.dss.etl.AbsoluteImageReference;
import ch.systemsx.cisd.openbis.dss.etl.IContentRepository;
import ch.systemsx.cisd.openbis.dss.etl.IHCSImageDatasetLoader;
import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDatasetDownloadServlet.Size;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelStackReference;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelsUtils;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelStackReference.LocationImageChannelStackReference;
import ch.systemsx.cisd.openbis.dss.generic.shared.utils.ImageUtil;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.HCSDatasetLoader;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.IImagingQueryDAO;
......@@ -67,14 +68,20 @@ public class HCSImageDatasetLoader extends HCSDatasetLoader implements IHCSImage
* @param chosenChannel start from 1
* @return image (with absolute path, page and color)
*/
public AbsoluteImageReference tryGetImage(String chosenChannel, Location wellLocation,
Location tileLocation, Size thumbnailSizeOrNull)
public AbsoluteImageReference tryGetImage(String chosenChannel,
ImageChannelStackReference channelStackReference, Size thumbnailSizeOrNull)
{
assert StringUtils.isBlank(chosenChannel) == false;
assert tileLocation.getX() <= getDataset().getFieldNumberOfColumns();
assert tileLocation.getY() <= getDataset().getFieldNumberOfRows();
assert wellLocation.getX() <= getContainer().getNumberOfColumns();
assert wellLocation.getY() <= getContainer().getNumberOfRows();
LocationImageChannelStackReference stackLocations =
channelStackReference.tryGetChannelStackLocations();
if (stackLocations != null)
{
assert stackLocations.getTileLocation().getX() <= getDataset()
.getFieldNumberOfColumns();
assert stackLocations.getTileLocation().getY() <= getDataset().getFieldNumberOfRows();
assert stackLocations.getWellLocation().getX() <= getContainer().getNumberOfColumns();
assert stackLocations.getWellLocation().getY() <= getContainer().getNumberOfRows();
}
Long chosenChannelId =
query.tryGetChannelIdByChannelNameDatasetIdOrExperimentId(getDataset().getId(),
......@@ -86,16 +93,13 @@ public class HCSImageDatasetLoader extends HCSDatasetLoader implements IHCSImage
ImgImageDTO imageDTO;
IContent content = null;
long datasetId = getDataset().getId();
if (thumbnailSizeOrNull != null)
{
imageDTO =
query.tryGetThumbnail(chosenChannelId, getDataset().getId(), tileLocation,
wellLocation);
imageDTO = tryGetThumbnail(chosenChannelId, channelStackReference, datasetId);
if (imageDTO == null)
{
imageDTO =
query.tryGetImage(chosenChannelId, getDataset().getId(), tileLocation,
wellLocation);
imageDTO = tryGetImage(chosenChannelId, channelStackReference, datasetId);
if (imageDTO != null)
{
content =
......@@ -108,9 +112,7 @@ public class HCSImageDatasetLoader extends HCSDatasetLoader implements IHCSImage
}
} else
{
imageDTO =
query.tryGetImage(chosenChannelId, getDataset().getId(), tileLocation,
wellLocation);
imageDTO = tryGetImage(chosenChannelId, channelStackReference, datasetId);
if (imageDTO != null)
{
content = contentRepository.getContent(imageDTO.getFilePath());
......@@ -141,6 +143,42 @@ public class HCSImageDatasetLoader extends HCSDatasetLoader implements IHCSImage
}
}
private ImgImageDTO tryGetImage(long channelId,
ImageChannelStackReference channelStackReference, long datasetId)
{
LocationImageChannelStackReference locations =
channelStackReference.tryGetChannelStackLocations();
if (locations != null)
{
return query.tryGetImage(channelId, datasetId, locations.getTileLocation(), locations
.getWellLocation());
} else
{
Long channelStackId = channelStackReference.tryGetChannelStackId();
assert channelStackId != null : "invalid specification of the channel stack: "
+ channelStackReference;
return query.tryGetImage(channelId, channelStackId, datasetId);
}
}
private ImgImageDTO tryGetThumbnail(long channelId,
ImageChannelStackReference channelStackReference, long datasetId)
{
LocationImageChannelStackReference locations =
channelStackReference.tryGetChannelStackLocations();
if (locations != null)
{
return query.tryGetThumbnail(channelId, datasetId, locations.getTileLocation(),
locations.getWellLocation());
} else
{
Long channelStackId = channelStackReference.tryGetChannelStackId();
assert channelStackId != null : "invalid specification of the channel stack: "
+ channelStackReference;
return query.tryGetThumbnail(channelId, channelStackId, datasetId);
}
}
private static IContent asContent(BufferedImage image, String fileType, String name, String id)
{
final ByteArrayOutputStream out = new ByteArrayOutputStream();
......
......@@ -27,6 +27,7 @@ import javax.servlet.http.HttpSession;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelStackReference;
import ch.systemsx.cisd.openbis.dss.generic.server.images.TileImageReference;
/**
......@@ -55,6 +56,8 @@ abstract class AbstractImagesDownloadServlet extends AbstractDatasetDownloadServ
private final static String DATASET_CODE_PARAM = "dataset";
private final static String CHANNEL_STACK_ID_PARAM = "channelStackId";
private final static String WELL_ROW_PARAM = "wellRow";
private final static String WELL_COLUMN_PARAM = "wellCol";
......@@ -77,15 +80,8 @@ abstract class AbstractImagesDownloadServlet extends AbstractDatasetDownloadServ
String displayModeText = request.getParameter(DISPLAY_MODE_PARAM);
String displayMode = displayModeText == null ? "" : displayModeText;
this.thumbnailSizeOrNull = tryAsThumbnailDisplayMode(displayMode);
this.datasetCode = getParam(request, DATASET_CODE_PARAM);
int wellRow = getIntParam(request, WELL_ROW_PARAM);
int wellCol = getIntParam(request, WELL_COLUMN_PARAM);
int tileRow = getIntParam(request, TILE_ROW_PARAM);
int tileCol = getIntParam(request, TILE_COL_PARAM);
this.wellLocation = new Location(wellCol, wellRow);
this.tileLocation = new Location(tileCol, tileRow);
this.channelStackReference = getImageChannelStackReference(request);
this.channel = getParam(request, CHANNEL_PARAM);
String mergeChannelsText = request.getParameter(MERGE_CHANNELS_PARAM);
......@@ -94,7 +90,37 @@ abstract class AbstractImagesDownloadServlet extends AbstractDatasetDownloadServ
.equalsIgnoreCase("true");
}
private ImageChannelStackReference getImageChannelStackReference(HttpServletRequest request)
{
Integer channelStackId = tryGetIntParam(request, CHANNEL_STACK_ID_PARAM);
if (channelStackId == null)
{
int wellRow = getIntParam(request, WELL_ROW_PARAM);
int wellCol = getIntParam(request, WELL_COLUMN_PARAM);
int tileRow = getIntParam(request, TILE_ROW_PARAM);
int tileCol = getIntParam(request, TILE_COL_PARAM);
Location wellLocation = new Location(wellCol, wellRow);
Location tileLocation = new Location(tileCol, tileRow);
return ImageChannelStackReference.createFromLocations(wellLocation, tileLocation);
} else
{
return ImageChannelStackReference.createFromId(channelStackId);
}
}
private static int getIntParam(HttpServletRequest request, String paramName)
{
Integer value = tryGetIntParam(request, paramName);
if (value == null)
{
throw new UserFailureException("parameter " + paramName
+ " should be an integer, but is: " + value);
}
return value.intValue();
}
private static Integer tryGetIntParam(HttpServletRequest request, String paramName)
{
String value = getParam(request, paramName);
try
......@@ -102,8 +128,7 @@ abstract class AbstractImagesDownloadServlet extends AbstractDatasetDownloadServ
return Integer.valueOf(value);
} catch (NumberFormatException e)
{
throw new UserFailureException("parameter " + paramName
+ " should be an integer, but is: " + value);
return null;
}
}
......
/*
* 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.dss.generic.server.images;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.common.utilities.AbstractHashable;
/**
* Identifies one channel stack, by well and tile location or by the technical id.
*
* @author Tomasz Pylak
*/
public class ImageChannelStackReference extends AbstractHashable
{
public static final class LocationImageChannelStackReference
{
protected Location wellLocation;
protected Location tileLocation;
public LocationImageChannelStackReference(Location wellLocation, Location tileLocation)
{
this.wellLocation = wellLocation;
this.tileLocation = tileLocation;
}
public Location getWellLocation()
{
return wellLocation;
}
public Location getTileLocation()
{
return tileLocation;
}
}
public static final ImageChannelStackReference createFromLocations(Location wellLocation,
Location tileLocation)
{
return new ImageChannelStackReference(new LocationImageChannelStackReference(wellLocation,
tileLocation), null);
}
public static final ImageChannelStackReference createFromId(long channelStackId)
{
return new ImageChannelStackReference(null, channelStackId);
}
private final LocationImageChannelStackReference locationRefOrNull;
private final Long idRefOrNull;
private ImageChannelStackReference(LocationImageChannelStackReference locationRefOrNull,
Long idRefOrNull)
{
assert locationRefOrNull == null || idRefOrNull == null;
assert locationRefOrNull != null || idRefOrNull != null;
this.locationRefOrNull = locationRefOrNull;
this.idRefOrNull = idRefOrNull;
}
public Long tryGetChannelStackId()
{
return idRefOrNull;
}
public LocationImageChannelStackReference tryGetChannelStackLocations()
{
return locationRefOrNull;
}
}
......@@ -24,7 +24,6 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
import ch.systemsx.cisd.common.io.IContent;
import ch.systemsx.cisd.openbis.dss.etl.AbsoluteImageReference;
......@@ -53,8 +52,6 @@ public class ImageChannelsUtils
{
IHCSImageDatasetLoader imageAccessor =
HCSImageDatasetLoaderFactory.create(datasetRoot, datasetCode);
Location wellLocation = params.getWellLocation();
Location tileLocation = params.getTileLocation();
List<AbsoluteImageReference> images = new ArrayList<AbsoluteImageReference>();
Size thumbnailSizeOrNull = params.tryGetThumbnailSize();
......@@ -63,14 +60,14 @@ public class ImageChannelsUtils
for (String chosenChannel : imageAccessor.getChannelsNames())
{
AbsoluteImageReference image =
getImage(imageAccessor, wellLocation, tileLocation, chosenChannel,
getImage(imageAccessor, params.getChannelStack(), chosenChannel,
thumbnailSizeOrNull);
images.add(image);
}
} else
{
AbsoluteImageReference image =
getImage(imageAccessor, wellLocation, tileLocation, params.getChannel(),
getImage(imageAccessor, params.getChannelStack(), params.getChannel(),
thumbnailSizeOrNull);
images.add(image);
}
......@@ -242,12 +239,12 @@ public class ImageChannelsUtils
* @throw {@link EnvironmentFailureException} when image does not exist
*/
public static AbsoluteImageReference getImage(IHCSImageDatasetLoader imageAccessor,
Location wellLocation, Location tileLocation, String chosenChannel,
ImageChannelStackReference channelStackReference, String chosenChannel,
Size thumbnailSizeOrNull)
{
AbsoluteImageReference image =
imageAccessor.tryGetImage(chosenChannel, wellLocation, tileLocation,
thumbnailSizeOrNull);
imageAccessor
.tryGetImage(chosenChannel, channelStackReference, thumbnailSizeOrNull);
if (image != null)
{
return image;
......@@ -255,7 +252,7 @@ public class ImageChannelsUtils
{
throw EnvironmentFailureException.fromTemplate("No "
+ (thumbnailSizeOrNull != null ? "thumbnail" : "image")
+ " found for well %s, tile %s and channel %s", wellLocation, tileLocation,
+ " found for channel stack %s and channel %s", channelStackReference,
chosenChannel);
}
}
......
......@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.dss.generic.server.images;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDatasetDownloadServlet.Size;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants;
......@@ -34,9 +33,7 @@ public class TileImageReference
protected String datasetCode;
protected Location wellLocation;
protected Location tileLocation;
protected ImageChannelStackReference channelStackReference;
protected boolean mergeAllChannels;
......@@ -68,13 +65,8 @@ public class TileImageReference
return channel;
}
public Location getWellLocation()
{
return wellLocation;
}
public Location getTileLocation()
public ImageChannelStackReference getChannelStack()
{
return tileLocation;
return channelStackReference;
}
}
\ No newline at end of file
......@@ -41,6 +41,7 @@ import ch.systemsx.cisd.openbis.dss.etl.IHCSImageDatasetLoader;
import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc;
import ch.systemsx.cisd.openbis.dss.generic.server.FeatureTableBuilder;
import ch.systemsx.cisd.openbis.dss.generic.server.FeatureTableRow;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelStackReference;
import ch.systemsx.cisd.openbis.dss.generic.server.images.ImageChannelsUtils;
import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
......@@ -179,9 +180,10 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc implements
AbsoluteImageReference image;
for (String channelName : imageAccessor.getChannelsNames())
{
image =
imageAccessor.tryGetImage(channelName, new Location(col, row),
new Location(1, 1), null);
ImageChannelStackReference channelStackReference =
ImageChannelStackReference.createFromLocations(new Location(col, row),
new Location(1, 1));
image = imageAccessor.tryGetImage(channelName, channelStackReference, null);
if (image != null)
{
return image.getContent();
......@@ -330,7 +332,9 @@ public class DssServiceRpcScreening extends AbstractDssServiceRpc implements
getTileLocation(imageRef.getTile(), imageAccessor.getWellGeometry());
try
{
return ImageChannelsUtils.getImage(imageAccessor, wellLocation, tileLocation, imageRef
ImageChannelStackReference channelStackReference =
ImageChannelStackReference.createFromLocations(wellLocation, tileLocation);
return ImageChannelsUtils.getImage(imageAccessor, channelStackReference, imageRef
.getChannel(), null);
} catch (EnvironmentFailureException e)
{
......
......@@ -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> listChannelStackImages(String datasetCode,
public List<ChannelStackImageReference> listImageChannelStacks(String datasetCode,
String datastoreCode, WellLocation wellLocation);
/**
......
......@@ -88,9 +88,9 @@ public interface IScreeningClientServiceAsync extends IClientServiceAsync
AsyncCallback<String> callback);
/**
* @see IScreeningClientService#listChannelStackImages
* @see IScreeningClientService#listImageChannelStacks(String, String, WellLocation)
*/
public void listChannelStackImages(String datasetCode, String datastoreCode,
public void listImageChannelStacks(String datasetCode, String datastoreCode,
WellLocation wellLocation,
AsyncCallback<List<ChannelStackImageReference>> abstractAsyncCallback);
......
......@@ -108,7 +108,7 @@ public class WellContentDialog extends Dialog
final WellData wellData, final WellImages images,
final DefaultChannelState channelState, final ScreeningViewContext viewContext)
{
viewContext.getService().listChannelStackImages(images.getDatasetCode(),
viewContext.getService().listImageChannelStacks(images.getDatasetCode(),
images.getDatastoreCode(), images.getWellLocation(),
new AbstractAsyncCallback<List<ChannelStackImageReference>>(viewContext)
{
......
......@@ -16,7 +16,6 @@
package ch.systemsx.cisd.openbis.plugin.screening.client.web.server;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -284,10 +283,11 @@ public final class ScreeningClientService extends AbstractClientService implemen
return server.getVocabulary(sessionToken, ScreeningConstants.PLATE_GEOMETRY);
}
public List<ChannelStackImageReference> listChannelStackImages(String datasetCode,
public List<ChannelStackImageReference> listImageChannelStacks(String datasetCode,
String datastoreCode, WellLocation wellLocation)
{
// TODO 2010-08-16, Tomasz Pylak: implement me!!!!!!!!!!!!
return new ArrayList<ChannelStackImageReference>();
final String sessionToken = getSessionToken();
return server
.listImageChannelStacks(sessionToken, datasetCode, datastoreCode, wellLocation);
}
}
......@@ -24,7 +24,6 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleBO;
import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister;
import ch.systemsx.cisd.openbis.generic.server.business.bo.materiallister.IMaterialLister;
import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.IHCSDatasetLoader;
......@@ -35,7 +34,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.IHCSDatasetLoade
*/
public interface IScreeningBusinessObjectFactory
{
public IHCSDatasetLoader createHCSDatasetLoader(final ExternalData dataSet);
public IHCSDatasetLoader createHCSDatasetLoader(String datasetCode, String datastoreCode);
public ISampleBO createSampleBO(final Session session);
......
......@@ -28,7 +28,6 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleBO;
import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister;
import ch.systemsx.cisd.openbis.generic.server.business.bo.materiallister.IMaterialLister;
import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
import ch.systemsx.cisd.openbis.plugin.AbstractPluginBusinessObjectFactory;
import ch.systemsx.cisd.openbis.plugin.screening.server.dataaccess.IScreeningDAOFactory;
......@@ -53,11 +52,10 @@ public final class ScreeningBusinessObjectFactory extends AbstractPluginBusiness
{
}
public IHCSDatasetLoader createHCSDatasetLoader(ExternalData dataSet)
public IHCSDatasetLoader createHCSDatasetLoader(String datasetCode, String datastoreCode)
{
String dssCode = dataSet.getDataStore().getCode();
String dataSetCode = dataSet.getCode();
return new HCSDatasetLoader(specificDAOFactory.getImagingQueryDAO(dssCode), dataSetCode);
return new HCSDatasetLoader(specificDAOFactory.getImagingQueryDAO(datastoreCode),
datasetCode);
}
public final ISampleBO createSampleBO(final Session session)
......
......@@ -59,10 +59,12 @@ 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.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
* The concrete {@link IScreeningServer} implementation.
......@@ -146,6 +148,14 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl
materialCriteria, true);
}
public List<ChannelStackImageReference> listImageChannelStacks(String sessionToken,
String datasetCode, String datastoreCode, WellLocation wellLocation)
{
Session session = getSession(sessionToken);
return PlateContentLoader.loadImageChannelStacks(session, businessObjectFactory,
datasetCode, datastoreCode, wellLocation);
}
public TableModel loadImageAnalysisForExperiment(String sessionToken, TechId experimentId)
{
Session session = getSession(sessionToken);
......@@ -260,5 +270,4 @@ public final class ScreeningServer extends AbstractServer<IScreeningServer> impl
{
return MINOR_VERSION;
}
}
......@@ -42,10 +42,12 @@ 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.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
* The <i>screening</i> specific {@link AbstractServerLogger} extension.
......@@ -94,6 +96,14 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree
return null;
}
public List<ChannelStackImageReference> listImageChannelStacks(String sessionToken,
String datasetCode, String datastoreCode, WellLocation wellLocation)
{
logAccess(sessionToken, "listImageChannelStacks", "dataset(%s) well(%s)", datasetCode,
wellLocation);
return null;
}
public ExternalData getDataSetInfo(String sessionToken, TechId datasetId)
{
logAccess(sessionToken, "getDataSetInfo", "datasetId(%s)", datasetId.getId());
......@@ -189,8 +199,8 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree
{
if (materialTypeIdentifierOrNull != null)
{
logAccess(sessionToken, "listPlateMaterialMapping", "plates(%s), materialType(%s)", plates,
materialTypeIdentifierOrNull);
logAccess(sessionToken, "listPlateMaterialMapping", "plates(%s), materialType(%s)",
plates, materialTypeIdentifierOrNull);
} else
{
logAccess(sessionToken, "listPlateMaterialMapping", "plates(%s)", plates);
......@@ -207,5 +217,4 @@ final class ScreeningServerLogger extends AbstractServerLogger implements IScree
{
return ScreeningServer.MINOR_VERSION;
}
}
......@@ -207,12 +207,19 @@ public class GenePlateLocationsLoader
List<PlateImageParameters> imageParameters = new ArrayList<PlateImageParameters>();
for (ExternalData dataSet : imageDatasets)
{
final IHCSDatasetLoader loader = businessObjectFactory.createHCSDatasetLoader(dataSet);
final IHCSDatasetLoader loader = createHCSDatasetLoader(dataSet);
imageParameters.add(PlateImageParametersFactory.create(loader));
}
return asDatasetToParamsMap(imageParameters);
}
private IHCSDatasetLoader createHCSDatasetLoader(ExternalData dataSet)
{
String datastoreCode = dataSet.getDataStore().getCode();
String datasetCode = dataSet.getCode();
return businessObjectFactory.createHCSDatasetLoader(datasetCode, datastoreCode);
}
private static Map<String/* dataset code */, PlateImageParameters> asDatasetToParamsMap(
List<PlateImageParameters> imageParameters)
{
......
......@@ -40,6 +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.DatasetImagesReference;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.DatasetReference;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateContent;
......@@ -92,6 +93,17 @@ public class PlateContentLoader
.getPlateContentForDataset(datasetId);
}
/**
* Loads information about all channels stacks of a given well in a given dataset.
*/
public static List<ChannelStackImageReference> loadImageChannelStacks(Session session,
IScreeningBusinessObjectFactory businessObjectFactory, String datasetCode,
String datastoreCode, WellLocation wellLocation)
{
return new PlateContentLoader(session, businessObjectFactory).loadImageChannelStacks(
datasetCode, datastoreCode, wellLocation);
}
private final Session session;
private final IScreeningBusinessObjectFactory businessObjectFactory;
......@@ -273,10 +285,17 @@ public class PlateContentLoader
private PlateImageParameters loadImageParams(ExternalData dataset)
{
final IHCSDatasetLoader loader = businessObjectFactory.createHCSDatasetLoader(dataset);
final IHCSDatasetLoader loader = createHCSDatasetLoader(dataset);
return PlateImageParametersFactory.create(loader);
}
private IHCSDatasetLoader createHCSDatasetLoader(ExternalData dataSet)
{
String datastoreCode = dataSet.getDataStore().getCode();
String datasetCode = dataSet.getCode();
return businessObjectFactory.createHCSDatasetLoader(datasetCode, datastoreCode);
}
private static List<WellMetadata> createWells(List<Sample> wellSamples)
{
List<WellMetadata> wells = new ArrayList<WellMetadata>();
......@@ -305,4 +324,12 @@ public class PlateContentLoader
return new ListOrSearchSampleCriteria(ListOrSearchSampleCriteria
.createForContainer(plateId));
}
private List<ChannelStackImageReference> loadImageChannelStacks(String datasetCode,
String datastoreCode, WellLocation wellLocation)
{
IHCSDatasetLoader datasetLoader =
businessObjectFactory.createHCSDatasetLoader(datasetCode, datastoreCode);
return datasetLoader.listImageChannelStacks(wellLocation);
}
}
......@@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer;
import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.AuthorizationGuard;
import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.ReturnValueFilter;
import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.DataSetCodePredicate;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SampleTechIdPredicate;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.DataSetTechIdPredicate;
import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate;
......@@ -37,10 +38,12 @@ 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.PlateContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateImages;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.PlateMaterialsSearchCriteria;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellContent;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.WellLocation;
/**
* The <i>screening</i> server. Used internally.
......@@ -74,6 +77,12 @@ public interface IScreeningServer extends IServer
String sessionToken,
@AuthorizationGuard(guardClass = PlateMaterialsSearchCriteriaPredicate.class) PlateMaterialsSearchCriteria materialCriteria);
@Transactional
@RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
public List<ChannelStackImageReference> listImageChannelStacks(String sessionToken,
@AuthorizationGuard(guardClass = DataSetCodePredicate.class) String datasetCode,
String datastoreCode, WellLocation wellLocation);
/**
* Loads all analysis results from all existing image-analysis datasets connected with the
* specified experiment. It is assumed that all datasets are CSV files with the same headers.
......
......@@ -88,7 +88,8 @@ public class ChannelStackImageReference implements IsSerializable,
desc += ", z=" + zOrNull;
}
return "tile [" + tileRow + "," + tileCol + "]" + desc;
return "channelStack=" + channelStackTechId + ", tile[" + tileRow + "," + tileCol + "]"
+ desc;
}
public int compareTo(ChannelStackImageReference other)
......
......@@ -21,7 +21,10 @@ 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.WellLocation;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.IImagingQueryDAO;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.ImgChannelStackDTO;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.ImgContainerDTO;
import ch.systemsx.cisd.openbis.plugin.screening.shared.imaging.dataaccess.ImgDatasetDTO;
......@@ -115,4 +118,29 @@ public class HCSDatasetLoader implements IHCSDatasetLoader
{
return dataset.getIsMultidimensional();
}
public List<ChannelStackImageReference> listImageChannelStacks(WellLocation wellLocation)
{
int spotYRow = wellLocation.getRow();
int spotXColumn = wellLocation.getColumn();
List<ImgChannelStackDTO> stacks =
query.listChannelStacks(dataset.getId(), spotXColumn, spotYRow);
return convert(stacks);
}
private static List<ChannelStackImageReference> convert(List<ImgChannelStackDTO> stacks)
{
List<ChannelStackImageReference> result = new ArrayList<ChannelStackImageReference>();
for (ImgChannelStackDTO stack : stacks)
{
result.add(convert(stack));
}
return result;
}
private static ChannelStackImageReference convert(ImgChannelStackDTO stack)
{
return new ChannelStackImageReference(stack.getId(), stack.getRow(), stack.getColumn(),
stack.getT(), stack.getZ());
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment