@@ -62,8 +62,10 @@ def _initialize_zettasets(
62
62
if "path" not in spec or not spec ["path" ].startswith ("gs://" ):
63
63
raise ValueError (f"Invalid zettaset specification for '{ name } ': missing or invalid 'path'." )
64
64
zettaset_path = spec ["path" ]
65
- print (f"Zettaset { name } [{ zettaset_path } ]" )
66
- zettasets [name ] = Zettaset (zettaset_path , "" , zettaset_resolution )
65
+ print (f"Zettaset `{ name } ` from [{ zettaset_path } ]" )
66
+ resolution = tuple (spec .get ("resolution" , zettaset_resolution ))
67
+ print (f"{ resolution = } " )
68
+ zettasets [name ] = Zettaset (zettaset_path , "" , resolution )
67
69
return zettasets
68
70
69
71
@@ -94,6 +96,7 @@ def _process_sample(
94
96
zettaset_padding : tuple [int , int , int ] = (0 , 0 , 0 ),
95
97
zettaset_padding_spec : dict [str , tuple [int , int , int ]] = {},
96
98
zettaset_mask : bool = True ,
99
+ zettaset_resolution : tuple [int , int , int ] | None = None ,
97
100
** kwargs ,
98
101
) -> dict [str , dict [str , np .ndarray ]]:
99
102
if not is_valid_format (data_id ):
@@ -116,11 +119,15 @@ def _process_sample(
116
119
padding = zettaset_padding_spec .get (data_id , zettaset_spec .get ("padding" , zettaset_padding ))
117
120
no_mask = zettaset_spec .get ("no_mask" , not zettaset_mask )
118
121
122
+ # Determine resolution: zettaset-specific overrides zettaset_resolution
123
+ resolution = tuple (zettaset_spec .get ("resolution" , zettaset_resolution ))
124
+
119
125
print (f"Sample [{ data_id } ]" )
120
126
return {data_id : load_sample (
121
127
zettaset .samples [sample_name ],
122
128
padding ,
123
129
no_mask ,
130
+ resolution ,
124
131
** kwargs ,
125
132
)}
126
133
@@ -129,8 +136,8 @@ def load_sample(
129
136
sample : Sample ,
130
137
padding : tuple [int , int , int ] = (0 , 0 , 0 ),
131
138
no_mask : bool = False ,
139
+ resolution : tuple [int , int , int ] | None = None ,
132
140
zettaset_lookup : dict [str , str ] | None = None ,
133
- zettaset_resolution : tuple [int , int , int ] | None = None ,
134
141
requires_binarize : list [str ] = [],
135
142
zettaset_share_mask : str | None = None ,
136
143
** kwargs
@@ -143,7 +150,7 @@ def convert_array(arr: ArrayLike) -> np.ndarray:
143
150
dset : dict [str , np .ndarray ] = {}
144
151
145
152
# Bbox with padding
146
- resolution = zettaset_resolution or sample .base_resolution
153
+ resolution = resolution or sample .base_resolution
147
154
bbox = sample .bbox * (sample .base_resolution / np .array (resolution ))
148
155
xyz_padding = (
149
156
tuple (reversed (padding ))
0 commit comments