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)
 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.
 

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
 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 _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

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.

◆ ~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()

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

Calculates the cell config.

Definition at line 99 of file CSOMarchingSquaresCell.h.

References mlrange_cast().

◆ 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 bitwise. For ambiguities this method currently returns the direction taking the way around that voxel whose value is greater than the isovalue.

◆ 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, if this cell is such an ambiguity.

Definition at line 178 of file CSOMarchingSquaresCell.h.

◆ 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 isIsoCell().

Referenced by 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 mlrange_cast().

◆ 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 mlrange_cast().

◆ oppositeDirection()

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

Definition at line 108 of file CSOMarchingSquaresCell.h.

References mlrange_cast().

◆ 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 )

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 if it is not passed.

Friends And Related Symbol Documentation

◆ CSOMarchingSquares

To allow for an accessing of the CSOMarchingSquares class.

Definition at line 62 of file CSOMarchingSquaresCell.h.

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.

◆ _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.

◆ _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: