latest version v1.9 - last update 10 Apr 2010 |
This class draws a 2-D distribution into an image or a channel. More...
#include <ltiDraw2DDistribution.h>
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 functor * | clone () const |
const parameters & | getParameters () const |
Protected Attributes | |
dmatrix * | testDist |
ivector * | testIds |
dmatrix * | trainDist |
ivector * | trainIds |
std::map< int, char * > * | styles |
std::map< int, T > * | colorMap |
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.
lti::draw2DDistribution< T >::draw2DDistribution | ( | ) |
default constructor
lti::draw2DDistribution< T >::draw2DDistribution | ( | const draw2DDistribution< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::draw2DDistribution< T >::~draw2DDistribution | ( | ) | [virtual] |
destructor
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.
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 |
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.
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 |
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.
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.
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 |
bool lti::draw2DDistribution< T >::apply | ( | drawBase< T > & | drawer, | |
const dmatrix & | dist, | |||
const bool & | hold = false , |
|||
const char * | style = "ow0" | |||
) | const |
virtual functor* lti::draw2DDistribution< T >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
draw2DDistribution<T>& lti::draw2DDistribution< T >::copy | ( | const draw2DDistribution< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
const parameters& lti::draw2DDistribution< T >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::functor.
virtual const char* lti::draw2DDistribution< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("draw2DDistribution")
Reimplemented from lti::functor.
draw2DDistribution<T>& lti::draw2DDistribution< T >::operator= | ( | const draw2DDistribution< T > & | other | ) |
std::map<int,T >* lti::draw2DDistribution< T >::colorMap [protected] |
map with the color according to the ids
std::map<int,char* >* lti::draw2DDistribution< T >::styles [protected] |
map with the styles according to the ids
dmatrix* lti::draw2DDistribution< T >::testDist [protected] |
the distribution with the test points
ivector* lti::draw2DDistribution< T >::testIds [protected] |
the ids of the points in testDist
dmatrix* lti::draw2DDistribution< T >::trainDist [protected] |
the distribution with the test points
ivector* lti::draw2DDistribution< T >::trainIds [protected] |
the ids of the points in testDist