MISRelationRectangular

class misalign.model.relation.MISRelationRectangular(image_pair: tuple[str, str], rectangular: tuple[int, int] | None = None, **relation_data)

Relation of an image pair in terms of (x,y) offset.

Rectilinear relationship: A(x,y)=B(0,0).

relation_type=’r’

__init__(image_pair: tuple[str, str], rectangular: tuple[int, int] | None = None, **relation_data)

Initialize a MISRelationRectangular

This relation is the (x,y) value in image a that maps to the (0,0) of image b. These values may be negative if the top left corner (0,0) of image b is not inside image a.

Parameters:
image_pairtuple[str,str]

Pair of image name strings.

rectangulartuple[int,int]|None

Rectangular offset x,y that maps from the (x,y) of image a to the (0,0) of image b.

**relation_datakwargs

Any other passed kwargs will be kept in self._dict and should be JSON dump-able objects.

Methods

__init__(image_pair[, rectangular])

Initialize a MISRelationRectangular

for_json()

Returns a dictionary compatible with JSON.dump().

get_reference()

Get the images names of the pair of images that are related.

get_relation(relation_type)

Get the relation between the images in the specified relation type.

__str__() str

String representation of the Relation.

Returns:
str

Description of the relation.

for_json() dict[str, Any]

Returns a dictionary compatible with JSON.dump().

Returns:
relation_datadict

JSON dump-able representation of relation information.

get_reference() tuple[str, str]

Get the images names of the pair of images that are related.

Returns:
image_pairtuple[str,str]

Pair of image name strings.

get_relation(relation_type) Any | None

Get the relation between the images in the specified relation type.

Parameters:
relation_typestr|None

Valid inputs: ‘r’ for rectangular, ‘p’ for points

Returns:
relationAny|None

‘r’ > tuple[int,int] > (x,y)

‘p’ > list[tuple[tuple[int,int],tuple[int,int]]] > [((x,y),(0,0))]

other > None