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

Class encapsulating mapping of labels for image blobs. More...

#include <mdsBlobLabeling.h>

Inheritance diagram for mds::img::CBlobLabeling< T >:
Inheritance graph
[legend]

List of all members.

Classes

struct  SInitLabel
 Function object used to initialize the mapping. More...
struct  SLabelInfo
 Information about a blob label. More...

Public Types

enum  { DEFAULT_SIZE = 4096 }
 Default size hint. More...
enum  { CLASS_OBJECT }
 Templates that require members of the CObject class can use this enum to check the existence. More...
enum  { HEAP_OBJECT = 0x70616568 }
 Signature used to recognize objects on the heap. More...
typedef T tData
 User specific data.

Public Member Functions

 CBlobLabeling (int SizeHint=DEFAULT_SIZE)
 Default constructor.
void clear (int SizeHint=DEFAULT_SIZE)
 Clears the mapping.
tDatagetData (int i)
 Returns reference to user specific data.
int getLabel (int i)
 Returns the label for a specified blob.
int getReferencesCount () const
 Returns the number of references.
int getSize () const
 Returns the current number of blobs.
bool isOnHeap () const
 Returns true if the object is allocated on the heap.
 MDS_SHAREDPTR (CBlobLabeling)
 Smart pointer type.
void merge (int i, int j)
 Modifies the mapping so that the two given blobs share the same label.
int newLabel ()
 Returns a new label.
int newLabel (const tData &Data)
 Returns a new label.
void relabel (int StartingValue=0)
 Re-orders labels so that there will be no gaps in the numbering.
 ~CBlobLabeling ()
 Destructor.

Static Public Member Functions

static void * operator new (std::size_t Size)
 Allocates a new object on the heap.

Protected Types

typedef std::vector< SLabelInfotLabels
 Mapping of labels.

Protected Member Functions

void addReference () const
 Increase the reference counter.
bool delReference () const
 Decrease the reference counter.
int getRoot (int i)
 Finds root for a given blob.
bool isEquivalent (int i, int j)
 Returns true if two given blobs have been merged.
bool isRoot (int i) const
 Returns true if a subscripted blob is a root (its label is equal to the given blob number.

Protected Attributes

int m_HighestLabel
 First available label.
int m_iHeapObject
 Flag initialized if the object is on the heap.
int m_iReferences
 The number of references to the object.
tLabels m_Labels

Detailed Description

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

Class encapsulating mapping of labels for image blobs.

It allows you to modify the mapping, merge two blobs, etc. Such mapping is useful for algorithms like region growing or connected component labeling.


Member Typedef Documentation

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

User specific data.

template<typename T >
typedef std::vector<SLabelInfo> mds::img::CBlobLabeling< T >::tLabels [protected]

Mapping of labels.


Member Enumeration Documentation

template<typename T >
anonymous enum

Default size hint.

Enumerator:
DEFAULT_SIZE 
anonymous enum [inherited]

Templates that require members of the CObject class can use this enum to check the existence.

Enumerator:
CLASS_OBJECT 
anonymous enum [inherited]

Signature used to recognize objects on the heap.

Enumerator:
HEAP_OBJECT 

Constructor & Destructor Documentation

template<typename T >
mds::img::CBlobLabeling< T >::CBlobLabeling ( int  SizeHint = DEFAULT_SIZE)

Default constructor.

template<typename T >
mds::img::CBlobLabeling< T >::~CBlobLabeling ( )

Destructor.


Member Function Documentation

void mds::base::CObject::addReference ( ) const [protected, inherited]

Increase the reference counter.

template<typename T >
void mds::img::CBlobLabeling< T >::clear ( int  SizeHint = DEFAULT_SIZE)

Clears the mapping.

bool mds::base::CObject::delReference ( ) const [protected, inherited]

Decrease the reference counter.

  • Returns true if the decremented number of references is lower or equal to zero and object must be deleted.
template<typename T >
tData& mds::img::CBlobLabeling< T >::getData ( int  i)

Returns reference to user specific data.

template<typename T >
int mds::img::CBlobLabeling< T >::getLabel ( int  i)

Returns the label for a specified blob.

Returns the number of references.

template<typename T >
int mds::img::CBlobLabeling< T >::getRoot ( int  i) [protected]

Finds root for a given blob.

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

Returns the current number of blobs.

template<typename T >
bool mds::img::CBlobLabeling< T >::isEquivalent ( int  i,
int  j 
) [protected]

Returns true if two given blobs have been merged.

bool mds::base::CObject::isOnHeap ( ) const [inherited]

Returns true if the object is allocated on the heap.

template<typename T >
bool mds::img::CBlobLabeling< T >::isRoot ( int  i) const [protected]

Returns true if a subscripted blob is a root (its label is equal to the given blob number.

template<typename T >
mds::img::CBlobLabeling< T >::MDS_SHAREDPTR ( CBlobLabeling< T >  )

Smart pointer type.

  • Declares type tSmartPtr.
template<typename T >
void mds::img::CBlobLabeling< T >::merge ( int  i,
int  j 
)

Modifies the mapping so that the two given blobs share the same label.

  • The i-th blob becomes equal to the j-th one.
template<typename T >
int mds::img::CBlobLabeling< T >::newLabel ( )

Returns a new label.

template<typename T >
int mds::img::CBlobLabeling< T >::newLabel ( const tData Data)

Returns a new label.

static void* mds::base::CObject::operator new ( std::size_t  Size) [static, inherited]

Allocates a new object on the heap.

template<typename T >
void mds::img::CBlobLabeling< T >::relabel ( int  StartingValue = 0)

Re-orders labels so that there will be no gaps in the numbering.


Member Data Documentation

template<typename T >
int mds::img::CBlobLabeling< T >::m_HighestLabel [protected]

First available label.

int mds::base::CObject::m_iHeapObject [mutable, protected, inherited]

Flag initialized if the object is on the heap.

int mds::base::CObject::m_iReferences [mutable, protected, inherited]

The number of references to the object.

  • Zero if there is no reference.
template<typename T >
tLabels mds::img::CBlobLabeling< T >::m_Labels [protected]

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