Skip to content

Base Type

OMEType

Bases: BaseModel

The base class that all OME Types inherit from.

This provides some global conveniences around auto-setting ids. (i.e., making them optional in the class constructor, but never None after initialization.). It provides a nice __repr__ that hides things that haven't been changed from defaults. It adds *_quantity property for fields that have both a value and a unit, where *_quantity is a pint.Quantity. It also provides pickling support.

from_xml(xml: XMLSource, **kwargs: Any) -> T classmethod

Read an ome-types class from XML.

See docstring of ome_types.from_xml for kwargs.

Note: this will return an instance of whatever the top node is in the XML. so technically, the return type here could be incorrect. But when used properly (Image.from_xml(), Pixels.from_xml(), etc.) on an unusual xml document it can provide additional typing information.

to_xml(**kwargs: Any) -> str

Serialize this object to XML.

See docstring of ome_types.to_xml for kwargs.