Search in sources :

Example 6 with TiffCompression

use of loci.formats.tiff.TiffCompression in project bioformats by openmicroscopy.

the class TiffCompressionDecompressTest method testNIKON.

@Test
public void testNIKON() throws FormatException, IOException {
    TiffCompression compression = TiffCompression.NIKON;
    NikonCodecOptions options = new NikonCodecOptions();
    options.interleaved = OPTIONS.interleaved;
    options.littleEndian = OPTIONS.littleEndian;
    options.maxBytes = OPTIONS.maxBytes;
    options.curve = new int[] { 1 };
    options.vPredictor = new int[] { 1 };
    options.lossless = true;
    options.split = 1;
    assertNotNull(compression.decompress(DATA, options));
}
Also used : TiffCompression(loci.formats.tiff.TiffCompression) NikonCodecOptions(loci.formats.codec.NikonCodecOptions) Test(org.testng.annotations.Test)

Example 7 with TiffCompression

use of loci.formats.tiff.TiffCompression in project bioformats by openmicroscopy.

the class TiffCompressionDecompressTest method testJPEG.

// Needs to have a "properly" encoded JPEG, throws an NPE otherwise
@Test(expectedExceptions = { NullPointerException.class })
public void testJPEG() throws FormatException, IOException {
    TiffCompression compression = TiffCompression.JPEG;
    assertNotNull(compression.decompress(DATA, OPTIONS));
}
Also used : TiffCompression(loci.formats.tiff.TiffCompression) Test(org.testng.annotations.Test)

Example 8 with TiffCompression

use of loci.formats.tiff.TiffCompression in project bioformats by openmicroscopy.

the class TiffCompressionCompressTest method testGROUP_4_FAX.

@Test(expectedExceptions = { FormatException.class })
public void testGROUP_4_FAX() throws FormatException, IOException {
    TiffCompression compression = TiffCompression.GROUP_3_FAX;
    CodecOptions options = compression.getCompressionCodecOptions(ifd);
    compression.compress(data, options);
}
Also used : CodecOptions(loci.formats.codec.CodecOptions) JPEG2000CodecOptions(loci.formats.codec.JPEG2000CodecOptions) TiffCompression(loci.formats.tiff.TiffCompression) Test(org.testng.annotations.Test)

Example 9 with TiffCompression

use of loci.formats.tiff.TiffCompression in project bioformats by openmicroscopy.

the class TiffCompressionCompressTest method testJPEG_2000_ResetNumberDecompositionLevel.

@Test(enabled = true)
public void testJPEG_2000_ResetNumberDecompositionLevel() throws FormatException, IOException {
    TiffCompression compression = TiffCompression.JPEG_2000;
    JPEG2000CodecOptions opt = JPEG2000CodecOptions.getDefaultOptions();
    int v = 16;
    opt.numDecompositionLevels = v;
    CodecOptions options = compression.getCompressionCodecOptions(ifd, opt);
    assertTrue(options instanceof JPEG2000CodecOptions);
    JPEG2000CodecOptions j2k = (JPEG2000CodecOptions) options;
    assertEquals(j2k.numDecompositionLevels, opt.numDecompositionLevels);
    compression = TiffCompression.JPEG_2000_LOSSY;
    options = compression.getCompressionCodecOptions(ifd, opt);
    assertTrue(options instanceof JPEG2000CodecOptions);
    j2k = (JPEG2000CodecOptions) options;
    assertEquals(j2k.numDecompositionLevels, opt.numDecompositionLevels);
    compression = TiffCompression.ALT_JPEG2000;
    options = compression.getCompressionCodecOptions(ifd, opt);
    j2k = (JPEG2000CodecOptions) options;
    assertEquals(j2k.numDecompositionLevels, opt.numDecompositionLevels);
}
Also used : CodecOptions(loci.formats.codec.CodecOptions) JPEG2000CodecOptions(loci.formats.codec.JPEG2000CodecOptions) TiffCompression(loci.formats.tiff.TiffCompression) JPEG2000CodecOptions(loci.formats.codec.JPEG2000CodecOptions) Test(org.testng.annotations.Test)

Example 10 with TiffCompression

use of loci.formats.tiff.TiffCompression 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);
}
Also used : CodecOptions(loci.formats.codec.CodecOptions) JPEG2000CodecOptions(loci.formats.codec.JPEG2000CodecOptions) TiffCompression(loci.formats.tiff.TiffCompression) Test(org.testng.annotations.Test)

Aggregations

TiffCompression (loci.formats.tiff.TiffCompression)33 Test (org.testng.annotations.Test)31 CodecOptions (loci.formats.codec.CodecOptions)18 JPEG2000CodecOptions (loci.formats.codec.JPEG2000CodecOptions)18 NikonCodecOptions (loci.formats.codec.NikonCodecOptions)1 IFD (loci.formats.tiff.IFD)1 IFDList (loci.formats.tiff.IFDList)1 PhotoInterp (loci.formats.tiff.PhotoInterp)1 TiffRational (loci.formats.tiff.TiffRational)1