Closed melissalinkert closed 12 months ago
Reporting on the initial testing of this PR using the standard CMU-1.svs
sample as the input. After running bioformats2raw
followed by raw2ometiff --rgb --compression JPEG
, the TIFF layout matches the expectations of this PR:
(java11) sbesson@Sebastiens-MacBook-Pro-3 rgbometiff % tiffinfo ometiff/CMU-1.ome.tiff | grep Samples/P | uniq
Samples/Pixel: 3
(java11) sbesson@Sebastiens-MacBook-Pro-3 rgbometiff % tiffinfo ometiff/CMU-1.ome.tiff | grep "Compression S" | uniq
Compression Scheme: JPEG
(java11) sbesson@Sebastiens-MacBook-Pro-3 rgbometiff % tiffinfo ometiff/CMU-1.ome.tiff | grep "Planar Con" | uniq
Planar Configuration: single image plane
Additionally the OME-TIFF size is now comparable (smaller) to the original SVS file as opposed to almost 10x larger without it
(java11) sbesson@Sebastiens-MacBook-Pro-3 rgbometiff % ls -alh samples/CMU-1.svs
-rw-r--r--@ 1 sbesson staff 169M 6 Nov 16:23 samples/CMU-1.svs
(java11) sbesson@Sebastiens-MacBook-Pro-3 rgbometiff % ls -alh ometiff/CMU-1.ome.tiff
-rw-r--r-- 1 sbesson staff 133M 10 Nov 15:45 ometiff/CMU-1.ome.tiff
The code changes definitely look bigger than they really are. Hiding the whitespace diff (https://github.com/glencoesoftware/raw2ometiff/pull/113/files?diff=split&w=1) is a convenient way to review the actual changes.
I will carry on the testing next week including:
This packs the RGB channels into a single tile (TIFF PlanarConfiguration 1), rather than using a separate tile per RGB channel. This has a noticeable effect on JPEG and JPEG-2000 compression for brightfield slides.
The scary-looking part of this diff is reworking how the RGB channels are iterated over. Instead of a call to
writeTile
for each RGB channel, all RGB channels for the current tile are read, then repacked, and then written once. For the common case where--rgb
is not used (i.e.rgbChannels == 1
), there should be no difference in behavior.For the case where
rgbChannels == 3
, check with both default compression and--compression JPEG
and/or--compression JPEG-2000
.tiffdump
on the output file should show that thePlanarConfiguration
tag is changed with this PR; the file sizes should also be noticeably different with JPEG and JPEG-2000 compression. In local testing withCMU-1.svs
, the output OME-TIFF is now approximately the same size as the original input file.You may wish to test this together with #112, as testing this PR without the changes in #112 will result in harmless but alarming
IllegalArgumentException
s.