Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
Public Types | Public Member Functions
iu::LinearHostMemory< PixelType, Ndim > Class Template Reference

Linear host memory class. More...

#include <linearhostmemory.h>

Inheritance diagram for iu::LinearHostMemory< PixelType, Ndim >:
iu::LinearMemory< Ndim >

Public Types

typedef PixelType pixel_type
 

Public Member Functions

 LinearHostMemory ()
 
virtual ~LinearHostMemory ()
 
 LinearHostMemory (const Size< Ndim > &size)
 
 LinearHostMemory (const unsigned int &numel)
 
 LinearHostMemory (PixelType *host_data, const Size< Ndim > &size, bool ext_data_pointer=false)
 
 LinearHostMemory (PixelType *host_data, const unsigned int &numel, bool ext_data_pointer=false)
 
PixelType * data (unsigned int offset=0)
 
const PixelType * data (unsigned int offset=0) const
 
virtual size_t bytes () const
 
virtual unsigned int bitDepth () const
 
thrust::pointer< PixelType,
thrust::host_system_tag > 
begin (void)
 
thrust::pointer< PixelType,
thrust::host_system_tag > 
end (void)
 
virtual bool onDevice () const
 
PixelType & getPixel (const unsigned int &idx)
 
template<typename ResultType = PixelType>
std::enable_if<(Ndim >
1), ResultType & >::type 
getPixel (const unsigned int &idx0, const unsigned int &idx1)
 
template<typename ResultType = PixelType>
std::enable_if<(Ndim >
2), ResultType & >::type 
getPixel (const unsigned int &idx0, const unsigned int &idx1, const unsigned int &idx2)
 
template<typename ResultType = PixelType>
std::enable_if<(Ndim >
3), ResultType & >::type 
getPixel (const unsigned int &idx0, const unsigned int &idx1, const unsigned int &idx2, const unsigned int &idx3)
 
template<typename ResultType = PixelType>
std::enable_if<(Ndim >
4), ResultType & >::type 
getPixel (const unsigned int &idx0, const unsigned int &idx1, const unsigned int &idx2, const unsigned int &idx3, const unsigned int &idx4)
 
ndarray_ref< PixelType, Ndim > ref () const
 
 LinearHostMemory (const ndarray_ref< PixelType, Ndim > &x)
 
 LinearHostMemory (boost::python::api::object &py_arr)
 
 LinearHostMemory (const mxArray_tag &mex_arr)
 
template<>
 LinearHostMemory (const ndarray_ref< float, 1 > &x)
 
- Public Member Functions inherited from iu::LinearMemory< Ndim >
 LinearMemory ()
 
 LinearMemory (const Size< Ndim > &size)
 
 LinearMemory (const unsigned int &numel)
 
bool sameType (const LinearMemory &from)
 
virtual ~LinearMemory ()
 
unsigned int numel () const
 
Size< Ndim > size () const
 
Size< Ndim > stride () const
 

Additional Inherited Members

- Protected Member Functions inherited from iu::LinearMemory< Ndim >
void computeStride ()
 
- Protected Attributes inherited from iu::LinearMemory< Ndim >
Size< Ndim > size_
 

Detailed Description

template<typename PixelType, unsigned int Ndim>
class iu::LinearHostMemory< PixelType, Ndim >

Linear host memory class.

Member Typedef Documentation

template<typename PixelType, unsigned int Ndim>
typedef PixelType iu::LinearHostMemory< PixelType, Ndim >::pixel_type

Define the current pixel type.

Constructor & Destructor Documentation

template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( )
inline

Constructor.

template<typename PixelType, unsigned int Ndim>
virtual iu::LinearHostMemory< PixelType, Ndim >::~LinearHostMemory ( )
inlinevirtual

Destructor.

template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( const Size< Ndim > &  size)
inline

Special constructor.

Parameters
sizesize of linear memory
template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( const unsigned int &  numel)
inline

Special constructor.

Parameters
numelnumber of elements of linear memory. Size[0] equals the number of elements, the other dimensions are set to 1.
template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( PixelType *  host_data,
const Size< Ndim > &  size,
bool  ext_data_pointer = false 
)
inline

Special constructor.

Parameters
host_dataHost data pointer
sizesize of the linear memory
ext_data_pointerUse external data pointer as internal data pointer
template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( PixelType *  host_data,
const unsigned int &  numel,
bool  ext_data_pointer = false 
)
inline

Special constructor.

Parameters
host_dataHost data pointer
numelNumber of elements of the linear memory
ext_data_pointerUse external data pointer as internal data pointer
template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( const ndarray_ref< PixelType, Ndim > &  x)

construct from ndarray_ref – include ndarray/ndarray_iu.h

template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( boost::python::api::object &  py_arr)

LinearHostMemory constructor from numpy array. It wraps the numpy data pointer i.e. does not perform a deep copy. This means that changes to the ImageCpu are transparent to python. Attention: It performs just a basic check if the datatyps are compatible: If you have a numpy array with uint8 and you try to construct a LinearHostMemory_32f_C1 from it, it will throw an exception. Constructing a LinearHostMemory_32u_C1 from a numpy float32 array will not give an error (both are 32-bit datatypes)!

include iuypthon.h!

Parameters
py_arra boost::python::object representing a numpy array
template<typename PixelType, unsigned int Ndim>
iu::LinearHostMemory< PixelType, Ndim >::LinearHostMemory ( const mxArray_tag &  mex_arr)

LinearHostMemory constructor from mex arrays (matlab). The memory layout is changed from column-first to row-first order.

template<>
iu::LinearHostMemory< float, 1 >::LinearHostMemory ( const ndarray_ref< float, 1 > &  x)

Template specialization. Construct from ndarray_ref.

Member Function Documentation

template<typename PixelType, unsigned int Ndim>
thrust::pointer<PixelType, thrust::host_system_tag> iu::LinearHostMemory< PixelType, Ndim >::begin ( void  )
inline

Returns a thrust pointer that can be used in custom operators

Returns
Thrust pointer of the begin of the host memory
template<typename PixelType, unsigned int Ndim>
virtual unsigned int iu::LinearHostMemory< PixelType, Ndim >::bitDepth ( ) const
inlinevirtual

Returns the bit depth of the data pointer.

Reimplemented from iu::LinearMemory< Ndim >.

template<typename PixelType, unsigned int Ndim>
virtual size_t iu::LinearHostMemory< PixelType, Ndim >::bytes ( ) const
inlinevirtual

Returns the total amount of bytes saved in the data buffer.

Reimplemented from iu::LinearMemory< Ndim >.

template<typename PixelType, unsigned int Ndim>
PixelType* iu::LinearHostMemory< PixelType, Ndim >::data ( unsigned int  offset = 0)
inline

Returns a pointer to the device buffer. The pointer can be offset to position offset.

Parameters
offsetOffset of the pointer array.
Returns
Pointer to the device buffer.
template<typename PixelType, unsigned int Ndim>
const PixelType* iu::LinearHostMemory< PixelType, Ndim >::data ( unsigned int  offset = 0) const
inline

Returns a const pointer to the device buffer. The pointer can be offset to position offset.

Parameters
offsetOffset of the pointer array.
Returns
Const pointer to the device buffer.
template<typename PixelType, unsigned int Ndim>
thrust::pointer<PixelType, thrust::host_system_tag> iu::LinearHostMemory< PixelType, Ndim >::end ( void  )
inline

Returns a thrust pointer that can be used in custom operators

Returns
Thrust pointer of the end of the host memory
template<typename PixelType, unsigned int Ndim>
PixelType& iu::LinearHostMemory< PixelType, Ndim >::getPixel ( const unsigned int &  idx)
inline

Get pixel value at a certain position.

Parameters
idxIndex
Returns
Pixel value
template<typename PixelType, unsigned int Ndim>
template<typename ResultType = PixelType>
std::enable_if<(Ndim > 1), ResultType&>::type iu::LinearHostMemory< PixelType, Ndim >::getPixel ( const unsigned int &  idx0,
const unsigned int &  idx1 
)
inline

Get pixel value at a certain position.

Parameters
idx0Position at dimension 0
idx1Position at dimension 1
Returns
Pixel value
template<typename PixelType, unsigned int Ndim>
template<typename ResultType = PixelType>
std::enable_if<(Ndim > 2), ResultType&>::type iu::LinearHostMemory< PixelType, Ndim >::getPixel ( const unsigned int &  idx0,
const unsigned int &  idx1,
const unsigned int &  idx2 
)
inline

Get pixel value at a certain position.

Parameters
idx0Position at dimension 0
idx1Position at dimension 1
idx2Position at dimension 2
Returns
Pixel value
template<typename PixelType, unsigned int Ndim>
template<typename ResultType = PixelType>
std::enable_if<(Ndim > 3), ResultType&>::type iu::LinearHostMemory< PixelType, Ndim >::getPixel ( const unsigned int &  idx0,
const unsigned int &  idx1,
const unsigned int &  idx2,
const unsigned int &  idx3 
)
inline

Get pixel value at a certain position.

Parameters
idx0Position at dimension 0
idx1Position at dimension 1
idx2Position at dimension 2
idx3Position at dimension 3
Returns
Pixel value
template<typename PixelType, unsigned int Ndim>
template<typename ResultType = PixelType>
std::enable_if<(Ndim > 4), ResultType&>::type iu::LinearHostMemory< PixelType, Ndim >::getPixel ( const unsigned int &  idx0,
const unsigned int &  idx1,
const unsigned int &  idx2,
const unsigned int &  idx3,
const unsigned int &  idx4 
)
inline

Get pixel value at a certain position.

Parameters
idx0Position at dimension 0
idx1Position at dimension 1
idx2Position at dimension 2
idx3Position at dimension 3
idx4Position at dimension 4
Returns
Pixel value
template<typename PixelType, unsigned int Ndim>
virtual bool iu::LinearHostMemory< PixelType, Ndim >::onDevice ( ) const
inlinevirtual

Returns flag if the image data resides on the device/GPU (TRUE) or host/GPU (FALSE)

Reimplemented from iu::LinearMemory< Ndim >.

template<typename PixelType, unsigned int Ndim>
ndarray_ref<PixelType, Ndim> iu::LinearHostMemory< PixelType, Ndim >::ref ( ) const

convert to ndarray_ref – include ndarray/ndarray_iu.h


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