SMIL  1.0.4
ImageBox Class Reference

ImageBox. More...

Detailed Description

ImageBox.

This class handles the bounding box of an image. It allows to store a reference point inside it and allows to handle some operations and conversion on pixels coordinates.

Shall be initialized with the dimensions of the image, in order to be able to convert back and forth from Points to Offsets.

#include <DCommon.h>

+ Collaboration diagram for ImageBox:

Public Member Functions

 ImageBox (size_t Size[3])
 ImageBox - constructor. More...
 
 ImageBox (const ImageBox &box)
 ImageBox - constructor. More...
 
 ImageBox (size_t width, size_t height, size_t depth=1)
 ImageBox - constructor. More...
 
void setReference (off_t x, off_t y, off_t z=0)
 setReference() - set reference point More...
 
void setReference (IntPoint pt)
 setReference() - set reference point More...
 
void setReference (off_t offset)
 setReference() - set reference point More...
 
IntPoint getPoint ()
 getPoint() - get coordinates as a point More...
 
off_t getOffset ()
 getOffset() - get coordinates as an reference More...
 
void shift (off_t dx, off_t dy, off_t dz=0)
 shift() - move the point by some displacements More...
 
void shift (IntPoint dp)
 shift() - move the point by some displacements given by a point More...
 
bool inImage ()
 inImage() - check if the reference point is inside image bounds More...
 
bool inImage (size_t x, size_t y, size_t z=0)
 inImage() - given the coordinates of a pixel, check if it's inside image box More...
 
bool inImage (IntPoint p)
 inImage() - given the coordinates of a pixel, as a point, check if its coordinates are inside the image box More...
 
off_t getOffset (IntPoint p)
 getOffset() - given the coordinates of a pixel in a image box, get its offset. More...
 
IntPoint getCoords (off_t off)
 getCoords() - given the offset of a pixel inside an image, returns its coordinates as a point More...
 
double getDistance (off_t pa, off_t pb)
 getDistance() - given the offset of two points inside the image box returns the Euclidean between them. More...
 
double getDistance (off_t p)
 getDistance() - given a point inside an image box returns the Euclidean between this point and the reference point. More...
 
double getDistance (IntPoint p)
 getDistance() - given a point inside an image box returns the Euclidean between this point and the reference point. More...
 
double getDistance (IntPoint a, IntPoint b)
 getDistance() - given two points inside the image box returns the Euclidean between them. More...
 
void printSelf ()
 

Public Attributes

IntPoint pt
 
off_t reference
 
size_t width
 
size_t height
 
size_t depth
 

Constructor & Destructor Documentation

◆ ImageBox() [1/3]

ImageBox ( size_t  Size[3])
inline

ImageBox - constructor.

Build the data structure based on the image bounds. This data structure may contain a reference point inside it.

Parameters
[in]Size: array with the three image bounds : width, height and depth, as returned by the Image method getSize()

◆ ImageBox() [2/3]

ImageBox ( const ImageBox box)
inline

ImageBox - constructor.

Build the data structure copying data from another ImageBox data

Parameters
[in]box:

◆ ImageBox() [3/3]

ImageBox ( size_t  width,
size_t  height,
size_t  depth = 1 
)
inline

ImageBox - constructor.

Parameters
[in]width,height[,depth]: image bounds

Member Function Documentation

◆ setReference() [1/3]

void setReference ( off_t  x,
off_t  y,
off_t  z = 0 
)
inline

setReference() - set reference point

Parameters
[in]x,y[,z]:

◆ setReference() [2/3]

void setReference ( IntPoint  pt)
inline

setReference() - set reference point

Parameters
[in]pt:

◆ setReference() [3/3]

void setReference ( off_t  offset)
inline

setReference() - set reference point

Parameters
[in]offset:

◆ getPoint()

IntPoint getPoint ( )
inline

getPoint() - get coordinates as a point

Returns
The coordinates of the structure as a point

◆ getOffset() [1/2]

off_t getOffset ( )
inline

getOffset() - get coordinates as an reference

Returns
The coordinates of the structure as an offset

◆ shift() [1/2]

void shift ( off_t  dx,
off_t  dy,
off_t  dz = 0 
)
inline

shift() - move the point by some displacements

Parameters
[in]dx,dy[,dz]: amount to shift the reference structure

◆ shift() [2/2]

void shift ( IntPoint  dp)
inline

shift() - move the point by some displacements given by a point

Parameters
[in]dp:

◆ inImage() [1/3]

bool inImage ( )
inline

inImage() - check if the reference point is inside image bounds

Returns
True if the three coordinates are inside image bounds, False otherwise

◆ inImage() [2/3]

bool inImage ( size_t  x,
size_t  y,
size_t  z = 0 
)
inline

inImage() - given the coordinates of a pixel, check if it's inside image box

Parameters
[in]x,y[,z]:
Returns
True if the three coordinates are inside image bounds, False otherwise

◆ inImage() [3/3]

bool inImage ( IntPoint  p)
inline

inImage() - given the coordinates of a pixel, as a point, check if its coordinates are inside the image box

Parameters
[in]p:
Returns
True if the three coordinates are inside image bounds, False otherwise

◆ getOffset() [2/2]

off_t getOffset ( IntPoint  p)
inline

getOffset() - given the coordinates of a pixel in a image box, get its offset.

Returns
offset

◆ getCoords()

IntPoint getCoords ( off_t  off)
inline

getCoords() - given the offset of a pixel inside an image, returns its coordinates as a point

Returns
the coordinates as a point

◆ getDistance() [1/4]

double getDistance ( off_t  pa,
off_t  pb 
)
inline

getDistance() - given the offset of two points inside the image box returns the Euclidean between them.

Parameters
[in]pa,pb: points inside the image box
Returns
Euclidean distance between points

◆ getDistance() [2/4]

double getDistance ( off_t  p)
inline

getDistance() - given a point inside an image box returns the Euclidean between this point and the reference point.

Parameters
[in]p: point inside the image box
Returns
Euclidean distance between points

◆ getDistance() [3/4]

double getDistance ( IntPoint  p)
inline

getDistance() - given a point inside an image box returns the Euclidean between this point and the reference point.

Parameters
[in]p: point inside the image box
Returns
Euclidean distance between points

◆ getDistance() [4/4]

double getDistance ( IntPoint  a,
IntPoint  b 
)
inline

getDistance() - given two points inside the image box returns the Euclidean between them.

Parameters
[in]a,b: points inside the image box
Returns
Euclidean distance between points

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