@@ -31,19 +31,19 @@ public void testCoordinateTransformParsing() {
31
31
final N5Reader zarr = new N5Factory ().openReader (rootF .toString ());
32
32
33
33
final OmeNgffMetadataParser grpParser = new OmeNgffMetadataParser ();
34
- test (grpParser .parseMetadata (zarr , setupNode ("coordTforms/ss" , "s0" )),
34
+ test (grpParser .parseMetadata (zarr , setupNode (zarr , "coordTforms/ss" , "s0" )),
35
35
new double []{4 , 4 },
36
36
new double []{0 , 0 });
37
37
38
- test (grpParser .parseMetadata (zarr , setupNode ("coordTforms/st" , "s0" )),
38
+ test (grpParser .parseMetadata (zarr , setupNode (zarr , "coordTforms/st" , "s0" )),
39
39
new double []{2 , 2 },
40
40
new double []{10 , 10 });
41
41
42
- test (grpParser .parseMetadata (zarr , setupNode ("coordTforms/ts" , "s0" )),
42
+ test (grpParser .parseMetadata (zarr , setupNode (zarr , "coordTforms/ts" , "s0" )),
43
43
new double []{2 , 2 },
44
44
new double []{20 , 20 });
45
45
46
- test (grpParser .parseMetadata (zarr , setupNode ("coordTforms/tt" , "s0" )),
46
+ test (grpParser .parseMetadata (zarr , setupNode (zarr , "coordTforms/tt" , "s0" )),
47
47
new double []{1 , 1 },
48
48
new double []{20 , 20 });
49
49
}
@@ -61,12 +61,17 @@ private void test(final Optional<OmeNgffMetadata> metaOpt, final double[] expect
61
61
assertArrayEquals (expectedTranslation , tform .getTranslationCopy (), EPS );
62
62
}
63
63
64
- private N5TreeNode setupNode (final String path , final String childPath ) {
64
+ protected static N5TreeNode setupNode (final N5Reader n5 , final String path , final String childPath ) {
65
65
66
+ final String absoluteChildPath = path + "/" + childPath ;
66
67
final N5TreeNode node = new N5TreeNode (path );
67
- final N5TreeNode child = new N5TreeNode (path + "/" + childPath );
68
- final DatasetAttributes attrs = new DatasetAttributes (new long []{4 , 4 }, new int []{4 , 4 }, DataType .UINT8 , new RawCompression ());
69
- child .setMetadata (new N5SingleScaleMetadata (path + "/" + childPath , new AffineTransform3D (),
68
+ final N5TreeNode child = new N5TreeNode (absoluteChildPath );
69
+
70
+ DatasetAttributes attrs = n5 .getDatasetAttributes (absoluteChildPath );
71
+ if (attrs == null ) // add dummy attributes of non are present
72
+ attrs = new DatasetAttributes (new long []{4 , 4 }, new int []{4 , 4 }, DataType .UINT8 , new RawCompression ());
73
+
74
+ child .setMetadata (new N5SingleScaleMetadata (absoluteChildPath , new AffineTransform3D (),
70
75
new double []{1 , 1 }, new double []{1 , 1 }, new double []{0 , 0 }, "" , attrs , false ));
71
76
72
77
node .add (child );
0 commit comments