Search in sources :

Example 1 with MJPBCodecOptions

use of loci.formats.codec.MJPBCodecOptions in project bioformats by openmicroscopy.

the class NativeQTReader method uncompress.

/**
 * Uncompresses an image plane according to the the codec identifier.
 */
private byte[] uncompress(byte[] pixs, String code) throws FormatException, IOException {
    CodecOptions options = new MJPBCodecOptions();
    options.width = getSizeX();
    options.height = getSizeY();
    options.bitsPerSample = bitsPerPixel;
    options.channels = bitsPerPixel < 40 ? bitsPerPixel / 8 : (bitsPerPixel - 32) / 8;
    options.previousImage = canUsePrevious ? prevPixels : null;
    options.littleEndian = isLittleEndian();
    options.interleaved = isRGB();
    if (code.equals("raw "))
        return pixs;
    else if (code.equals("rle ")) {
        return new QTRLECodec().decompress(pixs, options);
    } else if (code.equals("rpza")) {
        return new RPZACodec().decompress(pixs, options);
    } else if (code.equals("mjpb")) {
        ((MJPBCodecOptions) options).interlaced = interlaced;
        return new MJPBCodec().decompress(pixs, options);
    } else if (code.equals("jpeg")) {
        return new JPEGCodec().decompress(pixs, options);
    } else {
        throw new UnsupportedCompressionException("Unsupported codec : " + code);
    }
}
Also used : CodecOptions(loci.formats.codec.CodecOptions) MJPBCodecOptions(loci.formats.codec.MJPBCodecOptions) QTRLECodec(loci.formats.codec.QTRLECodec) MJPBCodec(loci.formats.codec.MJPBCodec) RPZACodec(loci.formats.codec.RPZACodec) UnsupportedCompressionException(loci.formats.UnsupportedCompressionException) MJPBCodecOptions(loci.formats.codec.MJPBCodecOptions) JPEGCodec(loci.formats.codec.JPEGCodec)

Aggregations

UnsupportedCompressionException (loci.formats.UnsupportedCompressionException)1 CodecOptions (loci.formats.codec.CodecOptions)1 JPEGCodec (loci.formats.codec.JPEGCodec)1 MJPBCodec (loci.formats.codec.MJPBCodec)1 MJPBCodecOptions (loci.formats.codec.MJPBCodecOptions)1 QTRLECodec (loci.formats.codec.QTRLECodec)1 RPZACodec (loci.formats.codec.RPZACodec)1