MeVisLab Toolbox Reference
ml::CSOMarchingSquaresCell Class Reference

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< Vector2vecPoint2D
 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, char cellConfig=0)
bool isAmbiguous () const
bool isIsoCell () const
 Returns true if this cell is intersected by the isoline.
int getToDirection (int fromDir) const
bool addPoints (bool bIinterpolate, int fromDir, vecPoint2D &points, float xyOffset)
bool operator!= (CSOMarchingSquaresCell &rkCell)
 The inequality operator takes the cell configuration and the cell position into account.

Static Public Member Functions

static bool isIsoCell (char cellConfig)
 Returns true if this cell config is intersected by the isoline.
static char calculateCellConfig (float isoValue, float values[4])
 Calculates the cell config.
static int oppositeDirection (int fromDir)

Protected Attributes

unsigned char _cellConfig
int _topLeftVoxel [2]
 The position of the top left voxel in voxel coordinates.
float _values [4]
float _isoValue
 The isovalue to check the values against.
bool _isBorderLeft
 Flags to indicate that some voxels of this cell are outside the image.
bool _isBorderRight
bool _isBorderTop
bool _isBorderBottom

Friends

class CSOMarchingSquares
 To allow for an accessing of the CSOMarchingSquares class.

Detailed Description

Marching squares cell.

Definition at line 44 of file CSOMarchingSquaresCell.h.

Member Typedef Documentation

◆ vecPoint2D

Defines a 2D point vector.

Definition at line 59 of file CSOMarchingSquaresCell.h.

◆ vecPoint2DIter

typedef vecPoint2D::iterator ml::CSOMarchingSquaresCell::vecPoint2DIter

Defines an iterator to iterate through a 2D point vector.

Definition at line 60 of file CSOMarchingSquaresCell.h.

Member Enumeration Documentation

◆ Direction

Enumeration of directions (next to compute).

Enumerator
NONE 

No direction.

LEFT 

To the left.

TOP 

To the top.

RIGHT 

To the right.

BOTTOM 

To the bottom.

Definition at line 50 of file CSOMarchingSquaresCell.h.

Constructor & Destructor Documentation

◆ CSOMarchingSquaresCell()

ml::CSOMarchingSquaresCell::CSOMarchingSquaresCell ( )

Constructor.

Referenced by operator!=().

◆ ~CSOMarchingSquaresCell()

ml::CSOMarchingSquaresCell::~CSOMarchingSquaresCell ( )

Destructor.

Member Function Documentation

◆ addPoints()

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.

◆ calculateCellConfig()

char ml::CSOMarchingSquaresCell::calculateCellConfig ( float isoValue,
float values[4] )
inlinestatic

Calculates the cell config.

Definition at line 99 of file CSOMarchingSquaresCell.h.

◆ getToDirection()

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 bit-wise. 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().

◆ isAmbiguous()

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 whether this cell is such an ambiguity.

Definition at line 178 of file CSOMarchingSquaresCell.h.

References _cellConfig, and isAmbiguous().

Referenced by isAmbiguous(), and set().

◆ isIsoCell() [1/2]

bool ml::CSOMarchingSquaresCell::isIsoCell ( ) const
inline

Returns true if this cell is intersected by the isoline.

Definition at line 80 of file CSOMarchingSquaresCell.h.

References _cellConfig, and isIsoCell().

Referenced by isIsoCell(), and isIsoCell().

◆ isIsoCell() [2/2]

bool ml::CSOMarchingSquaresCell::isIsoCell ( char cellConfig)
inlinestatic

Returns true if this cell config is intersected by the isoline.

Definition at line 185 of file CSOMarchingSquaresCell.h.

References isIsoCell().

◆ operator!=()

bool ml::CSOMarchingSquaresCell::operator!= ( CSOMarchingSquaresCell & rkCell)
inline

The inequality operator takes the cell configuration and the cell position into account.

Definition at line 126 of file CSOMarchingSquaresCell.h.

References _cellConfig, _topLeftVoxel, and CSOMarchingSquaresCell().

◆ oppositeDirection()

int ml::CSOMarchingSquaresCell::oppositeDirection ( int fromDir)
inlinestatic

Definition at line 108 of file CSOMarchingSquaresCell.h.

References BOTTOM, LEFT, NONE, RIGHT, and TOP.

◆ reset()

void ml::CSOMarchingSquaresCell::reset ( )

Resets the state of the cell (i.e., no values are set).

◆ set()

void ml::CSOMarchingSquaresCell::set ( int topLeftVoxel[2],
float values[4],
float isoValue,
char cellConfig = 0 )

Sets the top left position in voxel coordinates topLeftVoxel, the values of the four corners, and the isoValue. This method also computes and sets the internal cell configuration if it is not passed.

References isAmbiguous().

◆ CSOMarchingSquares

friend class CSOMarchingSquares
friend

To allow for an accessing of the CSOMarchingSquares class.

Definition at line 62 of file CSOMarchingSquaresCell.h.

References CSOMarchingSquares.

Referenced by CSOMarchingSquares.

Member Data Documentation

◆ _cellConfig

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 157 of file CSOMarchingSquaresCell.h.

Referenced by isAmbiguous(), isIsoCell(), and operator!=().

◆ _isBorderBottom

bool ml::CSOMarchingSquaresCell::_isBorderBottom
protected

Definition at line 173 of file CSOMarchingSquaresCell.h.

◆ _isBorderLeft

bool ml::CSOMarchingSquaresCell::_isBorderLeft
protected

Flags to indicate that some voxels of this cell are outside the image.

Definition at line 170 of file CSOMarchingSquaresCell.h.

◆ _isBorderRight

bool ml::CSOMarchingSquaresCell::_isBorderRight
protected

Definition at line 171 of file CSOMarchingSquaresCell.h.

◆ _isBorderTop

bool ml::CSOMarchingSquaresCell::_isBorderTop
protected

Definition at line 172 of file CSOMarchingSquaresCell.h.

◆ _isoValue

float ml::CSOMarchingSquaresCell::_isoValue
protected

The isovalue to check the values against.

Definition at line 168 of file CSOMarchingSquaresCell.h.

◆ _topLeftVoxel

int ml::CSOMarchingSquaresCell::_topLeftVoxel[2]
protected

The position of the top left voxel in voxel coordinates.

Definition at line 159 of file CSOMarchingSquaresCell.h.

Referenced by ml::CSOMarchingSquares::_getKey(), and operator!=().

◆ _values

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 166 of file CSOMarchingSquaresCell.h.


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