sclass AOA_CompareImagesToProtos implements Steppable { new Map images; new Map protos; new AllOnAll allOnAll; new Map> bestProtoForImage; new Map> bestImageForProto; void addImages(Map images) { putAll(this.images, images); for (S id : keys(images)) allOnAll.newA(id); } void addProtos(Map protos) { putAll(this.protos, protos); for (S id : keys(protos)) allOnAll.newB(id); } public bool step() { PairS p = allOnAll.next(); if (p == null) false; BWImage img1 = images.get(p.a); BWImage img2 = protos.get(p.b); Scored bestProto = bestProtoForImage.get(p.a); float sim = bwImageSimilarityResized(img1, img2, score(bestProto)); scoredMapPut(bestProtoForImage, p.a, p.b, sim); scoredMapPut(bestImageForProto, p.b, p.a, sim); true; } Map scoresForProtos() { ret mapValues doubleScore(bestImageForProto); } }