Further details on exporting raw pixel data to OME-TIFF files ============================================================= This document explains how to export pixel data to OME-TIFF using Bio-Formats version 4.2 and later. .. only:: html Working example code is provided in :download:`FileExport.java ` - code from that class is referenced here in part. You will need to have bioformats_package.jar in your Java CLASSPATH in order to compile FileExport.java. The first thing that must happen is we must create the object that stores OME-XML metadata. This is done as follows: :: ServiceFactory factory = new ServiceFactory(); OMEXMLService service = factory.getInstance(OMEXMLService.class); IMetadata omexml = service.createOMEXMLMetadata(); The 'omexml' object can now be used in our code to store OME-XML metadata, and by the file format writer to retrieve OME-XML metadata. Now that we have somewhere to put metadata, we need to populate as much metadata as we can. The minimum amount of metadata required is: - endianness of the pixel data - the order in which dimensions are stored - the bit depth of the pixel data - the number of channels - the number of timepoints - the number of Z sections - the width (in pixels) of an image - the height (in pixels) of an image - the number of samples per channel (3 for RGB images, 1 otherwise) We populate that metadata as follows: :: omexml.setImageID("Image:0", 0); omexml.setPixelsID("Pixels:0", 0); // specify that the pixel data is stored in big-endian order // replace 'TRUE' with 'FALSE' to specify little-endian order omexml.setPixelsBinDataBigEndian(Boolean.TRUE, 0, 0); omexml.setPixelsDimensionOrder(DimensionOrder.XYCZT, 0); omexml.setPixelsType(PixelType.UINT16, 0); omexml.setPixelsSizeX(new PositiveInteger(width), 0); omexml.setPixelsSizeY(new PositiveInteger(height), 0); omexml.setPixelsSizeZ(new PositiveInteger(zSectionCount), 0); omexml.setPixelsSizeC(new PositiveInteger(channelCount * samplesPerChannel), 0); omexml.setPixelsSizeT(new PositiveInteger(timepointCount), 0); for (int channel=0; channel