File size: 731 Bytes
69591a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from tqdm.auto import tqdm
from dnafiber.data.utils import read_colormask
import numpy as np
def build_consensus_map(intergraders, root_img, list_img):
all_masks = []
for img_path in tqdm(list_img):
path_from_root = img_path.relative_to(root_img)
masks = []
for intergrader in intergraders:
intergrader_path = (intergrader / path_from_root).with_suffix(".png")
if not intergrader_path.exists():
print(f"Missing {intergrader_path}")
continue
mask = read_colormask(intergrader_path)
masks.append(mask)
masks = np.array(masks)
all_masks.append(masks)
return np.array(all_masks)
|