Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxBlob2d Class Reference

Class definition for a blob in a 2D image. More...

#include <HxBlob2d.h>

List of all members.

Public Methods

 HxBlob2d ()
 Constructor. More...

 HxBlob2d (int label, int xmin, int ymin, int width, int height)
 Constructor. More...

 ~HxBlob2d ()
 Destructor. More...

int ident () const
 Get the identifier of this blob. More...

int getLabel () const
 Get the label of this blob (unique only within the labeled image. More...

HxPoint startMaer () const
 Get the upper left corner of the MAER. More...

HxSizes sizeMaer () const
 Get the sizes of the MAER. More...

template<class T> void addFeature (HxString name, const T &val)
 Add combination name,val to the list of features. More...

template<class T> void addFeature (HxNameTable::sizeType id, const T &val)
 Add combination id,val to the list of features. More...

template<class T> bool getFeature (HxString name, T &val) const
 Get feature idetified by name from the list. More...

template<class T> bool getFeature (HxNameTable::sizeType id, T &val) const
 Get feature idetified by name from the list. More...

int getFeatureInt (HxString name) const
 Wrapper around getFeature for int's. More...

HxValue getFeatureValue (HxString name) const
 Wrapper around getFeature for HxValue's. More...

STD_OSTREAM & put (STD_OSTREAM &os) const
 Put blob on stream. More...


Static Public Methods

std::vector< HxStringgetFeatureNames ()
 Get all feature names. More...


Detailed Description

Class definition for a blob in a 2D image.

Basically, a blob is a label in an identification image. In other words, a blob is a set of pixels that are "connected".


Constructor & Destructor Documentation

HxBlob2d::HxBlob2d  
 

Constructor.

00024 {
00025     _ident = _nr++;
00026 }

HxBlob2d::HxBlob2d int    label,
int    xmin,
int    ymin,
int    width,
int    height
 

Constructor.

00041 {
00042     _ident = _nr++;
00043     _label = label;
00044     _xmin = xmin;
00045     _ymin = ymin;
00046     _width = width;
00047     _height = height;
00048 }

HxBlob2d::~HxBlob2d  
 

Destructor.

00051 {
00052 }


Member Function Documentation

int HxBlob2d::ident   const
 

Get the identifier of this blob.

00056 {
00057     return _ident;
00058 }

int HxBlob2d::getLabel   const
 

Get the label of this blob (unique only within the labeled image.

00076 {
00077     return _label;
00078 }

HxPoint HxBlob2d::startMaer   const
 

Get the upper left corner of the MAER.

00082 {
00083     return HxPoint(_xmin, _ymin, 0);
00084 }

HxSizes HxBlob2d::sizeMaer   const
 

Get the sizes of the MAER.

00088 {
00089     return HxSizes(_width, _height, 1);
00090 }

template<class T>
void HxBlob2d::addFeature HxString    name,
const T &    val
[inline]
 

Add combination name,val to the list of features.

00077     {
00078         HxNameTable::sizeType id = _featNameTable.getId(name);
00079         addFeature(id, val);
00080     }

template<class T>
void HxBlob2d::addFeature HxNameTable::sizeType    id,
const T &    val
[inline]
 

Add combination id,val to the list of features.

00085     {
00086         HxBlob2dFeature* feat = new HxBlob2dFeatureTem<T>(val);
00087         _features[id] = feat;
00088     }

template<class T>
bool HxBlob2d::getFeature HxString    name,
T &    val
const [inline]
 

Get feature idetified by name from the list.

00093     {
00094         HxNameTable::sizeType id = _featNameTable.getId(name);
00095         return getFeature(id, val);
00096     }

template<class T>
bool HxBlob2d::getFeature HxNameTable::sizeType    id,
T &    val
const [inline]
 

Get feature idetified by name from the list.

00101     {
00102         FeatureMap::const_iterator it = _features.find(id);
00103         if (it == _features.end())
00104             return false;
00105         HxBlob2dFeature* base = (*it).second;
00106         HxBlob2dFeatureTem<T>* featPtr = 
00107             dynamic_cast<HxBlob2dFeatureTem<T>* > (base);
00108         if (featPtr == 0)
00109             return false; // was other type
00110         val = featPtr->getValue();
00111         return true;
00112     }

int HxBlob2d::getFeatureInt HxString    name const
 

Wrapper around getFeature for int's.

00144 {
00145     int val;
00146     getFeature(name, val);
00147     return val;
00148 }

HxValue HxBlob2d::getFeatureValue HxString    name const
 

Wrapper around getFeature for HxValue's.

00152 {
00153     HxValue val;
00154     getFeature(name, val);
00155     return val;
00156 }

STD_OSTREAM & HxBlob2d::put STD_OSTREAM &    os const
 

Put blob on stream.

00160 {
00161     os << "Blob " << ident() << ", start: " << startMaer() << ", size: " 
00162        << sizeMaer() << STD_ENDL;
00163     return os;
00164 }

std::vector< HxString > HxBlob2d::getFeatureNames   [static]
 

Get all feature names.

00168 {
00169     return _featNameTable.getNames();
00170 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 14:18:52 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001