scistag.imagestag.size2d.Size2D

class Size2D(value=None, height=None, width=None)[source]

Bases: object

Defines the size of a 2D element in pixels

Parameters

value (Size2DTypes | float | None) – The initial width and height as tuple, a Size2D object

or the width. :type height: float | None :param height: The height :type width: float | None :param width: The width

Example:

``Size2D(50,100) == Size2D(width=50, height=100) == Size2D((50,100)) ==

Size2D(Size2D(50,100))``

Methods

is_empty

Returns if the size is zero

to_int_tuple

Returns the size as int tuple

to_tuple

Returns the size as tuple

Attributes

__annotations__

__dataclass_fields__

__dataclass_params__

__dict__

__doc__

__hash__

__module__

__weakref__

list of weak references to the object (if defined)

width

The width in pixels

height

The height in pixels

is_empty()[source]

Returns if the size is zero

Return type

bool

Returns

True if width and height are zero

to_int_tuple()[source]

Returns the size as int tuple

Returns

Width, Height

to_tuple()[source]

Returns the size as tuple

Returns

Width, Height

height: float

The height in pixels

width: float

The width in pixels