Search in sources :

Example 6 with TiffEncoder

use of ij.io.TiffEncoder in project GDSC-SMLM by aherbert.

the class SeriesImageSourceTest method saveAsTiff.

private static void saveAsTiff(ImagePlus imp, String path, boolean intelByteOrder) throws IOException {
    // IJ.saveAsTiff(imp, path);
    final FileInfo fi = imp.getFileInfo();
    fi.nImages = imp.getStackSize();
    ij.Prefs.intelByteOrder = intelByteOrder;
    try (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path)))) {
        final TiffEncoder file = new TiffEncoder(fi);
        file.write(out);
    }
}
Also used : FileInfo(ij.io.FileInfo) DataOutputStream(java.io.DataOutputStream) FileOutputStream(java.io.FileOutputStream) TiffEncoder(ij.io.TiffEncoder) BufferedOutputStream(java.io.BufferedOutputStream)

Aggregations

TiffEncoder (ij.io.TiffEncoder)6 FileInfo (ij.io.FileInfo)5 BufferedOutputStream (java.io.BufferedOutputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 DataOutputStream (java.io.DataOutputStream)3 FileOutputStream (java.io.FileOutputStream)3 IOException (java.io.IOException)3 ZipEntry (java.util.zip.ZipEntry)3 ZipOutputStream (java.util.zip.ZipOutputStream)3 ImagePlus (ij.ImagePlus)1 FileSaver (ij.io.FileSaver)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 RandomAccessFile (java.io.RandomAccessFile)1 FormatException (loci.formats.FormatException)1 ExtendedFileInfo (uk.ac.sussex.gdsc.core.ij.io.ExtendedFileInfo)1