MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
mds::img::CvImageRef< T > Class Template Reference

Class template providing mechanism of reference counting to IplImage data (see the OpenCV library documentation). More...

#include <mdsCvImageRef.h>

List of all members.

Classes

struct  SRefInfo
 Structure containing number of references to the image. More...

Public Types

typedef T tData
 Image pixel type.

Public Member Functions

const IplImage * asIpl () const
 Returns pointer to the IplImage.
IplImage * asIpl ()
CvImageRefcreate (tSize Width, tSize Height)
 Allocates image data of a given size.
CvImageRefcreate (const CvImageRef &Data, tSize Col, tSize Row, tSize Width, tSize Height)
 Creates a subimage of a given image.
CvImageRefcreate (const CvImageRef &Data, tSize Col, tSize Row, tSize Width, tSize Height, EMakeRef)
 Creates a subimage of a given image.
CvImageRefcreate (const CvImageRef &Data)
 Allocates imade data and copies the specified one.
CvImageRefcreate (IplImage *pImage)
 Creates image from the IplImage directly image.
CvImageRefcreate (const CvImageRef &Data, EMakeRef)
 Makes a new reference to existing image data.
 CvImageRef ()
 Default constructor allocates data of zero size.
 CvImageRef (EEmptyConst)
 This constructor does no allocation of the data.
CvImageRefdetach ()
 Decreases the number of references and deallocates the image data if neccessary.
int getChannels () const
 Returns the number of channels.
int getColOffset () const
 Returns offset between two neighbouring elements in a row.
int getDepth () const
 Returns the image depth (see predefined OpenCV constants).
int getHeight () const
 Returns IplImage height.
int getNumOfReferences () const
 Returns the number of references to the data.
int getPixelSize () const
 Returns pixel size in bytes.
T * getPtr ()
 Returns pointer to the underlying image data.
const T * getPtr () const
CvRect getROI () const
 Returns the current ROI within the image (see OpenCV linbrary for details).
int getROIHeight () const
 Returns the ROI height.
T * getROIPtr ()
 Returns pointer to the ROI image data.
const T * getROIPtr () const
int getROIWidth () const
 Returns the ROI width.
int getRowOffset () const
 Returns offset between two neighbouring elements in a column.
int getSize () const
 Returns size of the underlying image data in pixels.
int getWidth () const
 Returns IplImage image width.
CvImageRefmakeROI (int Col, int Row, int Width, int Height)
 Creates ROI within the current image (see OpenCV linbrary for details).
CvImageRefresetROI ()
 Clears ROI within the image (the whole image is selected).
 ~CvImageRef ()
 Destructor.

Protected Member Functions

 CvImageRef (const CvImageRef &)
 Protected copy constructor.
CvImageRefoperator= (const CvImageRef &)
 Protected assignment operator.

Protected Attributes

IplImage * m_pImage
 Pointer to the Ipl image.
SRefInfom_pRef
 Pointer to the structure containing the number of references.

Detailed Description

template<typename T>
class mds::img::CvImageRef< T >

Class template providing mechanism of reference counting to IplImage data (see the OpenCV library documentation).


Member Typedef Documentation

template<typename T >
typedef T mds::img::CvImageRef< T >::tData

Image pixel type.


Constructor & Destructor Documentation

template<typename T >
CvImageRef::CvImageRef ( )

Default constructor allocates data of zero size.

  • Throws mds::img::cv::CBadImageAlloc() exception on failure.
template<typename T >
CvImageRef::CvImageRef ( EEmptyConst  )

This constructor does no allocation of the data.

  • Be sure that the method create() is used somewhere!
  • Use with care!
template<typename T >
CvImageRef::~CvImageRef ( )

Destructor.

template<typename T >
mds::img::CvImageRef< T >::CvImageRef ( const CvImageRef< T > &  ) [protected]

Protected copy constructor.


Member Function Documentation

template<typename T >
const IplImage* mds::img::CvImageRef< T >::asIpl ( ) const

Returns pointer to the IplImage.

template<typename T >
IplImage* mds::img::CvImageRef< T >::asIpl ( )
template<typename T >
CvImageRef< T > & CvImageRef::create ( tSize  Width,
tSize  Height 
)

Allocates image data of a given size.

  • In case of several references to the existing data, the reference counter is decremented and new data are allocated.
  • Returns reference to this.
  • Throws mds::img::cv::CBadImageAlloc() exception on failure.
template<typename T >
CvImageRef< T > & CvImageRef::create ( const CvImageRef< T > &  Data,
tSize  Col,
tSize  Row,
tSize  Width,
tSize  Height 
)

Creates a subimage of a given image.

  • Makes own copy of the data.
  • Throws mds::img::cv::CBadImageAlloc() exception on failure.
template<typename T >
CvImageRef< T > & CvImageRef::create ( const CvImageRef< T > &  Data,
tSize  Col,
tSize  Row,
tSize  Width,
tSize  Height,
EMakeRef   
)

Creates a subimage of a given image.

  • Makes reference to the data.
  • Throws mds::img::cv::CBadImageAlloc() exception on failure.
template<typename T >
CvImageRef& mds::img::CvImageRef< T >::create ( const CvImageRef< T > &  Data)

Allocates imade data and copies the specified one.

  • Returns reference to this.
  • Throws mds::img::cv::CBadImageAlloc() exception on failure.
template<typename T >
CvImageRef< T > & CvImageRef::create ( IplImage *  pImage)

Creates image from the IplImage directly image.

  • Takes full control over the image including deallocation of the memory!
  • Returns reference to this.
template<typename T >
CvImageRef& mds::img::CvImageRef< T >::create ( const CvImageRef< T > &  Data,
EMakeRef   
)

Makes a new reference to existing image data.

  • Returns reference to this.
  • Throws mds::img::cv::CBadImageAlloc() exception on failure.
template<typename T >
CvImageRef< T > & CvImageRef::detach ( )

Decreases the number of references and deallocates the image data if neccessary.

  • Use with care!
template<typename T >
int mds::img::CvImageRef< T >::getChannels ( ) const

Returns the number of channels.

template<typename T >
int mds::img::CvImageRef< T >::getColOffset ( ) const

Returns offset between two neighbouring elements in a row.

template<typename T >
int mds::img::CvImageRef< T >::getDepth ( ) const

Returns the image depth (see predefined OpenCV constants).

template<typename T >
int mds::img::CvImageRef< T >::getHeight ( ) const

Returns IplImage height.

template<typename T >
int mds::img::CvImageRef< T >::getNumOfReferences ( ) const

Returns the number of references to the data.

template<typename T >
int mds::img::CvImageRef< T >::getPixelSize ( ) const

Returns pixel size in bytes.

template<typename T >
T* mds::img::CvImageRef< T >::getPtr ( )

Returns pointer to the underlying image data.

template<typename T >
const T* mds::img::CvImageRef< T >::getPtr ( ) const
template<typename T >
CvRect mds::img::CvImageRef< T >::getROI ( ) const

Returns the current ROI within the image (see OpenCV linbrary for details).

template<typename T >
int mds::img::CvImageRef< T >::getROIHeight ( ) const

Returns the ROI height.

template<typename T >
T* mds::img::CvImageRef< T >::getROIPtr ( )

Returns pointer to the ROI image data.

template<typename T >
const T* mds::img::CvImageRef< T >::getROIPtr ( ) const
template<typename T >
int mds::img::CvImageRef< T >::getROIWidth ( ) const

Returns the ROI width.

template<typename T >
int mds::img::CvImageRef< T >::getRowOffset ( ) const

Returns offset between two neighbouring elements in a column.

template<typename T >
int mds::img::CvImageRef< T >::getSize ( ) const

Returns size of the underlying image data in pixels.

template<typename T >
int mds::img::CvImageRef< T >::getWidth ( ) const

Returns IplImage image width.

template<typename T >
CvImageRef< T > & CvImageRef::makeROI ( int  Col,
int  Row,
int  Width,
int  Height 
)

Creates ROI within the current image (see OpenCV linbrary for details).

  • If any ROI already exists, its coordinates are taken into acocunt as well.
template<typename T >
CvImageRef& mds::img::CvImageRef< T >::operator= ( const CvImageRef< T > &  ) [protected]

Protected assignment operator.

template<typename T >
CvImageRef< T > & CvImageRef::resetROI ( )

Clears ROI within the image (the whole image is selected).


Member Data Documentation

template<typename T >
IplImage* mds::img::CvImageRef< T >::m_pImage [protected]

Pointer to the Ipl image.

template<typename T >
SRefInfo* mds::img::CvImageRef< T >::m_pRef [protected]

Pointer to the structure containing the number of references.


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