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

Sebastien Besson (Staff) s.besson at dundee.ac.uk
Tue Jun 30 22:58:34 BST 2015


As mentioned on a related thread, using ome.tif as the extension for the generated
file should solve the dimensionality issue.
See http://lists.openmicroscopy.org.uk/pipermail/ome-devel/2015-June/003373.html.

Sebastien

On 29 Jun 2015, at 17:31, Jean Ollion <jean.ollion at gmail.com<mailto:jean.ollion at gmail.com>> wrote:

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
_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20150630/0aab8acc/attachment-0001.html>


More information about the ome-devel mailing list