diff --git a/screening/resource/test-data/PlatonicPlateImageDropboxTest/1_1_GFP_OverlayDAPI_Default.png b/screening/resource/test-data/PlatonicPlateImageDropboxTest/1_1_GFP_OverlayDAPI_Default.png new file mode 100644 index 0000000000000000000000000000000000000000..4e01b5e72a177595a1e1734d3c809d95003225e4 Binary files /dev/null and b/screening/resource/test-data/PlatonicPlateImageDropboxTest/1_1_GFP_OverlayDAPI_Default.png differ diff --git a/screening/resource/test-data/PlatonicPlateImageDropboxTest/1_2_CY3_Overlay2GFP_DAPI_256x256.png b/screening/resource/test-data/PlatonicPlateImageDropboxTest/1_2_CY3_Overlay2GFP_DAPI_256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..45e05d9189071baa3025b539e01c60ab909bcf8f Binary files /dev/null and b/screening/resource/test-data/PlatonicPlateImageDropboxTest/1_2_CY3_Overlay2GFP_DAPI_256x256.png differ diff --git a/screening/resource/test-data/PlatonicPlateImageDropboxTest/2_1_CY3_Overlay2GFP_Default.png b/screening/resource/test-data/PlatonicPlateImageDropboxTest/2_1_CY3_Overlay2GFP_Default.png new file mode 100644 index 0000000000000000000000000000000000000000..fd705cfe9464847987695751fe2deff5c2900863 Binary files /dev/null and b/screening/resource/test-data/PlatonicPlateImageDropboxTest/2_1_CY3_Overlay2GFP_Default.png differ diff --git a/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s4_cRGB.png b/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s4_cRGB.png new file mode 100644 index 0000000000000000000000000000000000000000..fc6276be176674d15ec060989e059070a7670a05 Binary files /dev/null and b/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s4_cRGB.png differ diff --git a/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s5_cRGB.png b/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s5_cRGB.png new file mode 100644 index 0000000000000000000000000000000000000000..353d3f5021f8e037729b7ab5992fd21f3f85b21b Binary files /dev/null and b/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s5_cRGB.png differ diff --git a/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s6_cRGB.png b/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s6_cRGB.png new file mode 100644 index 0000000000000000000000000000000000000000..68028a0a63cb97ad1bb7c18f73bbe5cddd454548 Binary files /dev/null and b/screening/resource/test-data/PlatonicPlateImageDropboxTest/Platonic-Plate/bPLATE_wA1_s6_cRGB.png differ diff --git a/screening/resource/test-data/Simple16BitImageDropboxTest/1_2_Merged_Overlay2CY3_256x256.png b/screening/resource/test-data/Simple16BitImageDropboxTest/1_2_Merged_Overlay2CY3_256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..7afda5a7d041dcefd75c4aaa5c92440d07edd501 Binary files /dev/null and b/screening/resource/test-data/Simple16BitImageDropboxTest/1_2_Merged_Overlay2CY3_256x256.png differ diff --git a/screening/resource/test-data/Simple16BitImageDropboxTest/2_1_Merged_Default.png b/screening/resource/test-data/Simple16BitImageDropboxTest/2_1_Merged_Default.png new file mode 100644 index 0000000000000000000000000000000000000000..6dff21ae5b4402430b9f23289ecec9621f8e24e2 Binary files /dev/null and b/screening/resource/test-data/Simple16BitImageDropboxTest/2_1_Merged_Default.png differ diff --git a/screening/resource/test-data/Simple16BitImageDropboxTest/PLATE-16-BIT/PLATE-16-BIT_A01_04_DAPI.png b/screening/resource/test-data/Simple16BitImageDropboxTest/PLATE-16-BIT/PLATE-16-BIT_A01_04_DAPI.png new file mode 100644 index 0000000000000000000000000000000000000000..8b1f17ca827f74bb43285ae3edc896a5347cca9f Binary files /dev/null and b/screening/resource/test-data/Simple16BitImageDropboxTest/PLATE-16-BIT/PLATE-16-BIT_A01_04_DAPI.png differ diff --git a/screening/resource/test-data/Simple16BitImageDropboxTest/PLATE-16-BIT/PLATE-16-BIT_A01_04_GFP.png b/screening/resource/test-data/Simple16BitImageDropboxTest/PLATE-16-BIT/PLATE-16-BIT_A01_04_GFP.png new file mode 100644 index 0000000000000000000000000000000000000000..4aeea3961d854e31b06937eafb34d16c8acdc0f2 Binary files /dev/null and b/screening/resource/test-data/Simple16BitImageDropboxTest/PLATE-16-BIT/PLATE-16-BIT_A01_04_GFP.png differ diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractImageDropboxTestCase.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractImageDropboxTestCase.java index 97b090bb7806cbf4b907dbf9a5e9a039a0e884a9..bb57b9c15ba1a3502e03bc6295ca531e09c248d8 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractImageDropboxTestCase.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractImageDropboxTestCase.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.Arrays; +import java.util.Collections; import java.util.List; import org.apache.commons.io.FileUtils; @@ -91,7 +92,16 @@ public abstract class AbstractImageDropboxTestCase extends AbstractScreeningSyst protected AbstractExternalData getRegisteredContainerDataSet() { - List<AbstractExternalData> dataSets = getRegisteredDataSets(); + Class<? extends AbstractImageDropboxTestCase> testClass = getClass(); + AbstractExternalData containerDataSet = getRegisteredContainerDataSet(testClass); + assertNotNull("No container data set found for test " + testClass.getSimpleName(), containerDataSet); + return containerDataSet; + } + + protected AbstractExternalData getRegisteredContainerDataSet(Class<? extends AbstractImageDropboxTestCase> testClass) + { + String experimentCode = translateIntoCamelCase(testClass.getSimpleName()).toUpperCase(); + List<AbstractExternalData> dataSets = getRegisteredDataSets(experimentCode); for (AbstractExternalData dataSet : dataSets) { if (dataSet.getDataSetType().getDataSetKind().equals(DataSetKind.CONTAINER)) @@ -99,18 +109,19 @@ public abstract class AbstractImageDropboxTestCase extends AbstractScreeningSyst return dataSet; } } - fail("No container data set found: " + dataSets); - return null; // never reached but needed for the compiler + return null; } - protected List<AbstractExternalData> getRegisteredDataSets() + private List<AbstractExternalData> getRegisteredDataSets(String experimentCode) { - String code = translateIntoCamelCase(getClass().getSimpleName()).toUpperCase(); - ExperimentIdentifier identifier = ExperimentIdentifierFactory.parse("/TEST/TEST-PROJECT/" + code); - Experiment experiment = commonServer.getExperimentInfo(sessionToken, identifier); - List<AbstractExternalData> dataSets - = commonServer.listRelatedDataSets(sessionToken, new DataSetRelatedEntities(Arrays.asList(experiment)), false); - return dataSets; + ExperimentIdentifier identifier = ExperimentIdentifierFactory.parse("/TEST/TEST-PROJECT/" + experimentCode); + List<Experiment> experiments = commonServer.listExperiments(sessionToken, Arrays.asList(identifier)); + if (experiments.isEmpty()) + { + return Collections.emptyList(); + } + Experiment experiment = experiments.get(0); + return commonServer.listRelatedDataSets(sessionToken, new DataSetRelatedEntities(Arrays.asList(experiment)), false); } private String translateIntoCamelCase(String string) diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractScreeningSystemTestCase.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractScreeningSystemTestCase.java index 8270cb500045290516fca04fe521c80663c6f1ce..f76b4800a1d6df97d3a1becd4102627d6ed21018 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractScreeningSystemTestCase.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/AbstractScreeningSystemTestCase.java @@ -106,8 +106,21 @@ public abstract class AbstractScreeningSystemTestCase extends SystemTestCase */ protected static final class ImageLoader implements IImageLoader { + private static final class OverlayChannel + { + private String dataSetCode; + private String channel; + + OverlayChannel(String dataSetCode, String channel) + { + this.dataSetCode = dataSetCode; + this.channel = channel; + } + } + private final URLMethodWithParameters url; private final List<String> channels = new ArrayList<String>(); + private final List<OverlayChannel> overlayChannels = new ArrayList<OverlayChannel>(); private final Map<String, String> transformationsByChannel = new HashMap<String, String>(); private boolean mergeChannels = true; private boolean microscopy = false; @@ -149,6 +162,11 @@ public abstract class AbstractScreeningSystemTestCase extends SystemTestCase url.addParameter(ImageServletUrlParameters.CHANNEL_PARAM, channel); } } + for (OverlayChannel overlayChannel : overlayChannels) + { + String name = ImageServletUrlParameters.OVERLAY_CHANNEL_PREFIX_PARAM + overlayChannel.dataSetCode; + url.addParameter(name, overlayChannel.channel); + } if (microscopy == false) { url.addParameter(ImageServletUrlParameters.WELL_ROW_PARAM, Integer.toString(wellRow)); @@ -214,6 +232,12 @@ public abstract class AbstractScreeningSystemTestCase extends SystemTestCase return this; } + public ImageLoader overlay(String dataSetCode, String channel) + { + overlayChannels.add(new OverlayChannel(dataSetCode, channel)); + return this; + } + public ImageLoader rescaling(String channel, int low, int high) { transformationsByChannel.put(channel, diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/PlatonicPlateImageDropboxTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/PlatonicPlateImageDropboxTest.java index 2c64ca33420025bd9e892cc0055ce742f243686c..ec690821d3e1e43478f363d2f59cf735ac6852e6 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/PlatonicPlateImageDropboxTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/PlatonicPlateImageDropboxTest.java @@ -60,6 +60,20 @@ public class PlatonicPlateImageDropboxTest extends AbstractImageDropboxTestCase new ImageLoader(dataSet, sessionToken).tileColumn(2).channel("GFP").mode("thumbnail64x64")); imageChecker.check(new File(getTestDataFolder(), "1_1_Merged_Default_GFP_0_100.png"), new ImageLoader(dataSet, sessionToken).rescaling("GFP", 0, 100)); + imageChecker.check(new File(getTestDataFolder(), "1_1_GFP_OverlayDAPI_Default.png"), + new ImageLoader(dataSet, sessionToken).channel("GFP").overlay(dataSet.getCode(), "DAPI")); + // Because all data sets are registered before the actual test methods are executed we can + // use images from another data set as an overlay image + AbstractExternalData dataSet2 = getRegisteredContainerDataSet(Simple16BitImageDropboxTest.class); + if (dataSet2 != null) + { + imageChecker.check(new File(getTestDataFolder(), "1_2_CY3_Overlay2GFP_DAPI_256x256.png"), + new ImageLoader(dataSet, sessionToken).tileColumn(2).channel("CY3") + .overlay(dataSet2.getCode(), "GFP").overlay(dataSet2.getCode(), "DAPI").mode("thumbnail256x256")); + imageChecker.check(new File(getTestDataFolder(), "2_1_CY3_Overlay2GFP_Default.png"), + new ImageLoader(dataSet, sessionToken).tileRow(2).tileColumn(1).channel("CY3") + .overlay(dataSet2.getCode(), "GFP")); + } imageChecker.assertNoFailures(); } } diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/Simple16BitImageDropboxTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/Simple16BitImageDropboxTest.java index d3b9d4356dde634ef847a9f56ddddb76d017cae2..3f6ab2ea0ecf2dd9b5c9e0ac792bbfdc230d049f 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/Simple16BitImageDropboxTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/Simple16BitImageDropboxTest.java @@ -58,6 +58,17 @@ public class Simple16BitImageDropboxTest extends AbstractImageDropboxTestCase new ImageLoader(dataSet, sessionToken).tileColumn(2).mode("thumbnail1392x1040")); imageChecker.check(new File(getTestDataFolder(), "1_2_GFP_thumbnail1392x1040.png"), new ImageLoader(dataSet, sessionToken).tileColumn(2).channel("GFP").mode("thumbnail1392x1040")); + imageChecker.check(new File(getTestDataFolder(), "2_1_Merged_Default.png"), + new ImageLoader(dataSet, sessionToken).tileRow(2).tileColumn(1)); + // Because all data sets are registered before the actual test methods are executed we can + // use images from another data set as an overlay image + AbstractExternalData dataSet2 = getRegisteredContainerDataSet(PlatonicPlateImageDropboxTest.class); + if (dataSet2 != null) + { + imageChecker.check(new File(getTestDataFolder(), "1_2_Merged_Overlay2CY3_256x256.png"), + new ImageLoader(dataSet, sessionToken).tileColumn(2) + .overlay(dataSet2.getCode(), "CY3").mode("thumbnail256x256")); + } imageChecker.assertNoFailures(); } }