@@ -130,6 +130,7 @@ def load_sample(
130
130
padding : tuple [int , int , int ] = (0 , 0 , 0 ),
131
131
no_mask : bool = False ,
132
132
zettaset_lookup : dict [str , str ] | None = None ,
133
+ zettaset_default : dict [str , str ] = {},
133
134
zettaset_resolution : tuple [int , int , int ] | None = None ,
134
135
requires_binarize : list [str ] = [],
135
136
** kwargs
@@ -168,8 +169,17 @@ def convert_array(arr: ArrayLike) -> np.ndarray:
168
169
for name , key in zettaset_lookup .items ():
169
170
170
171
# Annotation
171
- vol = sample .read (key )[key ]
172
- dset [name ] = convert_array (vol )
172
+ if key in sample .annotation_names :
173
+ vol = sample .read (key )[key ]
174
+ dset [name ] = convert_array (vol )
175
+ else :
176
+ if key in zettaset_default :
177
+ shape = tuple (map (int , bbox .size ()))
178
+ dtype = zettaset_default [key ]
179
+ vol = np .zeros (shape , dtype = dtype )
180
+ dset [name ] = np .transpose (vol , (2 , 1 , 0 ))
181
+ else :
182
+ raise KeyError (f"Annotation '{ key } ' not found." )
173
183
anno_log = f"\t { name } : { dset [name ].shape } "
174
184
175
185
# Binarize
0 commit comments