diff --git a/components/tools/OmeroJava/test/integration/ExporterTest.java b/components/tools/OmeroJava/test/integration/ExporterTest.java index 55225635535..36e31fa44f3 100644 --- a/components/tools/OmeroJava/test/integration/ExporterTest.java +++ b/components/tools/OmeroJava/test/integration/ExporterTest.java @@ -260,16 +260,13 @@ private Image createSimpleImageToExport() throws Exception { * Thrown if an error occurred. */ private Image createImageWithROIToExport() throws Exception { - //create an import and image - File f = File.createTempFile(RandomStringUtils.random(100, false, true), - "."+ OME_XML); + // Create OME-TIFF file with ROI data XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImageWithROI(), true); + File f = mmFactory.createOMETiffFile(xml.createImageWithROI()); List pix = null; try { // method tested in ImporterTest - pix = importFile(f, OME_XML); + pix = importFile(f, OME_TIFF); return pix.get(0).getImage(); } catch (Throwable e) { throw new Exception("Cannot create image to import", e); @@ -286,16 +283,13 @@ private Image createImageWithROIToExport() throws Exception { * Thrown if an error occurred. */ private Image createImageWithAnnotatedDataToExport() throws Exception { - //create an import and image - File f = File.createTempFile(RandomStringUtils.random(100, false, true), - "."+ OME_XML); + // Create OME-TIFF file with annotated acquisition data XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImageWithAnnotatedAcquisitionData(), true); + File f = mmFactory.createOMETiffFile(xml.createImageWithAnnotatedAcquisitionData()); List pix = null; try { // method tested in ImporterTest - pix = importFile(f, OME_XML); + pix = importFile(f, OME_TIFF); return pix.get(0).getImage(); } catch (Throwable e) { throw new Exception("Cannot create image to import", e); @@ -312,16 +306,13 @@ private Image createImageWithAnnotatedDataToExport() throws Exception { * Thrown if an error occurred. */ private Image createImageToExport() throws Exception { - //create an import and image - File f = File.createTempFile(RandomStringUtils.random(100, false, true), - "." + OME_XML); + // Create OME-TIFF file with acquisition data XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImageWithAcquisitionData(), true); + File f = mmFactory.createOMETiffFile(xml.createImageWithAcquisitionData()); List pix = null; try { // method tested in ImporterTest - pix = importFile(f, OME_XML); + pix = importFile(f, OME_TIFF); return pix.get(0).getImage(); } catch (Throwable e) { throw new Exception("Cannot create image to import", e); diff --git a/components/tools/OmeroJava/test/integration/ModelMockFactory.java b/components/tools/OmeroJava/test/integration/ModelMockFactory.java index de5509d492a..4e8e08aab19 100644 --- a/components/tools/OmeroJava/test/integration/ModelMockFactory.java +++ b/components/tools/OmeroJava/test/integration/ModelMockFactory.java @@ -21,6 +21,7 @@ import ome.formats.model.UnitsFactory; import ome.units.UNITS; +import ome.xml.model.enums.PixelType; import omero.ServerError; import omero.api.ITypesPrx; import omero.model.*; @@ -1214,4 +1215,81 @@ public IObject createAnnotationLink(IObject o, Annotation a) linkMethod.invoke(link, o, a, null); // Last is Ice.Current; return link; } + + /** + * Creates an OME-TIFF file from OME metadata using Bio-Formats. + * The full OME model is preserved in the embedded OME-XML, including + * ROIs and annotations. + * + * @param ome The OME metadata to convert. + * @return A temporary File containing the OME-TIFF. + * @throws Exception Thrown if an error occurred. + */ + public File createOMETiffFile(ome.xml.model.OME ome) throws Exception { + if (ome == null || ome.sizeOfImageList() == 0) { + throw new IllegalArgumentException("OME metadata must contain at least one Image"); + } + + // Get dimensions from the first image + ome.xml.model.Pixels pixels = ome.getImage(0).getPixels(); + int sizeX = pixels.getSizeX().getValue(); + int sizeY = pixels.getSizeY().getValue(); + int sizeZ = pixels.getSizeZ().getValue(); + int sizeC = pixels.getSizeC().getValue(); + int sizeT = pixels.getSizeT().getValue(); + + PixelType pixelType = pixels.getType(); + if (pixelType == null) { + pixelType = PixelType.UINT8; + } + + // Step 1: Serialise the full OME model to a temp .ome.xml companion file. + // XMLWriter preserves ROIs, annotations and all other elements. + File xmlFile = File.createTempFile("metadata", ".ome.xml"); + xmlFile.deleteOnExit(); + new ome.specification.XMLWriter().writeFile(xmlFile, ome, true); + + // Step 2: Attach a fresh OMEXMLMetadata store to the reader *before* opening + // the file so that the reader populates it with the complete parsed + // OME-XML (ROIs, annotations, etc.), not just pixel dimensions. + loci.formats.ome.OMEXMLMetadata meta = (loci.formats.ome.OMEXMLMetadata) + loci.formats.MetadataTools.createOMEXMLMetadata(); + loci.formats.ImageReader reader = new loci.formats.ImageReader(); + reader.setMetadataStore(meta); + reader.setId(xmlFile.getAbsolutePath()); + + // Step 3: Ensure SamplesPerPixel is set for all channels (required by writer). + for (int c = 0; c < sizeC; c++) { + if (meta.getChannelSamplesPerPixel(0, c) == null) { + meta.setChannelSamplesPerPixel( + new ome.xml.model.primitives.PositiveInteger(1), 0, c); + } + } + + // Step 4: Write the OME-TIFF with the fully populated metadata store. + File tiffFile = File.createTempFile("ome_tiff_", ".ome.tiff"); + tiffFile.deleteOnExit(); + + loci.formats.out.OMETiffWriter writer = new loci.formats.out.OMETiffWriter(); + writer.setMetadataRetrieve(meta); + writer.setId(tiffFile.getAbsolutePath()); + + // Step 5: Write synthetic pixel data for each plane. + int bytesPerPixel = loci.formats.FormatTools.getBytesPerPixel( + loci.formats.FormatTools.pixelTypeFromString(pixelType.toString())); + byte[] pixelData = new byte[sizeX * sizeY * bytesPerPixel]; + int planeCount = sizeZ * sizeC * sizeT; + for (int plane = 0; plane < planeCount; plane++) { + for (int i = 0; i < pixelData.length; i++) { + pixelData[i] = (byte) ((i + plane) % 256); + } + writer.saveBytes(plane, pixelData); + } + + writer.close(); + reader.close(); + xmlFile.delete(); + + return tiffFile; + } } diff --git a/components/tools/OmeroJava/test/integration/ModelMockFactoryTest.java b/components/tools/OmeroJava/test/integration/ModelMockFactoryTest.java new file mode 100644 index 00000000000..f3ae4e225e3 --- /dev/null +++ b/components/tools/OmeroJava/test/integration/ModelMockFactoryTest.java @@ -0,0 +1,133 @@ +/* + * Copyright 2006-2017 University of Dundee. All rights reserved. + * Use is subject to license terms supplied in LICENSE.txt + */ +package integration; + +import java.io.File; +import java.util.Iterator; +import java.util.List; + +import ome.specification.XMLMockObjects; +import omero.api.IRoiPrx; +import omero.api.RoiOptions; +import omero.api.RoiResult; +import omero.model.Annotation; +import omero.model.BooleanAnnotation; +import omero.model.CommentAnnotation; +import omero.model.Ellipse; +import omero.model.IObject; +import omero.model.ImageAnnotationLink; +import omero.model.Line; +import omero.model.LongAnnotation; +import omero.model.Mask; +import omero.model.Pixels; +import omero.model.Point; +import omero.model.Polyline; +import omero.model.Rectangle; +import omero.model.Roi; +import omero.model.Shape; +import omero.model.TagAnnotation; +import omero.model.TermAnnotation; +import omero.sys.ParametersI; + +import org.testng.Assert; +import org.testng.annotations.Test; + +/** + * Tests for ModelMockFactory + */ +public class ModelMockFactoryTest extends AbstractServerImportTest { + + private static final String OME_TIFF = "ome.tiff"; + + /** + * Tests that an OME-TIFF created from an image with ROI data can be + * imported and that all expected shapes survive the round-trip. + */ + @Test + public void testCreateOMETiffFileWithROI() throws Throwable { + XMLMockObjects xml = new XMLMockObjects(); + File tiffFile = mmFactory.createOMETiffFile(xml.createImageWithROI()); + try { + List pixels = importFile(tiffFile, OME_TIFF); + Assert.assertNotNull(pixels); + Assert.assertFalse(pixels.isEmpty()); + + long imageId = pixels.get(0).getImage().getId().getValue(); + + IRoiPrx roiSvc = factory.getRoiService(); + RoiResult result = roiSvc.findByImage(imageId, new RoiOptions()); + Assert.assertNotNull(result); + List rois = result.rois; + Assert.assertNotNull(rois); + Assert.assertEquals(rois.size(), XMLMockObjects.SIZE_C.intValue()); + + Iterator roiIter = rois.iterator(); + while (roiIter.hasNext()) { + Roi roi = roiIter.next(); + List shapes = roi.copyShapes(); + Assert.assertNotNull(shapes); + Assert.assertEquals(shapes.size(), XMLMockObjects.SHAPES.length); + int count = 0; + for (Shape shape : shapes) { + if (shape instanceof Rectangle || shape instanceof Line + || shape instanceof Ellipse + || shape instanceof Polyline || shape instanceof Mask + || shape instanceof Point) { + count++; + } + } + Assert.assertEquals(count, XMLMockObjects.SHAPES.length); + } + } finally { + if (tiffFile != null && tiffFile.exists()) { + tiffFile.delete(); + } + } + } + + /** + * Tests that an OME-TIFF created from an annotated image can be imported + * and that all expected annotation types survive the round-trip. + */ + @Test + public void testCreateOMETiffFileWithAnnotations() throws Throwable { + XMLMockObjects xml = new XMLMockObjects(); + File tiffFile = mmFactory.createOMETiffFile(xml.createAnnotatedImage()); + try { + List pixels = importFile(tiffFile, OME_TIFF); + Assert.assertNotNull(pixels); + Assert.assertFalse(pixels.isEmpty()); + + long imageId = pixels.get(0).getImage().getId().getValue(); + + String hql = "select l from ImageAnnotationLink as l " + + "left outer join fetch l.parent as p " + + "join fetch l.child " + + "where p.id = :id"; + List links = iQuery.findAllByQuery(hql, new ParametersI().addId(imageId)); + + Assert.assertTrue(links.size() >= XMLMockObjects.ANNOTATIONS.length, + String.format("Expected at least %d annotations, got %d", + XMLMockObjects.ANNOTATIONS.length, links.size())); + + int count = 0; + for (IObject obj : links) { + Annotation a = ((ImageAnnotationLink) obj).getChild(); + if (a instanceof CommentAnnotation + || a instanceof TagAnnotation + || a instanceof TermAnnotation + || a instanceof BooleanAnnotation + || a instanceof LongAnnotation) { + count++; + } + } + Assert.assertEquals(count, XMLMockObjects.ANNOTATIONS.length); + } finally { + if (tiffFile != null && tiffFile.exists()) { + tiffFile.delete(); + } + } + } +} diff --git a/components/tools/OmeroJava/test/integration/RenderingEngineTest.java b/components/tools/OmeroJava/test/integration/RenderingEngineTest.java index 8cc6b1f732f..ac7d3dbc69d 100644 --- a/components/tools/OmeroJava/test/integration/RenderingEngineTest.java +++ b/components/tools/OmeroJava/test/integration/RenderingEngineTest.java @@ -82,6 +82,9 @@ */ public class RenderingEngineTest extends AbstractServerTest { + /** The OME-TIFF format. */ + private static final String OME_TIFF = "ome.tiff"; + /** The red mask. */ private static final int RED_MASK = 0x00ff0000; @@ -118,13 +121,11 @@ private void saveRenderingSettings(String permissions, int role, boolean preload) throws Exception { EventContext ctx = newUserAndGroup(permissions); // Import the image - File f = File.createTempFile("saveRenderingSettings", "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -335,14 +336,11 @@ public void testCreateRenderingEngineNoSettings() throws Exception { */ @Test public void testCreateRenderingEngine() throws Exception { - File f = File.createTempFile("testCreateRenderingEngine", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -367,14 +365,11 @@ public void testCreateRenderingEngine() throws Exception { */ @Test public void testRenderingEngineGetters() throws Exception { - File f = File.createTempFile("testRenderingEngineGetters", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -443,14 +438,11 @@ public void testRenderingEngineGetters() throws Exception { */ @Test public void testRenderingEngineSetters() throws Exception { - File file = File.createTempFile("testRenderingEngineSetters", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(file, xml.createImage(), true); + File file = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(file, OME_FORMAT); + pixels = importFile(file, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -541,14 +533,11 @@ public void testRenderingEngineSetters() throws Exception { */ @Test public void testResetDefaultsNoSave() throws Exception { - File f = File.createTempFile("testResetDefaultsNoSave", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -588,13 +577,11 @@ public void testResetDefaultsNoSave() throws Exception { */ @Test public void testResetDefaults() throws Exception { - File f = File.createTempFile("testResetDefaults", "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -632,14 +619,11 @@ public void testResetDefaults() throws Exception { */ @Test public void testSaveCurrentSettings() throws Exception { - File f = File.createTempFile("testSaveCurrentSettings", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -778,13 +762,11 @@ public void testSaveCurrentSettings() throws Exception { */ @Test public void testRenderPlane() throws Exception { - File f = File.createTempFile("testRenderPlane", "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -833,13 +815,11 @@ public void testRenderPlane() throws Exception { */ @Test public void testRenderRegion() throws Exception { - File f = File.createTempFile("testRenderRegion", "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -914,14 +894,11 @@ public void testRenderRegion() throws Exception { */ @Test public void testRenderRegionChangeModel() throws Exception { - File f = File.createTempFile("testRenderRegionChangeModel", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -977,14 +954,11 @@ public void testRenderRegionChangeModel() throws Exception { */ @Test public void testRenderCompressedPlane() throws Exception { - File f = File.createTempFile("testRenderCompressedPlane", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1026,14 +1000,11 @@ public void testRenderCompressedPlane() throws Exception { */ @Test public void testRenderCompressedRegion() throws Exception { - File f = File.createTempFile("testRenderCompressedRegion", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1080,14 +1051,11 @@ public void testRenderCompressedRegion() throws Exception { */ @Test public void testRenderAsPackedIntPlane() throws Exception { - File f = File.createTempFile("testRenderAsPackedIntPlane", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1142,14 +1110,11 @@ public void testRenderAsPackedIntPlane() throws Exception { */ @Test public void testRenderAsPackedIntRegion() throws Exception { - File f = File.createTempFile("testRenderAsPackedIntRegion", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1209,14 +1174,11 @@ public void testRenderAsPackedIntRegion() throws Exception { */ @Test public void testRenderAsPackedIntRegionChangeModel() throws Exception { - File f = File.createTempFile("testRenderAsPackedIntRegion", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1278,14 +1240,11 @@ public void testRenderAsPackedIntRegionChangeModel() throws Exception { */ @Test public void testRenderAsPackedIntStridePlane() throws Exception { - File f = File.createTempFile("testRenderAsPackedIntStridePlane", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1325,14 +1284,11 @@ public void testRenderAsPackedIntStridePlane() throws Exception { */ @Test public void testRenderAsPackedIntStrideRegion() throws Exception { - File f = File.createTempFile("testRenderAsPackedIntStrideRegion", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1377,14 +1333,11 @@ public void testRenderAsPackedIntStrideRegion() throws Exception { */ @Test public void testRenderCompressedStridePlane() throws Exception { - File f = File.createTempFile("testRenderCompressedStridePlane", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1427,14 +1380,11 @@ public void testRenderCompressedStridePlane() throws Exception { */ @Test public void testRenderCompressedStrideRegion() throws Exception { - File f = File.createTempFile("testRenderCompressedStridePlane", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1483,13 +1433,11 @@ public void testRenderCompressedStrideRegion() throws Exception { */ @Test public void testRenderStridePlane() throws Exception { - File f = File.createTempFile("testRenderStridePlane", "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1547,14 +1495,11 @@ public void testRenderStridePlane() throws Exception { */ @Test public void testRenderStrideRegion() throws Exception { - File f = File - .createTempFile("testRenderStrideRegion", "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1617,14 +1562,11 @@ public void testRenderStrideRegion() throws Exception { */ @Test public void testRenderRegionOutsideRange() throws Exception { - File f = File.createTempFile("testRenderRegionOutsideRange", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1671,14 +1613,11 @@ public void testRenderRegionOutsideRange() throws Exception { */ @Test public void testRenderAsPacketIntRegionOutsideRange() throws Exception { - File f = File.createTempFile("testRenderRegionOutsideRange", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1725,14 +1664,11 @@ public void testRenderAsPacketIntRegionOutsideRange() throws Exception { */ @Test public void testSaveCurrentSettingsMultipleTimes() throws Exception { - File file = File.createTempFile("testRenderingEngineSetters", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(file, xml.createImage(), true); + File file = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(file, OME_FORMAT); + pixels = importFile(file, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1768,14 +1704,11 @@ public void testSaveCurrentSettingsMultipleTimes() throws Exception { */ @Test public void testSaveCurrentSettingsAll() throws Exception { - File file = File.createTempFile("testRenderingEngineSetters", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(file, xml.createImage(), true); + File file = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(file, OME_FORMAT); + pixels = importFile(file, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -1948,14 +1881,11 @@ public void testSaveCurrentSettingsByAdminRWRW() throws Exception { */ @Test public void testRenderingEngineChannelWindowGetter() throws Exception { - File f = File.createTempFile("testRenderingEngineChannelWindowGetter", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2002,14 +1932,11 @@ public void testRenderingEngineChannelWindowGetter() throws Exception { */ @Test public void testRenderingEngineChannelLookupTable() throws Exception { - File f = File.createTempFile("testRenderingEngineChannelLookupTable", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2051,14 +1978,11 @@ public void testRenderingEngineChannelLookupTable() throws Exception { */ @Test public void testRenderingEngineProjectionDef() throws Exception { - File f = File.createTempFile("testRenderingEngineProjectionDef", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2112,14 +2036,11 @@ public void testRenderingEngineProjectionDef() throws Exception { */ @Test public void testRenderingEngineSaveChannelLookupTable() throws Exception { - File f = File.createTempFile("testRenderingEngineSaveChannelLookupTable", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2166,14 +2087,11 @@ public void testRenderingEngineSaveChannelLookupTable() throws Exception { @Test public void testLutReaders() throws Exception { //First import an image - File f = File.createTempFile("testLutReaders", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2249,14 +2167,11 @@ public void testLutReaders() throws Exception { @Test public void testLutNotInlist() throws Exception { //First import an image - File f = File.createTempFile("testLutNotInlist", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2304,14 +2219,11 @@ public void testLutNotInlist() throws Exception { @Test public void testReverseIntensity() throws Exception { //First import an image - File f = File.createTempFile("testReverseIntensity", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2356,14 +2268,11 @@ public void testReverseIntensity() throws Exception { @Test public void testAddAndRemoveCodomain() throws Exception { //First import an image - File f = File.createTempFile("testAddAndRemoveCodomain", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2403,14 +2312,11 @@ public void testAddAndRemoveCodomain() throws Exception { @Test public void testAddCodomainTwice() throws Exception { //First import an image - File f = File.createTempFile("testAddCodomainTwice", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2450,14 +2356,11 @@ public void testAddCodomainTwice() throws Exception { @Test public void testSaveCodomainAndRestart() throws Exception { //First import an image - File f = File.createTempFile("testSaveCodomainAndRestart", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -2508,14 +2411,11 @@ public void testSaveCodomainAndRestart() throws Exception { @Test public void testAddRemoveChainAndSave() throws Exception { //First import an image - File f = File.createTempFile("testAddRemoveChainAndSave", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -4079,14 +3979,11 @@ public void testUpdateSettingsWithNullChannelBindings() throws Exception { */ @Test public void testRenderProjectedCompressed() throws Exception { - File f = File.createTempFile("testRenderProjectedCompressed", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -4121,14 +4018,11 @@ public void testRenderProjectedCompressed() throws Exception { */ @Test public void testRenderProjectedUnCompressed() throws Exception { - File f = File.createTempFile("testRenderProjectedCompressed", "." - + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -4164,14 +4058,11 @@ public void testRenderProjectedUnCompressed() throws Exception { */ @Test public void testRenderProjectedCompressedNoChannels() throws Exception { - File f = File.createTempFile("testRenderProjectedCompressedNoChannels", - "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } @@ -4210,14 +4101,11 @@ public void testRenderProjectedCompressedNoChannels() throws Exception { */ @Test public void testRenderProjectedUnCompressedNoChannels() throws Exception { - File f = File.createTempFile("testRenderProjectedUnCompressedNoChannels", - "." + OME_FORMAT); XMLMockObjects xml = new XMLMockObjects(); - XMLWriter writer = new XMLWriter(); - writer.writeFile(f, xml.createImage(), true); + File f = mmFactory.createOMETiffFile(xml.createImage()); List pixels = null; try { - pixels = importFile(f, OME_FORMAT); + pixels = importFile(f, OME_TIFF); } catch (Throwable e) { throw new Exception("cannot import image", e); } diff --git a/etc/ivysettings.xml b/etc/ivysettings.xml index e686f5813a8..0600e8c8fb6 100644 --- a/etc/ivysettings.xml +++ b/etc/ivysettings.xml @@ -85,6 +85,10 @@ usepoms="true" useMavenMetadata="true" m2compatible="true" root="https://nexus.senbox.net/nexus/content/groups/public/"/> + @@ -94,6 +98,7 @@ + diff --git a/etc/omero.properties b/etc/omero.properties index 38706176a52..a980f953af0 100644 --- a/etc/omero.properties +++ b/etc/omero.properties @@ -242,6 +242,9 @@ versions.velocity=1.4 versions.omero-pypi=https://pypi.io/packages/source/o/PACKAGE versions.omero-scripts-url=${versions.omero-pypi} +# hard coded, should not be picked up by scc for now! +versions.omero-zarr-pixel-buffer=0.6.1 + ### ### Appended Values ### diff --git a/ivy.xml b/ivy.xml index 3aa6af6d2e9..759a457762f 100644 --- a/ivy.xml +++ b/ivy.xml @@ -17,5 +17,6 @@ +