Skip to content
Snippets Groups Projects
Commit a7d1a717 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Export table of z-stack patch files and annotations

parent 2a2cb813
No related branches found
No related tags found
No related merge requests found
......@@ -244,15 +244,17 @@ def transfer_ecotaxa_labels_to_patch_stacks(
stack_meta = []
for fi, pl in enumerate(df_tr.itertuples(name='PatchFile')):
fn = pl._asdict()['patch_filename']
ac = pl._asdict()['annotation_class_id']
stack_meta.append({'zi': fi, 'patch_filename': fn, 'annotation_class_id': ac})
ac = pl._asdict()['annotation_class']
aci = pl._asdict()['annotation_class_id']
stack_meta.append({'zi': fi, 'patch_filename': fn, 'annotation_class': ac, 'annotation_class_id': aci})
acc_bm = generate_file_accessor(Path(where_masks) / fn)
assert acc_bm.hw == patch_size, f'Unexpected patch size {patch_size}'
assert acc_bm.chroma == 1
assert acc_bm.nz == 1
mask = acc_bm.data[:, :, 0, 0]
zstacks['mask'][:, :, 0, fi] = mask
zstacks['label'][:, :, 0, fi] = (mask == 255) * ac
zstacks['label'][:, :, 0, fi] = (mask == 255) * aci
acc_pa = generate_file_accessor(Path(where_patches) / fn)
zstacks['raw'][:, :, :, fi] = acc_pa.data[:, :, :, 0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment