Skip to content

Commit

Permalink
Merge pull request #155 from melissalinkert/ngff-version-report
Browse files Browse the repository at this point in the history
Add NGFF spec version to `--version` output
  • Loading branch information
chris-allan committed May 19, 2022
2 parents 6ee2587 + ba198b9 commit b1e6f7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public class Converter implements Callable<Void> {
/** Version of the bioformats2raw layout. */
public static final Integer LAYOUT = 3;

/** NGFF specification version.*/
public static final String NGFF_VERSION = "0.4";

@Parameters(
index = "0",
arity = "1",
Expand Down Expand Up @@ -426,6 +429,7 @@ public Void call() throws Exception {
).orElse("development");
System.out.println("Version = " + version);
System.out.println("Bio-Formats version = " + FormatTools.VERSION);
System.out.println("NGFF specification version = " + NGFF_VERSION);
return null;
}

Expand Down Expand Up @@ -1525,6 +1529,7 @@ private void saveHCSMetadata(IMetadata meta) throws IOException {
plateMap.put("rows", rows);

plateMap.put("field_count", maxField + 1);
plateMap.put("version", NGFF_VERSION);

Map<String, Object> attributes = root.getAttributes();
attributes.put("plate", plateMap);
Expand Down Expand Up @@ -1576,7 +1581,7 @@ private void setSeriesLevelMetadata(int series, int resolutions)
multiscale.put("type", downsampling.getName());
}
multiscale.put("metadata", metadata);
multiscale.put("version", nested ? "0.4" : "0.1");
multiscale.put("version", nested ? NGFF_VERSION : "0.1");
multiscales.add(multiscale);

IFormatReader v = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ public void testHCSMetadata() throws Exception {
Map<String, Object> plate =
(Map<String, Object>) z.getAttributes().get("plate");
assertEquals(fieldCount, ((Number) plate.get("field_count")).intValue());
assertEquals("0.4", plate.get("version"));

List<Map<String, Object>> acquisitions =
(List<Map<String, Object>>) plate.get("acquisitions");
Expand Down Expand Up @@ -1034,6 +1035,7 @@ public void testHCSMetadataNoAcquisitions() throws Exception {
Map<String, Object> plate =
(Map<String, Object>) z.getAttributes().get("plate");
assertEquals(fieldCount, ((Number) plate.get("field_count")).intValue());
assertEquals("0.4", plate.get("version"));

List<Map<String, Object>> rows =
(List<Map<String, Object>>) plate.get("rows");
Expand Down Expand Up @@ -1112,6 +1114,7 @@ public void testSingleWell() throws IOException {
Map<String, Object> plate =
(Map<String, Object>) z.getAttributes().get("plate");
assertEquals(fieldCount, ((Number) plate.get("field_count")).intValue());
assertEquals("0.4", plate.get("version"));

List<Map<String, Object>> acquisitions =
(List<Map<String, Object>>) plate.get("acquisitions");
Expand Down Expand Up @@ -1174,6 +1177,7 @@ public void testTwoWells(String resourceName) throws IOException {
Map<String, Object> plate =
(Map<String, Object>) z.getAttributes().get("plate");
assertEquals(fieldCount, ((Number) plate.get("field_count")).intValue());
assertEquals("0.4", plate.get("version"));

List<Map<String, Object>> acquisitions =
(List<Map<String, Object>>) plate.get("acquisitions");
Expand Down Expand Up @@ -1234,6 +1238,7 @@ public void testOnePlateRow() throws IOException {
Map<String, Object> plate =
(Map<String, Object>) z.getAttributes().get("plate");
assertEquals(fieldCount, ((Number) plate.get("field_count")).intValue());
assertEquals("0.4", plate.get("version"));

List<Map<String, Object>> acquisitions =
(List<Map<String, Object>>) plate.get("acquisitions");
Expand Down Expand Up @@ -1289,6 +1294,7 @@ public void testSingleWellTwoAcquisitions() throws IOException {
Map<String, Object> plate =
(Map<String, Object>) z.getAttributes().get("plate");
assertEquals(fieldCount, ((Number) plate.get("field_count")).intValue());
assertEquals("0.4", plate.get("version"));

List<Map<String, Object>> acquisitions =
(List<Map<String, Object>>) plate.get("acquisitions");
Expand Down

0 comments on commit b1e6f7d

Please sign in to comment.