25 class CSOMarchingSquares;
75 void set(
int topLeftVoxel[2],
float values[4],
float isoValue,
char cellConfig = 0);
78 bool isAmbiguous()
const;
82 static inline bool isIsoCell(
char cellConfig);
101 char config = (
static_cast<unsigned char>(values[0] >= isoValue) << 0) |
102 (
static_cast<unsigned char>(values[1] >= isoValue) << 1) |
103 (
static_cast<unsigned char>(values[2] >= isoValue) << 2) |
104 (
static_cast<unsigned char>(values[3] >= isoValue) << 3);
135 bool _isCorner()
const;
141 int _getDirectionOppositeOfEdge()
const;
144 std::array<float, 2> _voxelsInDirection(
int direction)
const;
151 static float interpolate(
float valueA,
float valueB,
float interpolationValue);
159 int _topLeftVoxel[2];
178 inline bool CSOMarchingSquaresCell::isAmbiguous()
const
180 return (_cellConfig == 5) || (_cellConfig == 10);
185 inline bool CSOMarchingSquaresCell::isIsoCell(
char cellConfig)
187 return (cellConfig != 0) && (cellConfig != 15);
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
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 isoV...
void reset()
Resets the state of the cell (i.e. no values are set)
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.
CSOMarchingSquaresCell()
Constructor.
float _isoValue
The isovalue to check the values against.
static int oppositeDirection(int fromDir)
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...
static char calculateCellConfig(float isoValue, float values[4])
Calculates the cell config.
vecPoint2D::iterator vecPoint2DIter
Defines an iterator to iterate through a 2D point vector.
Direction
Enumeration of directions (next to compute).
int _topLeftVoxel[2]
The position of the top left voxel in voxel coordinates.
bool _isBorderLeft
Flags to indicate that some voxels of this cell are outside the image.
std::vector< Vector2 > vecPoint2D
Defines a 2D point vector.
bool isIsoCell() const
Returns true if this cell is intersected by the isoline.
~CSOMarchingSquaresCell()
Destructor.
This class implements the Marching Squares algorithm to find isolines on 2D image slices.
bool operator!=(const Tmat2< DT > &a, const Tmat2< DT > &b)
a != b ? Return true if yes.