[ome-devel] problem IO tif files using version 5.1.2

Jean Ollion jean.ollion at gmail.com
Mon Jun 29 17:31:59 BST 2015


Hello,
I'm having troubles in basic I/O. When I read a file I just wrote, i get
the wrong number of timepoints and Zslices (they are inverted).

Here is a minimal test example written for JUint, inspired from the website
documentation:
@Rule
    public TemporaryFolder testFolder = new TemporaryFolder();
@org.junit.Test
    public void testIOImageDimensions() {
        String id =
testFolder.newFolder("imageTest").getAbsolutePath()+File.separator+"imageTest.tif";
        int w = 512, h = 512, c = 1, z = 2;
        int pixelType = FormatTools.UINT16;
        byte[] img = new byte[w * h * c *
FormatTools.getBytesPerPixel(pixelType)];
        for (int i = 0; i < img.length; i++) {
            img[i] = (byte) (256 * Math.random());
        }
        try {
            ServiceFactory factory = new ServiceFactory();
            OMEXMLService service =
factory.getInstance(OMEXMLService.class);
            IMetadata meta = service.createOMEXMLMetadata();
            MetadataTools.populateMetadata(meta, 0, null, false, "XYZCT",
FormatTools.getPixelTypeString(pixelType), w, h, z, c, 1, c);
            IFormatWriter writer = new loci.formats.ImageWriter();
            writer.setMetadataRetrieve(meta);
            writer.setId(id);
            writer.saveBytes(0, img);
            writer.saveBytes(1, img);
            writer.close();
        } catch (Exception e) {
            fail("problem writing image to disk");
        }

        ImageProcessorReader r = new ImageProcessorReader(new
ChannelSeparator(LociPrefs.makeImageReader()));
        try {
            r.setId(id);
            Assert.assertEquals("testing file series number", 1,
r.getSeriesCount());
            //Assert.assertEquals("testing file timePoints number", 1,
r.getSizeT());
            Assert.assertEquals("testing file channels number", 1,
r.getSizeC());
            Assert.assertEquals("testing image width", w, r.getSizeX());
            Assert.assertEquals("testing image heigth", h, r.getSizeY());
            //Assert.assertEquals("testing image depth", z, r.getSizeZ());

            r.close();
        } catch (FormatException exc) {
            fail("error reading image");
        } catch (IOException exc) {
            fail("error reading image");
        }
    }

The commented Assertions fail.

in maven i have the following dependencies related to bioformats:
<dependency>
            <groupId>ome</groupId>
            <artifactId>formats-gpl</artifactId>
            <version>5.1.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ome</groupId>
            <artifactId>loci_tools</artifactId>
            <version>5.1.2</version>
            <scope>compile</scope>
</dependency>

Could you point me out the problem?
Thanks,
Jean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20150629/e7df644d/attachment.html>


More information about the ome-devel mailing list