Dtype¶
-
class Dtype¶
class to define the data type of the pixels
Note
only native endianess is supported
Public Types
Public Functions
-
uint8_t bitdepth() const¶
Get the bitdepth of the data type.
- Returns:
bitdepth
-
size_t bytes() const¶
Get the number of bytes of the data type.
-
inline std::string format_descr() const¶
-
inline std::string numpy_descr() const¶
-
explicit Dtype(const std::type_info &t)¶
Construct a DType object from a type_info object.
Note
supported types are: int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double
Note
the type_info object is obtained using typeid (e.g. typeid(int))
- Parameters:
t – type_info object
- Throws:
runtime_error – if the type is not supported
-
explicit Dtype(std::string_view sv)¶
Construct a DType object from a string.
Note
example strings: “<i4”, “u8”, “f4”
Note
the endianess is checked and only native endianess is supported
- Parameters:
sv – string_view
- Throws:
runtime_error – if the type is not supported
-
bool operator==(const std::type_info &t) const¶
-
bool operator!=(const std::type_info &t) const¶
-
std::string to_string() const¶
Get the string representation of the data type.
- Returns:
string representation
-
uint8_t bitdepth() const¶