diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingReadonlyQueryDAO.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingReadonlyQueryDAO.java index 20d96ba1ddf632e6fd113eb2b14e05b078f0a4bf..437e496887a21e2091e139525e826a249bc081b9 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingReadonlyQueryDAO.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/IImagingReadonlyQueryDAO.java @@ -87,6 +87,12 @@ public interface IImagingReadonlyQueryDAO extends BaseQuery // " and CHANNEL_STACKS.T_in_SEC IS NULL " // + " and CHANNEL_STACKS.Z_in_M IS NULL "; + public static final String SQL_HCS_WELLS_WITH_IMAGES = + "select distinct s.* " + + "from CHANNEL_STACKS ch, SPOTS s, ACQUIRED_IMAGES ai " + + "where ch.is_representative = 'T' and ch.DS_ID = ?{1} and " + + " ai.CHANNEL_STACK_ID = ch.ID and ch.SPOT_ID = s.ID"; + // ---------------- HCS --------------------------------- /** @@ -138,6 +144,21 @@ public interface IImagingReadonlyQueryDAO extends BaseQuery + " where d.perm_id = ?{1} and ch.code = upper(?{2}) and s.id is NOT NULL") public List<ImgImageEnrichedDTO> listHCSImages(String datasetPermId, String channelCode); + /** + * @return list of wells for which there are any thumbnail or original images (any tile, any + * channel). + */ + @Select(SQL_HCS_WELLS_WITH_IMAGES) + public List<ImgSpotDTO> listWellsWithAnyImages(long datasetId); + + /** @return list of wells for which there are any thumbnail images (any tile, any channel). */ + @Select(SQL_HCS_WELLS_WITH_IMAGES + " and ai.thumbnail_id is not null") + public List<ImgSpotDTO> listWellsWithAnyThumbnails(long datasetId); + + /** @return list of wells for which there are any original images (any tile, any channel). */ + @Select(SQL_HCS_WELLS_WITH_IMAGES + " and ai.img_id is not null") + public List<ImgSpotDTO> listWellsWithAnyOriginalImages(long datasetId); + // ---------------- Microscopy --------------------------------- /** diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgSpotDTO.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgSpotDTO.java index 689d17b6857e1fae7f5ec774533d319eea981a15..0bf32b804210707b5b6b2aa0852eb7ef49900bf9 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgSpotDTO.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/imaging/dataaccess/ImgSpotDTO.java @@ -40,9 +40,8 @@ public class ImgSpotDTO extends AbstractImgIdentifiable // All Data-Object classes must have a default constructor. } - public ImgSpotDTO(/* String permId, */Integer row, Integer column, long containerId) + public ImgSpotDTO(Integer row, Integer column, long containerId) { - /* this.permId = permId; */ this.column = column; this.row = row; this.containerId = containerId; diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingQueryDAOTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingQueryDAOTest.java index cc200d14aeea003c54ac4b9d224c5fbdc408ba8b..6ed8e649a483b7341f32a8c0125082258f65a6ff 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingQueryDAOTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/dss/etl/dataaccess/ImagingQueryDAOTest.java @@ -247,9 +247,32 @@ public class ImagingQueryDAOTest extends AbstractDBTest addAcquiredImage(imageId2, channelStackId, experimentChannelId2); testGetHCSImage(datasetId, channelStackId, datasetChannelId1, experimentChannelId2, spotId); + testGetAnyHCSImage(datasetId); testListChannelStacksAndSpots(datasetId, channelStackId, spotId); } + private void testGetAnyHCSImage(long datasetId) + { + List<ImgSpotDTO> anyImgSpots = dao.listWellsWithAnyImages(datasetId); + assertEquals(1, anyImgSpots.size()); + ImgSpotDTO spot = anyImgSpots.get(0); + assertDefaultSpot(spot); + + List<ImgSpotDTO> thumbnailImgSpots = dao.listWellsWithAnyThumbnails(datasetId); + assertEquals(1, thumbnailImgSpots.size()); + assertEquals(spot, thumbnailImgSpots.get(0)); + + List<ImgSpotDTO> originalImgSpots = dao.listWellsWithAnyOriginalImages(datasetId); + assertEquals(1, originalImgSpots.size()); + assertEquals(spot, originalImgSpots.get(0)); + } + + private void assertDefaultSpot(ImgSpotDTO spot) + { + assertEquals(X_WELL_COLUMN, 0L + spot.getColumn()); + assertEquals(Y_WELL_ROW, 0L + spot.getRow()); + } + private void testListChannelStacksAndSpots(long datasetId, long channelStackId, long spotId) { ImgChannelStackDTO stackDTO = testListChannelStacks(datasetId, channelStackId);