IOLink C# 1.11.0
Loading...
Searching...
No Matches
IOLink.DataType Class Reference

Stores information about a data type. More...

Inheritance diagram for IOLink.DataType:

Public Member Functions

 DataType (global::System.IntPtr cPtr, bool cMemoryOwn)
 
void Dispose ()
 
override bool Equals (object obj)
 
 DataType ()
 Default constructor, creating an opaque type.
 
 DataType (ulong value)
 Build a DataType from an id.
 
 DataType (DataTypeId value)
 Build a DataType from a DataTypeId.
 
 DataType (PrimitiveTypeId primitiveType, uint dimension, uint bitDepth, DataTypeInterpretation interpretation)
 Build a DataType from its properties.
 
 DataType (PrimitiveTypeId primitiveType, uint dimension, uint bitDepth)
 Build a DataType from its properties.
 
bool IsNumeric ()
 Checks if the type is a mathematical one.
 
bool IsScalar ()
 Checks if the type is a scalar numeric value.
 
bool IsVector ()
 Checks if the type is a vector of numeric values.
 
bool IsConvertibleTo (DataType other)
 Checks if this type is trivially convertible to another.
 
ulong GetId ()
 Return unique id representing this datatype. Can be used inside a switch/case statement.
 
uint GetBitDepth ()
 Return the bit depth of this type. (i.e. UINT8 => 8 bit depth, VEC3_UINT16 => 16 bit depth)
 
uint GetElementCount ()
 Return the number of sub-values included in this type.
 
PrimitiveTypeId GetPrimitiveType ()
 Return the primitive type of the current type.
 
DataTypeInterpretation GetInterpretation ()
 The DataType interpretation.
 
uint BitCount ()
 Get the number of bits required to store the type.
 
uint ByteCount ()
 Get the number of bits required to store the type.
 
string ToString ()
 Return a readable version of the DataType.
 

Static Public Member Functions

static global::System.Runtime.InteropServices.HandleRef getCPtr (DataType obj)
 
static global::System.Runtime.InteropServices.HandleRef swigRelease (DataType obj)
 
static implicit operator DataType (DataTypeId id)
 
static bool operator== (DataType v1, DataType v2)
 
static bool operator!= (DataType v1, DataType v2)
 
static DataType ExtractScalarType (DataType dtype)
 Return scalar type in case of multi dimensionnal DataType.
 
static Vector2d StandardRange (DataType dtype)
 Return conventional range for given DataType.
 

Protected Member Functions

virtual void Dispose (bool disposing)
 

Protected Attributes

bool swigCMemOwn
 

Properties

ulong Id [get]
 The identifier associated with this DataType
 
uint BitDepth [get]
 The number of bits used to store the element's values.
 
uint ElementCount [get]
 The number of components in this DataType
 
PrimitiveTypeId PrimitiveType [get]
 The family of type from which this DataType is from.
 
DataTypeInterpretation Interpretation [get]
 The way how this DataType should be interpreted.
 

Detailed Description

Stores information about a data type.

DataType is associated with an ID, with wich the type can be uniquely identified. Although this ID is composed of multiple fields:

  • ScalarType: base type of each component.
  • BitDepth: bit depth for each component.
  • Dimension: the number of components.
  • Interpretation: What the DataType represents in particular.

See user guide for more explainations.

These fields can have different meaning bases on the scalar type or the flags. For example the bitDepth field indicate the precision for integer and floating point types, and the size of a coding point in an unicode string.

Examples
CheckerBoard.cs, CheckerBoardFast.cs, ColorWheel.cs, CopyImageView.cs, CreateDataFrame.cs, DiskImageView.cs, GradientFloatImage.cs, GradientFloatToInt.cs, GrayscaleSphere.cs, and VolumeFromStack.cs.

Member Function Documentation

◆ ByteCount()

uint IOLink.DataType.ByteCount ( )
inline

Get the number of bits required to store the type.

If the number of bits required to store the type is not aligned to a byte, the number of byte will be rounded up. For example, a 12 bits integer type will have a byte count of 2.

Examples
CopyImageView.cs.

◆ ExtractScalarType()

static DataType IOLink.DataType.ExtractScalarType ( DataType  dtype)
inlinestatic

Return scalar type in case of multi dimensionnal DataType.

If the type is already scalar, it return itself.

◆ GetElementCount()

uint IOLink.DataType.GetElementCount ( )
inline

Return the number of sub-values included in this type.

For example:

  • UINT8 => dimension 1
  • VEC3_UINT8 => dimension 3 because it contains three UINT8

◆ GetPrimitiveType()

PrimitiveTypeId IOLink.DataType.GetPrimitiveType ( )
inline

Return the primitive type of the current type.

for example: UINT8 => UNSIGNED_INTEGER

◆ StandardRange()

static Vector2d IOLink.DataType.StandardRange ( DataType  dtype)
inlinestatic

Return conventional range for given DataType.

By convention, range for INTEGER types are classical min and max representable values.

Range for FLOATING_POINT type is [0, 1]

As returned range is DOUBLE precison, returned value is imprecise for INT64 and UINT64 type.

Exceptions
ErrorIf no range can be computed for this type.

The documentation for this class was generated from the following file: