Skip to content

Commit

Permalink
allow y or annotated labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ngreenwald committed May 22, 2020
1 parent 4a3d153 commit b4c48b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions caliban_toolbox/utils/io_utils.py
Expand Up @@ -200,13 +200,16 @@ def load_npzs(crop_dir, log_data, verbose=True):
if os.path.exists(npz_path):
temp_npz = np.load(npz_path)

# determine how labels were named
labels_key = 'y' if 'y' in list(temp_npz.keys()) else 'annotated'

# last slice may be truncated, modify index
if slice == num_slices - 1:
current_stack_len = temp_npz['X'].shape[1]
current_stack_len = temp_npz[labels_key].shape[1]
else:
current_stack_len = slice_stack_len

stack[fov, :current_stack_len, crop, slice, ...] = temp_npz['y']
stack[fov, :current_stack_len, crop, slice, ...] = temp_npz[labels_key]
else:
# npz not generated, did not contain any labels, keep blank
if verbose:
Expand Down

0 comments on commit b4c48b8

Please sign in to comment.