Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::ImageSampleIdentifier Class Reference

#include <Sample.h>

Inheritance diagram for prapi::ImageSampleIdentifier:

Object List of all members.

Detailed Description

A class used to identify samples taken from images.

This identifier is useful when samples are created from an image or sub-images of a larger image. It stores the image name and sub-image coordinates.

To use this identifier, you must instantiate your samples as follows:

 Sample<int,ImageSampleIdentifier> smpl;
 

If you omit "ImageSampleIdentifier", a string identifier will be used by default. A sample stored with a properly formatted string identifier can be typecasted to a sample with an ImageSampleIdentifier.

See also:
setIdentifier(const string&)


Public Methods

 ImageSampleIdentifier (void)
 The default constructor.

 ImageSampleIdentifier (const std::string &str)
 Initialize a new identifier using an identifier string.

 ImageSampleIdentifier (const std::string &name, int x, int y, int width, int height)
 Create a new identifier with the given image name and sub-image coordinates.

 ImageSampleIdentifier (const ImageSampleIdentifier &other)
 Create a copy of another identifier.

ImageSampleIdentifier & operator= (const ImageSampleIdentifier &other)
 Copy the contents of another identifier.

void setIdentifier (const std::string &str)
 Set the contents of this identifier according to the given identifier string.

std::string getIdentifier (void)
 Get a formatted identifier string as described in setIdentifier.

ImageSampleIdentifier & operator= (const std::string &str)
 operator std::string ()
std::string getName (void) const
 Get the name of the image, the sample this object identifies, was taken from.

void setName (const std::string &name)
 Get the name of the image, the sample this object identifies, was taken from.

std::string & name (void)
 Set the name of the image, the sample this object identifies, was taken from.

int getX (void) const
 Get the X coordinate for this sample identifier.

int & x (void)
 Get the X coordinate for this sample identifier.

void setX (int newX)
 Set the X coordinate for this sample identifier.

int getY (void) const
 Get the Y coordinate for this sample identifier.

int & y (void)
 Get the Y coordinate for this sample identifier.

void setY (int newY)
 Set the Y coordinate for this sample identifier.

int getWidth (void) const
 Get the width of the image sample.

int & width (void)
 Get the width of the image sample.

void setWidth (int newWidth)
 Set the width of the image sample.

int getHeight (void) const
 Get the height of the image sample.

int & height (void)
 Get the height of the image sample.

void setHeight (int newHeight)
 Set the height of the image sample.


Friends

bool operator== (const ImageSampleIdentifier &obj1, const ImageSampleIdentifier &obj2)
 Compare two identifiers.

bool operator!= (const ImageSampleIdentifier &obj1, const ImageSampleIdentifier &obj2)
 Compare two identifiers.

std::ostream & operator<< (std::ostream &sout, const ImageSampleIdentifier &obj)
std::istream & operator>> (std::istream &sin, ImageSampleIdentifier &obj)
std::istream & oldRead (std::istream &sin, ImageSampleIdentifier &obj)


Constructor & Destructor Documentation

prapi::ImageSampleIdentifier::ImageSampleIdentifier void    [inline]
 

The default constructor.

Creates an identifier with no name and all coordinates set to zero.

prapi::ImageSampleIdentifier::ImageSampleIdentifier const std::string &    str [inline]
 

Initialize a new identifier using an identifier string.

See also:
setIdentifier(const string&)


Member Function Documentation

prapi::ImageSampleIdentifier::operator std::string   [inline]
 

See also:
getIdentifier(void)

ImageSampleIdentifier& prapi::ImageSampleIdentifier::operator= const std::string &    str [inline]
 

See also:
setIdenfitier(const string&)

void prapi::ImageSampleIdentifier::setIdentifier const std::string &    str
 

Set the contents of this identifier according to the given identifier string.

The format of the string must be as follows:

 imagename x y width height
 

The imagename field must not contain whitespace characters. Any number of whitespace characters can be used to separate the x, y, width and height fields.

Parameters:
str  the identifier string


Friends And Related Function Documentation

bool operator!= const ImageSampleIdentifier &    obj1,
const ImageSampleIdentifier &    obj2
[friend]
 

Compare two identifiers.

The result is false if and only if both identifiers have the same name and the same sub-image coordinates.

bool operator== const ImageSampleIdentifier &    obj1,
const ImageSampleIdentifier &    obj2
[friend]
 

Compare two identifiers.

The result is true if and only if both identifiers have the same name and the same sub-image coordinates.


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.