simple_relation_map

misalign.canvas.canvas_rectangular.simple_relation_map(relations: list[dict[str, tuple]], image_names: list[str], origin: str) dict[str, list[tuple]]

Identify a simple map from the origin to other images in a list of relations.

Parameters:
relationslist[dict[str, tuple[str, str] | Any]]

List of relations(as dicts) in the form: [{‘ref’:(‘image a’,’image b’),…},…].

image_nameslist[str]

List of image names.

originstr

Image name to start relation map at.

Returns:
relation_mapdict[str,list[tuple]]

Dictionary of the form {‘image a’:[(‘image b’,{rectangular relation dict a-b}),…],…}

Notes

Search is done breadth-wise from the origin and is ‘sorted’ by the order in image_names. Especially for snake-style relations this naive approach can cause fairly significant misalignment stackup. Adding additional relations that shorten the image path to the origin can help reduce this issue.