MaskAlignmentsFile

class lib.align.objects.MaskAlignmentsFile(mask: bytes, affine_matrix: ndarray[tuple[Any, ...], dtype[float32]], interpolator: int, stored_size: int, stored_centering: Literal['face', 'head', 'legacy'])

Bases: DataclassDict

Dataclass for storing Masks in alignments files and PNG Headers

Methods Summary

from_dict(data_dict)

Load the contents from a serialized python dict into this dataclass

to_dict()

Obtain the contents of the dataclass object as a python dictionary

Methods Documentation

Parameters:
  • mask (bytes)

  • affine_matrix (ndarray[tuple[Any, ...], dtype[float32]])

  • interpolator (int)

  • stored_size (int)

  • stored_centering (Literal['face', 'head', 'legacy'])

classmethod from_dict(data_dict: dict[str, Any]) Self

Load the contents from a serialized python dict into this dataclass

Parameters:

data_dict (dict[str, Any]) – The data to load into the dataclass

Return type:

Self

to_dict() dict[str, Any]

Obtain the contents of the dataclass object as a python dictionary

Return type:

The dataclass object as a python dictionary, with numpy arrays converted to lists

affine_matrix: ndarray[tuple[Any, ...], dtype[float32]] = <dataclasses._MISSING_TYPE object>

The affine matrix that takes the mask from stored space to frame space

interpolator: int = <dataclasses._MISSING_TYPE object>

The interpolator required to take the mask from stored space to frame space

mask: bytes = <dataclasses._MISSING_TYPE object>

The zlib compressed UINT8 mask of shape (stored_size, stored_size)

stored_centering: Literal['face', 'head', 'legacy'] = <dataclasses._MISSING_TYPE object>

The (legacy, face, head) centering type of the mask

stored_size: int = <dataclasses._MISSING_TYPE object>

The size the mask is stored at