Skip to content

Commit 77b57aa

Browse files
committed
Add 5D test datasets and related functionality for OME-Zarr v0.4 and v0.5
* Implement corresponding tests in `DefaultPyramidal5DImageDataTest`.
1 parent 95f4adf commit 77b57aa

28 files changed

Lines changed: 470 additions & 7 deletions

File tree

src/test/java/sc/fiji/ome/zarr/pyramid/DefaultPyramidal5DImageDataTest.java

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ class DefaultPyramidal5DImageDataTest
3232
static Stream< String > omeZarrExamples()
3333
{
3434
return Stream.of(
35-
"sc/fiji/ome/zarr/util/2d_testing/ome_zarr_v4_example"
35+
"sc/fiji/ome/zarr/util/2d_testing/ome_zarr_v4_example",
36+
"sc/fiji/ome/zarr/util/5d_testing/5d_dataset_v4.ome.zarr"
3637
// "sc/fiji/ome/zarr/util/2d_testing/ome_zarr_v5_example" // NB: OME v05 not supported yet
38+
// "sc/fiji/ome/zarr/util/5d_testing/5d_dataset_v5.ome.zarr" // NB: OME v05 not supported yet
3739
);
3840
}
3941

@@ -60,8 +62,17 @@ void testAsDataset( String resource ) throws URISyntaxException
6062
assertNotNull( ijDataset );
6163
ImgPlus< ? > imgPlus = ijDataset.getImgPlus();
6264
assertNotNull( imgPlus );
63-
assertEquals( 1000, imgPlus.dimension( 0 ) );
64-
assertEquals( 1000, imgPlus.dimension( 1 ) );
65+
if ( resource.contains( "5d_testing" ) )
66+
{
67+
assertEquals( 64, imgPlus.dimension( 0 ) );
68+
assertEquals( 64, imgPlus.dimension( 1 ) );
69+
assertEquals( 16, imgPlus.dimension( 2 ) );
70+
}
71+
if ( resource.contains( "ome_zarr_v" ) )
72+
{
73+
assertEquals( 1000, imgPlus.dimension( 0 ) );
74+
assertEquals( 1000, imgPlus.dimension( 1 ) );
75+
}
6576
assertEquals( ZarrTestUtils.IMAGE_NAME, imgPlus.getName() );
6677
}
6778
}
@@ -85,7 +96,11 @@ void testNumDimensions( String resource ) throws URISyntaxException
8596
{
8697
DefaultPyramidal5DImageData< ?, ? > dataset = load( resource, context );
8798
assertNotNull( dataset );
88-
assertEquals( 2, dataset.numDimensions() ); // NB: two spatial dimensions
99+
if ( resource.contains( "5d_testing" ) )
100+
assertEquals( 5, dataset.numDimensions() ); // NB: xyzct
101+
if ( resource.contains( "ome_zarr_v" ) )
102+
assertEquals( 2, dataset.numDimensions() ); // NB: xy
103+
89104
}
90105
}
91106

@@ -96,7 +111,10 @@ void testNumTimepoints( String resource ) throws URISyntaxException
96111
try (Context context = new Context())
97112
{
98113
Pyramidal5DImageData< ? > pyramidal5DImageData = load( resource, context );
99-
assertEquals( 1, pyramidal5DImageData.numTimepoints() );
114+
if ( resource.contains( "5d_testing" ) )
115+
assertEquals( 2, pyramidal5DImageData.numTimepoints() );
116+
if ( resource.contains( "ome_zarr_v" ) )
117+
assertEquals( 1, pyramidal5DImageData.numTimepoints() );
100118
}
101119
}
102120

@@ -107,7 +125,10 @@ void testNumChannels( String resource ) throws URISyntaxException
107125
try (Context context = new Context())
108126
{
109127
Pyramidal5DImageData< ? > pyramidal5DImageData = load( resource, context );
110-
assertEquals( 1, pyramidal5DImageData.numChannels() );
128+
if ( resource.contains( "5d_testing" ) )
129+
assertEquals( 2, pyramidal5DImageData.numChannels() );
130+
if ( resource.contains( "ome_zarr_v" ) )
131+
assertEquals( 1, pyramidal5DImageData.numChannels() );
111132
}
112133
}
113134

@@ -143,7 +164,10 @@ void testGetType( String resource ) throws URISyntaxException
143164
{
144165
Pyramidal5DImageData< ? > pyramidal5DImageData = load( resource, context );
145166
Object type = pyramidal5DImageData.getType();
146-
Assertions.assertInstanceOf( LongType.class, type );
167+
if ( resource.contains( "5d_testing" ) )
168+
Assertions.assertInstanceOf( UnsignedByteType.class, type );
169+
if ( resource.contains( "ome_zarr_v" ) )
170+
Assertions.assertInstanceOf( LongType.class, type );
147171
}
148172
}
149173

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"multiscales": [
3+
{
4+
"datasets": [
5+
{
6+
"path": "0",
7+
"coordinateTransformations": [
8+
{
9+
"type": "scale",
10+
"scale": [
11+
1.0,
12+
1.0,
13+
1.0,
14+
1.0,
15+
1.0
16+
]
17+
}
18+
]
19+
},
20+
{
21+
"path": "1",
22+
"coordinateTransformations": [
23+
{
24+
"type": "scale",
25+
"scale": [
26+
1.0,
27+
1.0,
28+
2.0,
29+
2.0,
30+
2.0
31+
]
32+
}
33+
]
34+
}
35+
],
36+
"name": "image",
37+
"axes": [
38+
{
39+
"name": "t",
40+
"type": "time"
41+
},
42+
{
43+
"name": "c",
44+
"type": "channel"
45+
},
46+
{
47+
"name": "z",
48+
"type": "space"
49+
},
50+
{
51+
"name": "y",
52+
"type": "space"
53+
},
54+
{
55+
"name": "x",
56+
"type": "space"
57+
}
58+
],
59+
"version": "0.4"
60+
}
61+
]
62+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"zarr_format": 2
3+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"shape": [
3+
2,
4+
2,
5+
16,
6+
64,
7+
64
8+
],
9+
"chunks": [
10+
1,
11+
1,
12+
16,
13+
64,
14+
64
15+
],
16+
"dtype": "|u1",
17+
"fill_value": 0,
18+
"order": "C",
19+
"filters": null,
20+
"dimension_separator": "/",
21+
"compressor": {
22+
"id": "blosc",
23+
"cname": "zstd",
24+
"clevel": 5,
25+
"shuffle": 1,
26+
"blocksize": 0
27+
},
28+
"zarr_format": 2
29+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"shape": [
3+
2,
4+
2,
5+
8,
6+
32,
7+
32
8+
],
9+
"chunks": [
10+
1,
11+
1,
12+
16,
13+
64,
14+
64
15+
],
16+
"dtype": "|u1",
17+
"fill_value": 0,
18+
"order": "C",
19+
"filters": null,
20+
"dimension_separator": "/",
21+
"compressor": {
22+
"id": "blosc",
23+
"cname": "zstd",
24+
"clevel": 5,
25+
"shuffle": 1,
26+
"blocksize": 0
27+
},
28+
"zarr_format": 2
29+
}

0 commit comments

Comments
 (0)