BlobLayout¶
- class dsviper.BlobLayout(data_type='uchar', components=1)¶
Bases:
objectDescribes the layout of one element in a blob: a data type and a component count.
Stored with a blob, the layout labels its bytes and is part of its id. Nothing checks their count against it until a BlobView or a BlobArray reads them, which refuses a size that is not a whole number of elements.
- byte_count() int¶
Return the size of an element in bytes.
- components() int¶
Return the number of components packed in one element.
- data_type() int¶
Return the code of the data type of one component, 0 to 10.
data_type_representation() renders it as uchar, ushort, uint, ulong, char, short, int, long, half, float or double, which is the spelling the constructor takes.
- data_type_byte_count() int¶
Return the size of the data type in bytes.
- data_type_representation() str¶
Return the name of the data type - uchar, ushort, uint, ulong, char, short, int, long, half, float or double. This is what the constructor takes, where data_type() answers a code.
- static parse(representation: str) BlobLayout¶
Return a BlobLayout by parsing representation.
representation is ‘<data_type>-<components>’ - ‘uchar-1’, ‘float-3’, ‘double-16’. Raise if it is not two parts separated by a dash, if the data type is unknown, or if the component count is zero.
- representation() str¶
Return a string representation.