From ebb14c78ec87a45ed94786addc740142fc140546 Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Fri, 1 May 2020 11:20:53 -0500 Subject: [PATCH] Check the value of the "bioformats2raw.layout" attribute Fail fast if the attribute is missing or indicates an unsupported format version. --- .../glencoesoftware/pyramid/PyramidFromDirectoryWriter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java b/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java index ce57c09..a9a5ede 100755 --- a/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java +++ b/src/main/java/com/glencoesoftware/pyramid/PyramidFromDirectoryWriter.java @@ -465,6 +465,11 @@ public void initialize() if (n5Reader == null) { throw new FormatException("Could not create an N5 reader"); } + Integer layoutVersion = + n5Reader.getAttribute("/", "bioformats2raw.layout", Integer.class); + if (layoutVersion == null || layoutVersion != 1) { + throw new FormatException("Unsupported version: " + layoutVersion); + } LOG.info("Creating tiled pyramid file {}", this.outputFilePath);