use of loci.formats.codec.CodecOptions in project bioformats by openmicroscopy.
the class TiffCompressionCompressTest method testLZW.
@Test
public void testLZW() throws FormatException, IOException {
TiffCompression compression = TiffCompression.LZW;
CodecOptions options = compression.getCompressionCodecOptions(ifd);
byte[] compressed = compression.compress(data, options);
assertNotNull(compressed);
}
use of loci.formats.codec.CodecOptions in project bioformats by openmicroscopy.
the class TiffCompressionCompressTest method testJPEG.
@Test
public void testJPEG() throws FormatException, IOException {
TiffCompression compression = TiffCompression.JPEG;
ifd.put(IFD.BITS_PER_SAMPLE, new int[] { 8 });
CodecOptions options = compression.getCompressionCodecOptions(ifd);
byte[] compressed = compression.compress(data, options);
assertNotNull(compressed);
}
use of loci.formats.codec.CodecOptions in project bioformats by openmicroscopy.
the class TiffCompressionCompressTest method testDEFLATE.
@Test
public void testDEFLATE() throws FormatException, IOException {
TiffCompression compression = TiffCompression.DEFLATE;
CodecOptions options = compression.getCompressionCodecOptions(ifd);
byte[] compressed = compression.compress(data, options);
assertNotNull(compressed);
}
use of loci.formats.codec.CodecOptions in project bioformats by openmicroscopy.
the class TiffCompressionCompressTest method testJPEG_2000_ResetBlockSize.
@Test(enabled = true)
public void testJPEG_2000_ResetBlockSize() throws FormatException, IOException {
TiffCompression compression = TiffCompression.JPEG_2000;
JPEG2000CodecOptions opt = JPEG2000CodecOptions.getDefaultOptions();
int v = 16;
opt.codeBlockSize = new int[] { v, v };
CodecOptions options = compression.getCompressionCodecOptions(ifd, opt);
assertTrue(options instanceof JPEG2000CodecOptions);
JPEG2000CodecOptions j2k = (JPEG2000CodecOptions) options;
assertEquals(j2k.codeBlockSize.length, opt.codeBlockSize.length);
for (int i = 0; i < j2k.codeBlockSize.length; i++) {
assertEquals(j2k.codeBlockSize[i], opt.codeBlockSize[i]);
}
compression = TiffCompression.JPEG_2000_LOSSY;
options = compression.getCompressionCodecOptions(ifd, opt);
assertTrue(options instanceof JPEG2000CodecOptions);
j2k = (JPEG2000CodecOptions) options;
assertEquals(j2k.codeBlockSize.length, opt.codeBlockSize.length);
for (int i = 0; i < j2k.codeBlockSize.length; i++) {
assertEquals(j2k.codeBlockSize[i], opt.codeBlockSize[i]);
}
compression = TiffCompression.ALT_JPEG2000;
options = compression.getCompressionCodecOptions(ifd, opt);
j2k = (JPEG2000CodecOptions) options;
assertEquals(j2k.codeBlockSize.length, opt.codeBlockSize.length);
for (int i = 0; i < j2k.codeBlockSize.length; i++) {
assertEquals(j2k.codeBlockSize[i], opt.codeBlockSize[i]);
}
}
use of loci.formats.codec.CodecOptions in project bioformats by openmicroscopy.
the class TiffCompressionCompressTest method testUNCOMPRESSED.
@Test
public void testUNCOMPRESSED() throws FormatException, IOException {
TiffCompression compression = TiffCompression.UNCOMPRESSED;
CodecOptions options = compression.getCompressionCodecOptions(ifd);
byte[] compressed = compression.compress(data, options);
assertNotNull(compressed);
assertEquals(compressed.length, data.length);
}
Aggregations