Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow OME Zarr group #81

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

melissalinkert
Copy link
Member

See glencoesoftware/bioformats2raw#157

This updates the series finding logic to ignore the OME Zarr group, if it exists. Without this change, attempting to convert data generated by glencoesoftware/bioformats2raw#157 resulted in something like:

Exception in thread "main" picocli.CommandLine$ExecutionException: Error while calling command (com.glencoesoftware.pyramid.PyramidFromDirectoryWriter@635eaaf1): java.lang.RuntimeException: java.io.IOException: Path '/home/melissa/test-series/10' is not a valid path or not a directory.
	at picocli.CommandLine.executeUserObject(CommandLine.java:1792)
	at picocli.CommandLine.access$900(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2150)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2144)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
	at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1968)
	at picocli.CommandLine.parseWithHandlers(CommandLine.java:2349)
	at picocli.CommandLine.parseWithHandler(CommandLine.java:2284)
	at picocli.CommandLine.call(CommandLine.java:2560)
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.main(PyramidFromDirectoryWriter.java:210)
Caused by: java.lang.RuntimeException: java.io.IOException: Path '/home/melissa/test-series/10' is not a valid path or not a directory.
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.call(PyramidFromDirectoryWriter.java:242)
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.call(PyramidFromDirectoryWriter.java:97)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1783)
	... 9 more
Caused by: java.io.IOException: Path '/home/melissa/test-series/10' is not a valid path or not a directory.
	at com.bc.zarr.ZarrUtils.ensureDirectory(ZarrUtils.java:159)
	at com.bc.zarr.ZarrGroup.open(ZarrGroup.java:94)
	at com.bc.zarr.ZarrGroup.open(ZarrGroup.java:87)
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.getZarrGroup(PyramidFromDirectoryWriter.java:498)
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.findNumberOfResolutions(PyramidFromDirectoryWriter.java:552)
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.initialize(PyramidFromDirectoryWriter.java:649)
	at com.glencoesoftware.pyramid.PyramidFromDirectoryWriter.call(PyramidFromDirectoryWriter.java:228)
	... 11 more

Since raw2ometiff converts all series anyway, I haven't changed this to read the series list from the OME group attributes.

This should continue to work with Zarr data that doesn't have an OME group at all.

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @melissalinkert. This matches the proposed introduction of a special OME Zarr group in the output of bioformats2raw. This metadata-only group should not be accounted for when computing the series during the OME-TIFF conversion.

Tested with glencoesoftware/bioformats2raw#157 with both HCS and non-HCS data:

(java11) sbesson@Sebastiens-MacBook-Pro-2 bioformats2raw % ./bioformats2raw-0.5.0-SNAPSHOT/bin/bioformats2raw test.fake /tmp/test.ome.zarr
(java11) sbesson@Sebastiens-MacBook-Pro-2 bioformats2raw % ./bioformats2raw-0.5.0-SNAPSHOT/bin/bioformats2raw "plate&plateRows=1&plateCols=1.fake" /tmp/plate.ome.zar

Without this PR, raw2ometiff would fail on the non-HCS NGFF with the cryptic error mentioned in the description but would succeed with the HCS NGFF as the plate handling is different than enumerating the number of top-level groups.

With this PR included, both NGFF samples convert successfully into valid OME-TIFF.

(java11) sbesson@Sebastiens-MacBook-Pro-2 raw2ometiff % ./raw2ometiff-0.3.1-SNAPSHOT/bin/raw2ometiff /tmp/test.ome.zarr  /tmp/test.ome.tiff
(java11) sbesson@Sebastiens-MacBook-Pro-2 raw2ometiff % ./raw2ometiff-0.3.1-SNAPSHOT/bin/raw2ometiff /tmp/plate.ome.zarr /tmp/plate.ome.tiff

I also tried to test various source layout using the --no-root-group and --no-ome-meta-export but the second step of the conversions failed with different errors, which are all in-line with the help of these options

      --no-ome-meta-export   Turn off OME metadata exporting [Will break
                               compatibility with raw2ometiff]
      --no-root-group        Turn off creation of root group and corresponding
                               metadata [Will break compatibility with
                               raw2ometiff]

@melissalinkert is it worth testing compatibility with a NGFF layout generated by bioformats2raw 0.4.0 or have we diverged enough that this should only be compatible with bioformats2raw 0.5.0?

@melissalinkert
Copy link
Member Author

I'd expect this to still work with bioformats2raw 0.4.0 data.

@sbesson sbesson self-requested a review September 22, 2022 16:29
Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regenerated a sample OME-NGFF using the recently released NGFF-converter which is still using bioformats2raw 0.4.0.
An execution of raw2ometiff with this PR included generated an OME-TIFF without issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants