@@ -130,6 +130,7 @@ def load_sample(
130130 padding : tuple [int , int , int ] = (0 , 0 , 0 ),
131131 no_mask : bool = False ,
132132 zettaset_lookup : dict [str , str ] | None = None ,
133+ zettaset_default : dict [str , str ] = {},
133134 zettaset_resolution : tuple [int , int , int ] | None = None ,
134135 requires_binarize : list [str ] = [],
135136 ** kwargs
@@ -168,8 +169,17 @@ def convert_array(arr: ArrayLike) -> np.ndarray:
168169 for name , key in zettaset_lookup .items ():
169170
170171 # 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." )
173183 anno_log = f"\t { name } : { dset [name ].shape } "
174184
175185 # Binarize
0 commit comments