Skip to content

Commit

Permalink
Merge pull request #87 from melissalinkert/move-ome-xml
Browse files Browse the repository at this point in the history
Move METADATA.ome.xml under data.zarr
  • Loading branch information
chris-allan authored Mar 12, 2021
2 parents ef70e17 + 3bcdb44 commit c705515
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,11 @@ public void convert()
String xml = getService().getOMEXML(meta);

// write the original OME-XML to a file
if (!Files.exists(outputPath)) {
Files.createDirectories(outputPath);
Path metadataPath = outputPath.resolve(pyramidName);
if (!Files.exists(metadataPath)) {
Files.createDirectories(metadataPath);
}
Path omexmlFile = outputPath.resolve(METADATA_FILE);
Path omexmlFile = metadataPath.resolve(METADATA_FILE);
Files.write(omexmlFile, xml.getBytes(Constants.ENCODING));
}
catch (ServiceException se) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ void assertTool(String...additionalArgs) throws IOException {
try {
converter = new Converter();
CommandLine.call(converter, args.toArray(new String[]{}));
assertTrue(Files.exists(output.resolve("data.zarr")));
assertTrue(Files.exists(output.resolve("METADATA.ome.xml")));
Path zarr = output.resolve("data.zarr");
assertTrue(Files.exists(zarr));
assertTrue(Files.exists(zarr.resolve("METADATA.ome.xml")));
}
catch (RuntimeException rt) {
throw rt;
Expand Down Expand Up @@ -684,7 +685,7 @@ public void testOriginalMetadata() throws Exception {

input = fake(null, null, originalMetadata);
assertTool();
Path omexml = output.resolve("METADATA.ome.xml");
Path omexml = output.resolve("data.zarr").resolve("METADATA.ome.xml");
StringBuilder xml = new StringBuilder();
Files.lines(omexml).forEach(v -> xml.append(v));

Expand Down Expand Up @@ -798,8 +799,8 @@ public void testHCSMetadata() throws IOException {
ZarrGroup z = ZarrGroup.open(root);

// check valid group layout
// .zattrs (Plate), .zgroup (Plate) and 2 rows
assertEquals(4, Files.list(root).toArray().length);
// METADATA.ome.xml, .zattrs (Plate), .zgroup (Plate) and 2 rows
assertEquals(5, Files.list(root).toArray().length);
for (int row=0; row<2; row++) {
Path rowPath = root.resolve(Integer.toString(row));
// .zgroup (Row) and 3 columns
Expand Down

0 comments on commit c705515

Please sign in to comment.