-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
- Allow introspection of TIFF codec support on a per-pixeltype basis; add getCodecNames and getCodecScheme to the tiff Codec support functions - Allow the writer interface to query valid codecs for a given pixel type by adding getCompressionTypes(PixelType) which is a rather more useful variant than the existing getPixelTypes(codec) (which might be deprecated and removed). In the common case, you might want to select a compression type for a given set of pixel data, but altering the pixel type to support a certain codec is less common - Add the supported codecs to the TIFF writers, so that they can be queried and set with the FormatWriter interface - Add unit tests to test with LZW and Deflate compression
NB: since this is fairly often suggested for testing:
can I suggest as an RFE that a flag or environment variable get added to disable the deleting? |
We can certainly do that. |
I've built locally using the superbuild. The tests mentioned above look fine, although there seems to be an inconsistency re: JPEG support for In
In
Is this working as intended? |
I've looked at a few generated files as instructed above and the compression scheme reported by |
@simleo Yes, it's working as intended. In the FormatWriter test:
this is completely contrived data for the unit test; it's not reflective of the actual jpeg restriction shown in the testing of the TIFF code, where it's restricted to unsigned 8-bit only. I can certainly remove INT8 from the FormatWriter test to avoid any confusion though. |
This codec is just an example, not actually JPEG, so rename to avoid any potential confusion regarding the supported pixel types.
@simleo Updated to rename the test (since it's unrelated to JPEG, I just renamed it to not be named |
Having briefly looked at the diff and builds, the feature addition looks sensible and certainly something the community would greatly benefit in 0.3.0. A couple of specific comments/questions:
|
@sbesson Regarding Java, depends upon whether we want to do this work in ome-files-java or bioformats?
Another point to consider for the future: libtiff allows getting and setting of uncompressed pixel data, or compressed pixel data ("encoded" and "raw" variants). We only support uncompressed data in our openBytes/saveBytes API. We might want to consider the addition of a raw variant, so that we can transfer lossy compressed pixel data without introducing recompression artefacts with e.g. bfconvert. Coupled with a proper tile API, it would allow direct transfer of tiles from reader to writer without any decompression or recompression (when the source and destination tile sizes and compression algorithm match). |
I can certainly see the addition of Having gone through the code it looks sensible to me and the supported types all appear correct. The unit tests look fine and run as expected. The manual testing as mentioned also looks to be correct when using both |
Recorded the |
getCodecNames
andgetCodecScheme
to the tiff Codec support functionsgetCompressionTypes(PixelType)
which is a rather more useful variant than the existinggetPixelTypes(codec)
(which might be deprecated and removed). In the common case, you might want to select a compression type for a given set of pixel data, but altering the pixel data to use a different type to support a certain codec is less commonFormatWriter
interfaceTesting:
Should all be taken care of by the included unit tests. Search for
FormatWriterTest.CompressionTypes
andTIFFTest.FieldWrapCompression
for the tiff unit tests, andTIFFWriter.CompressionTypes
for the full set of compression types we support (we exclude esoteric, incompatible and ancient ones). Check that the per-pixeltype support makes sense (as output in theTIFFWriter.CompressionTypes
test).To confirm manually that compression is working, apply this patch on top of this branch:
If using the superbuild, change into the
ome-files-build
directory, re-run the build withmake
orninja
, and then re-run the TIFF tests withctest -R tiff
. This will not delete the generated TIFFs, so you can look at them to check the compression. Example:In this case, the file uses Deflate compression and
tiffinfo
will confirm that. You can also try viewing the file with Bio-Formatsshowinf
to ensure the pixel data is correct. Likewise for LZW compression. Otherwise there will be no compression enabled (None or NoneDefault in the filename). Look intest/ome-files/data
to see what got generated (it's a random selection).TODO: either as a followup or here, add example of enabling compression to our existing pixeldata sample.