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

Batch workflow now running without errors and creating meaningful output data

parent 29f45db2
No related branches found
No related tags found
No related merge requests found
......@@ -265,36 +265,31 @@ def infer_object_map_from_zstack(
# send patches and mask stacks to object classifier
result_acc, _ = object_classifier.infer(patches_acc, patch_masks_acc)
object_labels_map = np.copy(interm['label_map'])
assert object_labels_map.shape == interm['label_map'].shape
assert object_labels_map.dtype == interm['label_map'].dtype
labels_map = interm['label_map']
output_map = np.zeros(labels_map.shape, dtype=labels_map.dtype)
assert labels_map.shape == interm['label_map'].shape
assert labels_map.dtype == interm['label_map'].dtype
# assign labels to object map:
meta = []
for ii in range(0, len(zmask_meta)):
mi = zmask_meta[ii]
object_label_id = mi['info'].label
result_label_map = mask_largest_object(result_acc.iat(ii))
assert result_label_map.ndim == 2
unique_values = np.unique(result_label_map)
if not len(unique_values) == 2:
mask_largest_object(result_label_map)
raise Exception()
assert unique_values[0] == 0
ii_mask = object_labels_map == object_label_id
object_labels_map[ii_mask] = unique_values[1]
# object_labels_map[ii_mask] = np.unique(
# mask_largest_object(
# result_acc.iat(ii)
# )
# )[1]
# patch = patches_acc.iat(ii)
object_id = zmask_meta[ii]['info'].label
result_patch = mask_largest_object(result_acc.iat(ii))
object_class = np.unique(result_patch)[1]
output_map[labels_map == object_id] = object_class
meta.append({'object_id': ii, 'object_class': object_id})
write_accessor_data_to_file(
Path(output_folder_path) / 'obj_classes_' / (fstem + '.tif'),
object_labels_map
Path(output_folder_path) / ('obj_classes_' + (fstem + '.tif')),
InMemoryDataAccessor(output_map)
)
ti.click('export_object_classes')
return ti
return {
'timer_results': ti.events,
'dataframe': pd.DataFrame(meta),
'interm': {},
}
......
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