Search in sources :

Example 16 with ImageWriter

use of loci.formats.ImageWriter in project bioformats by openmicroscopy.

the class FileExport method initializeWriter.

/**
 * Set up the file writer.
 *
 * @param omexml the IMetadata object that is to be associated with the writer
 * @return true if the file writer was successfully initialized; false if an
 *   error occurred
 */
private boolean initializeWriter(IMetadata omexml) {
    // create the file writer and associate the OME-XML metadata with it
    writer = new ImageWriter();
    writer.setMetadataRetrieve(omexml);
    Exception exception = null;
    try {
        writer.setId(outputFile);
    } catch (FormatException e) {
        exception = e;
    } catch (IOException e) {
        exception = e;
    }
    if (exception != null) {
        System.err.println("Failed to initialize file writer.");
        exception.printStackTrace();
    }
    return exception == null;
}
Also used : ImageWriter(loci.formats.ImageWriter) IOException(java.io.IOException) FormatException(loci.formats.FormatException) EnumerationException(ome.xml.model.enums.EnumerationException) ServiceException(loci.common.services.ServiceException) IOException(java.io.IOException) DependencyException(loci.common.services.DependencyException) FormatException(loci.formats.FormatException)

Aggregations

ImageWriter (loci.formats.ImageWriter)16 FormatException (loci.formats.FormatException)10 DependencyException (loci.common.services.DependencyException)8 ServiceException (loci.common.services.ServiceException)8 ImageReader (loci.formats.ImageReader)7 IOException (java.io.IOException)6 ServiceFactory (loci.common.services.ServiceFactory)6 IMetadata (loci.formats.meta.IMetadata)6 OMEXMLService (loci.formats.services.OMEXMLService)6 IFormatWriter (loci.formats.IFormatWriter)5 EnumerationException (ome.xml.model.enums.EnumerationException)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 PositiveInteger (ome.xml.model.primitives.PositiveInteger)3 List (java.util.List)2 FileFilter (javax.swing.filechooser.FileFilter)2 FileStitcher (loci.formats.FileStitcher)2 IFormatReader (loci.formats.IFormatReader)2 MetadataRetrieve (loci.formats.meta.MetadataRetrieve)2 MetadataStore (loci.formats.meta.MetadataStore)2