LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::draw2DDistribution< T > Class Template Reference

This class draws a 2-D distribution into an image or a channel. More...

#include <ltiDraw2DDistribution.h>

Inheritance diagram for lti::draw2DDistribution< T >:
Inheritance graph
[legend]
Collaboration diagram for lti::draw2DDistribution< T >:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class draw2DDistribution More...

Public Member Functions

 draw2DDistribution ()
 draw2DDistribution (const draw2DDistribution &other)
virtual ~draw2DDistribution ()
virtual const char * getTypeName () const
bool apply (drawBase< T > &drawer, const dmatrix &dist, const bool &hold=false, const char *style="ow0") const
bool apply (drawBase< T > &drawer, const dmatrix &dist, const int first, const int second, const bool hold=false, const char *style="ow") const
bool apply (drawBase< T > &drawer, const dvector &x, const dvector &y, const bool hold=false, const char *style="ow") const
bool apply (drawBase< T > &drawer, const dmatrix &dist, const ivector &ids, const bool &hold=false) const
bool apply (drawBase< T > &drawer, const dmatrix &dist1, const ivector &ids1, const dmatrix &dist2, const ivector &ids2, const bool &hold=false) const
draw2DDistribution< T > & copy (const draw2DDistribution< T > &other)
draw2DDistribution< T > & operator= (const draw2DDistribution< T > &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Attributes

dmatrixtestDist
ivectortestIds
dmatrixtrainDist
ivectortrainIds
std::map< int, char * > * styles
std::map< int, T > * colorMap

Detailed Description

template<class T>
class lti::draw2DDistribution< T >

This class draws a 2-D distribution into an image or a channel.

If you want to draw the distribution into an eps picture it is mandatory to specify a size for the eps picture. For example:

  epsdraw<cmykColor> drawer(std::out,point(800,800));

The apply methods draws each point from the given matrices into the given image. It is expected that each row of the matrix represents one point If there is also a vector with ids corresponding to each point in the matrices each id is drawn in an other color or style. First all colors are permuted. (In channels this is only white). After this, if there are more ids than colors available, the style of the points is permuted. If there is no id-vector you can assign a color an the style that will be used. According to the parameter hold the old points that are drawn before are saved. If an instance of this class is used later the old points that were saved will appear to in the image.


Constructor & Destructor Documentation

template<class T >
lti::draw2DDistribution< T >::draw2DDistribution (  ) 

default constructor

template<class T >
lti::draw2DDistribution< T >::draw2DDistribution ( const draw2DDistribution< T > &  other  ) 

copy constructor

Parameters:
other the object to be copied
template<class T >
virtual lti::draw2DDistribution< T >::~draw2DDistribution (  )  [virtual]

destructor


Member Function Documentation

template<class T >
bool lti::draw2DDistribution< T >::apply ( drawBase< T > &  drawer,
const dmatrix dist1,
const ivector ids1,
const dmatrix dist2,
const ivector ids2,
const bool &  hold = false 
) const

Draws the points in dist1 and dist2 into an image.

In ids1 and ids2 the ids according to the points in dist1 and dist2 are expected. For each new ID a new style is used. If points in dist1 and dist2 have equal ids, the pionts will be drawn with the same symbol and color, but the symbol will be filled.

Parameters:
drawer drawing object that is used.
dist1 dmatrix with the source data.
ids1 the ID's accoding to the points in dist
dist2 dmatrix with the source data.
ids2 the ID's accoding to the points in dist
hold if true the old image is not deleted
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::draw2DDistribution< T >::apply ( drawBase< T > &  drawer,
const dmatrix dist,
const ivector ids,
const bool &  hold = false 
) const

Draws the points in dist into an image.

For each new ID a new style is used.

Parameters:
drawer that drawing object that is used
dist dmatrix with the source data.
ids the ID's accoding to the points in dist
hold if true the old image is not deleted
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::draw2DDistribution< T >::apply ( drawBase< T > &  drawer,
const dvector x,
const dvector y,
const bool  hold = false,
const char *  style = "ow" 
) const

Draws the point in the two vectors, taking the first as abscissa and the second as ordinate.

template<class T >
bool lti::draw2DDistribution< T >::apply ( drawBase< T > &  drawer,
const dmatrix dist,
const int  first,
const int  second,
const bool  hold = false,
const char *  style = "ow" 
) const

Draws two dimensions of dist.

See also:
apply(drawer,dist,hold,style)
Parameters:
drawer the drawer object used. Usually it is an object of a class inherited from drawBase<T>, like draw<T>.
dist dmatrix with the source data.
first first dimension taken
second second dimension
hold if true the old image is not deleted
style the style with which the points are drawn
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::draw2DDistribution< T >::apply ( drawBase< T > &  drawer,
const dmatrix dist,
const bool &  hold = false,
const char *  style = "ow0" 
) const

Draws the points in dist with the given style into an image.

Parameters:
drawer the drawering object that is used.
dist dmatrix with the source data.
hold if true the old image is not deleted
style the style with which the points are drawn
Returns:
true if apply successful or false otherwise.
template<class T >
virtual functor* lti::draw2DDistribution< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

template<class T >
draw2DDistribution<T>& lti::draw2DDistribution< T >::copy ( const draw2DDistribution< T > &  other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

template<class T >
const parameters& lti::draw2DDistribution< T >::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

template<class T >
virtual const char* lti::draw2DDistribution< T >::getTypeName (  )  const [virtual]

returns the name of this type ("draw2DDistribution")

Reimplemented from lti::functor.

template<class T >
draw2DDistribution<T>& lti::draw2DDistribution< T >::operator= ( const draw2DDistribution< T > &  other  ) 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.


Member Data Documentation

template<class T >
std::map<int,T >* lti::draw2DDistribution< T >::colorMap [protected]

map with the color according to the ids

template<class T >
std::map<int,char* >* lti::draw2DDistribution< T >::styles [protected]

map with the styles according to the ids

template<class T >
dmatrix* lti::draw2DDistribution< T >::testDist [protected]

the distribution with the test points

template<class T >
ivector* lti::draw2DDistribution< T >::testIds [protected]

the ids of the points in testDist

template<class T >
dmatrix* lti::draw2DDistribution< T >::trainDist [protected]

the distribution with the test points

template<class T >
ivector* lti::draw2DDistribution< T >::trainIds [protected]

the ids of the points in testDist


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

Generated on Sat Apr 10 15:27:13 2010 for LTI-Lib by Doxygen 1.6.1