glencoesoftware / bioformats2raw

Bio-Formats image file format to raw format converter
GNU General Public License v2.0
77 stars 35 forks source link

Cannot convert svs to ome-tiff #175

Closed gsakkis closed 7 months ago

gsakkis commented 1 year ago

Hi, new to bioformats2raw/raw2ometiff. I'm trying to convert CMU-1-Small-Region.svs to OME-TIFF by first converting it to Zarr via bioformats2raw and then to OME-TIFF via raw2ometiff. However the latter complains about a missing directory:

$ bioformats2raw CMU-1-Small-Region.svs /tmp/CMU-1-Small-Region.ome.zarr
$ ll /tmp/CMU-1-Small-Region.ome.zarr
total 16
drwxrwxr-x 2 gsk gsk 4096 Νοε   4 18:32 OME
drwxrwxr-x 7 gsk gsk 4096 Νοε   4 18:32 0
drwxrwxr-x 4 gsk gsk 4096 Νοε   4 18:32 1
drwxrwxr-x 6 gsk gsk 4096 Νοε   4 18:32 2

$ raw2ometiff /tmp/CMU-1-Small-Region.ome.zarr /tmp/CMU-1-Small-Region.ome.tiff
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while calling command (com.glencoesoftware.pyramid.PyramidFromDirectoryWriter@3b2cf7ab): java.lang.RuntimeException: java.io.IOException: Path '/tmp/CMU-1-Small-Region.ome.zarr/3' is not a valid path or not a directory.

What am I missing?

Versions:

$ bioformats2raw --version .
Version = 0.5.0
Bio-Formats version = 6.10.1
NGFF specification version = 0.4

$ raw2ometiff --version .
Version = 0.3.0
Bio-Formats version = 6.4.0
melissalinkert commented 1 year ago

@gsakkis : That problem should have been fixed in https://github.com/glencoesoftware/raw2ometiff/pull/81, which was released in raw2ometiff 0.3.1. Can you try updating your raw2ometiff version to 0.3.1 and see if that works? You shouldn't need to re-run the bioformats2raw command, just raw2ometiff.

gsakkis commented 1 year ago

@melissalinkert thanks for the prompt reply! raw2ometiff 0.3.1. doesn't seem to be available in conda that I use for installing the packages; I'll try to install it manually and see if it works.

gsakkis commented 1 year ago

So I installed raw2ometiff 0.3.1 and it does run without an error, great! Now I am comparing the original svs file with the final ome-tiff and there are some discrepancies, at least according to tifffile:

TiffPageSeries 0 'Baseline' 2967x2220x3 uint8 YXS SVS 1 Pages TiffPageSeries 1 'Thumbnail' 768x574x3 uint8 YXS SVS 1 Pages TiffPageSeries 2 'Label' 463x387x3 uint8 YXS SVS 1 Pages TiffPageSeries 3 'Macro' 431x1280x3 uint8 YXS SVS 1 Pages


- Converted `CMU-1-Small-Region.ome.tiff`

TiffFile 'CMU-1…e.tiff' 11.72 MiB big-endian BigTiff ome 9 Pages 3 Series

TiffPageSeries 0 3x2967x2220 uint8 CYX OME 2 Levels 3 Pages TiffPageSeries 1 'macro image' 3x463x387 uint8 CYX OME 2 Levels 3 Pages TiffPageSeries 2 'label image' 3x431x1280 uint8 CYX OME 4 Levels 3 Pages



- Comparison:
  - There are 4 page series in the original, 3 in the converted; the "Thumbnail" series is apparently missing.
  - The original has 4 pages (1 per series), the converted 9 (3 per series).
  - The original has 1 resolution level per series, the converted has 2 or 4 (although I ran `bioformats2raw` with `--use-existing-resolutions`).
  - The labels of the 'Macro' and 'Label' series are swapped in the converted.

What is the reason of these differences? Are there any optional parameters/flags I can pass to preserve as much of the original structure as possible?
melissalinkert commented 1 year ago

Apologies for not following up on this sooner, @gsakkis. Ultimately these issues are down to outstanding problems in Bio-Formats; there isn’t currently a work-around in bioformats2raw.

For reference, open Bio-Formats issues related to SVS:

https://github.com/ome/bioformats/issues/3682 https://github.com/ome/bioformats/issues/3682 https://github.com/ome/bioformats/issues/3986

We’ll update here once there is a Bio-Formats release that fixes these issues.