Skip to content

module aicafe.xml

Classes

class XML

This class manipulates the xml file for a case. The xml file is named setting_TH_0_xxx_U.xml in the case folder 0_xxx_U, and contains information about resolutions, landmarks, rigid transformation matrices of sequences, etc.

__init__(self, path)

Initialize an xml.

Parameters:

Name Type Description Default
path str

Path to the xml file of a case.

required
get_rtms(self, names_seqs=None)

Get a dict mapping a sequence name to the rigid transformation matrix for the xml tree of self. See aicafe.xml.get_rtms for more information.

get_rtms(root=None, names_seqs=None)

Get a dict mapping a sequence name to the rigid transformation matrix.

Parameters:

Name Type Description Default
root Union[str, XML, Element]

The root element of an xml tree. If it is a str, it will be regarded as a path to an xml file, whose root element will be used; if it is an aicafe.XML instance, its attribute root will be used; if it is an xml Element instance, itself will be used.

None
names_seqs Union[str, list[str]]

The names of sequences whose rigid transformation matrices need to be retrieved. If it is a str, it will be regarded as the name of the only sequence; if it is a list of str, each string will be regarded as a sequence name; if None, the rigid transformation matrices of all sequences contained in the xml tree of root will be retrieved.

None

Returns:

Name Type Description
name2rtm dict[str, NDArray]

Sequence name -> matrix. The matrix \(A=[R, t]\) has shape of [3, 4], where \(R\) is the \(3\times3\) rotation matrix and \(t\) is a \(3\times1\) column vector of the translation, such that \([x^\prime,y^\prime,z^\prime]^T=A[x,y,z,1]^T\) is the transformed vector.

Back to top