MeVisLabToolboxReference
|
Marching squares cell. More...
#include <CSOMarchingSquaresCell.h>
Public Types | |
enum | Direction { NONE = 0, LEFT = 1, TOP = 2, RIGHT = 4, BOTTOM = 8 } |
Enumeration of directions (next to compute). More... | |
typedef std::vector< Vector2 > | vecPoint2D |
Defines a 2D point vector. | |
typedef vecPoint2D::iterator | vecPoint2DIter |
Defines an iterator to iterate through a 2D point vector. | |
Public Member Functions | |
CSOMarchingSquaresCell () | |
Constructor. | |
~CSOMarchingSquaresCell () | |
Destructor. | |
void | reset () |
Resets the state of the cell (i.e. no values are set) | |
void | set (int topLeftVoxel[2], float values[4], float isoValue) |
Set the top left position in voxel coordinates topLeftVoxel , the values of the 4 corners and the isoValue . | |
bool | isAmbiguous () const |
There are two configurations (5 and 10) where the next cell one can visit is not unique. | |
bool | isIsoCell () const |
Returns true if this cell is intersected by the isoline. | |
int | getToDirection (int fromDir) const |
Returns the direction for this cell to go to coming from fromDir . | |
bool | addPoints (bool bIinterpolate, int fromDir, vecPoint2D &points, float xyOffset) |
Adds points the points vector according to the cell configuration. | |
bool | operator!= (CSOMarchingSquaresCell &rkCell) |
The inequality operator takes the cell configuration and the cell position into account. | |
Protected Attributes | |
unsigned char | _cellConfig |
The cell configuration is saved as a bit set such that Bit 0 is set if the upper left corner is above the isovalue. | |
int | _topLeftVoxel [2] |
The position of the top left voxel in voxel coordinates. | |
float | _values [4] |
The four voxel values used to determine the cell configuration and to interpolate the position. | |
float | _isoValue |
The isovalue to check the values against. | |
bool | _isBorder |
Flag to indicate that some voxels of this cell are outside the image. | |
Friends | |
class | CSOMarchingSquares |
To allow for an accessing of the CSOMarchingSquares class. |
Marching squares cell.
Definition at line 38 of file CSOMarchingSquaresCell.h.
typedef std::vector<Vector2> ml::CSOMarchingSquaresCell::vecPoint2D |
Defines a 2D point vector.
Definition at line 52 of file CSOMarchingSquaresCell.h.
typedef vecPoint2D::iterator ml::CSOMarchingSquaresCell::vecPoint2DIter |
Defines an iterator to iterate through a 2D point vector.
Definition at line 53 of file CSOMarchingSquaresCell.h.
Enumeration of directions (next to compute).
NONE |
No direction. |
LEFT |
To the left. |
TOP |
To the top. |
RIGHT |
To the right. |
BOTTOM |
To the bottom. |
Definition at line 44 of file CSOMarchingSquaresCell.h.
ml::CSOMarchingSquaresCell::CSOMarchingSquaresCell | ( | ) |
Constructor.
ml::CSOMarchingSquaresCell::~CSOMarchingSquaresCell | ( | ) |
Destructor.
bool ml::CSOMarchingSquaresCell::addPoints | ( | bool | bIinterpolate, |
int | fromDir, | ||
vecPoint2D & | points, | ||
float | xyOffset | ||
) |
Adds points the points
vector according to the cell configuration.
If bInterpolate
is true the method interpolates linearly. The parameter fromDir
is necessary for the correct insertion order. xyOffset
is added to the resulting positions. Use a 0 for evaluated functions and a 0.5 for evaluated images. The method returns whether a point was really added.
int ml::CSOMarchingSquaresCell::getToDirection | ( | int | fromDir | ) | const |
Returns the direction for this cell to go to coming from fromDir
.
1 = left; 2 = up; 4 = right; 8 = down This is also encoded bitwise. For ambiguities this method currently returns the direction taking the way around that voxel whose value is greater than the isovalue.
Referenced by ml::CSOMarchingSquares::_getPossibleEnterDirection().
bool ml::CSOMarchingSquaresCell::isAmbiguous | ( | ) | const [inline] |
There are two configurations (5 and 10) where the next cell one can visit is not unique.
This method returns, if this cell is such an ambiguity.
Definition at line 118 of file CSOMarchingSquaresCell.h.
bool ml::CSOMarchingSquaresCell::isIsoCell | ( | ) | const [inline] |
Returns true if this cell is intersected by the isoline.
Definition at line 125 of file CSOMarchingSquaresCell.h.
bool ml::CSOMarchingSquaresCell::operator!= | ( | CSOMarchingSquaresCell & | rkCell | ) | [inline] |
The inequality operator takes the cell configuration and the cell position into account.
Definition at line 89 of file CSOMarchingSquaresCell.h.
References _cellConfig, and _topLeftVoxel.
void ml::CSOMarchingSquaresCell::reset | ( | ) |
Resets the state of the cell (i.e. no values are set)
void ml::CSOMarchingSquaresCell::set | ( | int | topLeftVoxel[2], |
float | values[4], | ||
float | isoValue | ||
) |
Set the top left position in voxel coordinates topLeftVoxel
, the values
of the 4 corners and the isoValue
.
This method also computes and sets the internal cell configuration.
friend class CSOMarchingSquares [friend] |
To allow for an accessing of the CSOMarchingSquares class.
Definition at line 55 of file CSOMarchingSquaresCell.h.
unsigned char ml::CSOMarchingSquaresCell::_cellConfig [protected] |
The cell configuration is saved as a bit set such that Bit 0 is set if the upper left corner is above the isovalue.
Definition at line 99 of file CSOMarchingSquaresCell.h.
Referenced by operator!=().
bool ml::CSOMarchingSquaresCell::_isBorder [protected] |
Flag to indicate that some voxels of this cell are outside the image.
If it is the case, no interpolation is done for this cell.
Definition at line 113 of file CSOMarchingSquaresCell.h.
float ml::CSOMarchingSquaresCell::_isoValue [protected] |
The isovalue to check the values against.
Definition at line 110 of file CSOMarchingSquaresCell.h.
int ml::CSOMarchingSquaresCell::_topLeftVoxel[2] [protected] |
The position of the top left voxel in voxel coordinates.
Definition at line 101 of file CSOMarchingSquaresCell.h.
Referenced by ml::CSOMarchingSquares::_getKey(), and operator!=().
float ml::CSOMarchingSquaresCell::_values[4] [protected] |
The four voxel values used to determine the cell configuration and to interpolate the position.
The following mapping is used: 0 = top-left 1 = top-right 2 = bottom-right 3 = bottom-left
Definition at line 108 of file CSOMarchingSquaresCell.h.