DataPtrType
). The DataPtrType
is defined in the signature of an image (see Image signatures).
Typically, the data pointer type is (a specialization of) a template class with (trivial) inline member functions. The inline functions are eliminated through compiler optimization so there is no loss of efficiency in pixel manipulation. To keep the functions trivial and efficient issues such as border checking should not be done within member functions of the data pointer class.
The requirements for the DataPtrType
expressed as a class definition are:
DataPtrType(const DataPtrType& rhs); DataPtrType& operator=(const DataPtrType& rhs); void incX(); void decX(); void incY(); void decY(); void incZ(); void decZ(); void incX(int off); void decX(int off); void incY(int off); void decY(int off); void incXYZ(int xOff, int yOff, int zOff = 0); void decXYZ(int xOff, int yOff, int zOff = 0); ArithT read(); void write(const ArithT& val); ArithT readIncX(); void writeIncX(const ArithT& val); PixelT* data();
Horus provides three template classes fullfilling the requirements: HxDataPtr2dScalarTem, HxDataPtr2dTem, and HxDataPtr3dScalarTem. The first two are optimized for 2D images, the last is for 3D images. There are two versions for 2D images (one for scalar pixel values and one for vector values) because of a small technical problem : the scalar values images use native types (short, int, float, and double) and one cannot define a constructor for these types.
Storage and retrieval of individual pixel values is done through the read
and write
member functions of the data pointer class. Outside the data pointer class pixel values are represented in one of the arithmetic data types (see Arithmetic data types).