rectangular_solve

misalign.canvas.canvas_rectangular.rectangular_solve(relations: list[dict[str, tuple]], image_names: list[str], origin: str, relation_map_function: Callable | None = None) dict[str, tuple[int, int]]

Finds the origin relative position of images given their relative relationships.

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

List of rectangular relations(as dicts) in the form: [{‘ref’:(‘image a’,’image b’),’rel’:(x,y)},…]. The offset x,y maps from the (x,y) of image a to the (0,0) of image b.

image_nameslist[str]

List of image names.

originstr

Image name to start relation map at.

relation_map_functionCallable

Default simple_relation_map. Any function that accepts relations,image_names,origin and returns {‘image a’:[(‘image b’,{rectangular relation dict a-b}),…],…}

Returns:
origin_relative_offsetsdict[str, tuple[int, int]]

Output is a dictionary of the form “image_name”:(origin-relative x, origin-relative y) Origin-relative x and y may be negative values.