Skip to content

Commit e531f7f

Browse files
Merge pull request #315 from sbesson/well_version_attribute
OME-Zarr 0.5: add version to well group attributes
2 parents c88fde2 + c0327fe commit e531f7f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,20 @@ Output Formatting Options
221221
=========================
222222

223223
By default, the output of `bioformats2raw` will be a
224-
[Zarr dataset](https://zarr.readthedocs.io/en/stable/spec/v2.html) which follows the
224+
[Zarr dataset](https://zarr-specs.readthedocs.io/en/latest/specs.html) which follows the
225225
metadata conventions defined by the
226-
[OME-NGFF 0.4 specification](https://ngff.openmicroscopy.org/0.4/) including the
227-
[bioformats2raw.layout specification](https://ngff.openmicroscopy.org/0.4/#bf2raw).
226+
[version 0.4](https://ngff.openmicroscopy.org/specifications/0.4/) of the OME-Zarr specification including the
227+
[bioformats2raw.layout specification](https://ngff.openmicroscopy.org/specifications/0.4/#bioformats2raw-layout-transitional).
228228

229229
Several formatting options can be passed to the converter and will result in a Zarr dataset
230230
that is not compatible with raw2ometiff and does not strictly follow the OME-NGFF
231231
specification but may be suitable for other applications.
232232

233+
#### --ngff-version
234+
235+
Specifies the version of the [OME-Zarr specification](https://ngff.openmicroscopy.org/specifications/index.html)
236+
that should be used while writing Zarr. Current supported values are 0.4 and 0.5.
237+
233238
#### --pyramid-name
234239

235240
Specifies a subdirectory of the output directory where Zarr data should be written.

src/main/java/com/glencoesoftware/bioformats2raw/Converter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,7 @@ private void saveHCSMetadata(IMetadata meta)
27592759
if (getV3()) {
27602760
Group columnGroup = createGroup(rowPath, columnPath);
27612761
Attributes omeAttrs = new Attributes();
2762+
columnAttrs.put("version", getNGFFVersion().toString());
27622763
omeAttrs.put("ome", columnAttrs);
27632764
((dev.zarr.zarrjava.v3.Group) columnGroup).setAttributes(omeAttrs);
27642765
}

src/test/java/com/glencoesoftware/bioformats2raw/test/ZarrV3Test.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,18 @@ public void testHCS() throws Exception {
147147
long[] arrayShape = new long[] {1, 1, 1, 512, 512};
148148
for (int r=0; r<rowCount; r++) {
149149
for (int c=0; c<colCount; c++) {
150+
Group wellGroup = Group.open(store.resolve(
151+
String.valueOf((char) ('A' + r)),
152+
String.valueOf(c + 1)));
153+
omeAttrs = wellGroup.metadata().attributes.getAttributes("ome");
154+
assertEquals(getNGFFVersion(), omeAttrs.get("version"));
155+
Map<String, Object> well = (Map<String, Object>) omeAttrs.get("well");
156+
List<Map<String, Object>> images =
157+
(List<Map<String, Object>>) well.get("images");
158+
assertEquals(fieldCount, images.size());
150159
for (int f=0; f<fieldCount; f++) {
160+
Map<String, Object> image = (Map<String, Object>) images.get(f);
161+
assertEquals(image.get("path"), String.valueOf(f));
151162
Array array = Array.open(store.resolve(
152163
String.valueOf((char) ('A' + r)),
153164
String.valueOf(c + 1),

0 commit comments

Comments
 (0)