23#include <ThirdPartyWarningsDisable.h>
24#include <boost/unordered_map.hpp>
25#include <ThirdPartyWarningsRestore.h>
55 void setImage(
float* image,
int imgSizeX,
int imgSizeY);
59 void setFunction(
CSOFunction* implicitFunction,
const Matrix4& voxelToWorldMatrix,
int startX,
int startY,
int imgSizeX,
int imgSizeY,
int voxelZPosition);
66 void findAllIsoLines(
float isoValue,
bool takeShortestPath, std::vector<CSOMarchingSquaresCell::vecPoint2D>& vecPositions);
99 void _createCell(
int topLeftVoxel[2], std::set<unsigned int>& cellsVisited, std::queue<CSOMarchingSquaresCell>& cellFront);
111 unsigned int _getKey(
int x,
int y)
const;
166 const Matrix4& voxelToWorldMatrix,
167 int startX,
int startY,
168 int imgSizeX,
int imgSizeY,
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
int getToDirection(int fromDir) const
int _topLeftVoxel[2]
The position of the top left voxel in voxel coordinates.
std::vector< Vector2 > vecPoint2D
Defines a 2D point vector.
Matrix4 _voxelToWorldMatrix
The voxel-to-world matrix.
float * _image
Pointer to input image.
int _imageSizeX
The x extent of the input image.
int _startY
Starting voxel y (function).
int _voxelZPosition
The z-position of the voxels.
boost::unordered_map< int, double > _existingValues
A map holding all computed image/function values.
bool _findNearestIsoCell(int voxelPos[2], CSOMarchingSquaresCell &cell)
Searches for the first cell that is an iso-cell starting from [voxelPos[0], voxelPos[1]]....
float _getValueAt(int x, int y)
Returns the value of the image or function at the given position.
void _createCell(int topLeftVoxel[2], CSOMarchingSquaresCell &cell)
Creates a new cell at position topLeftVoxel[2].
int _imageSizeY
The y extent of the input image.
void _findStartPosition(int &startX, int &startY)
Searches for a starting position such that startX/startY make up the top-left voxel position of a cel...
bool fillCSO(FillCSOParameters ¶meters)
Fills the given CSO with seed points according to the given list of points.
void reset()
Resets the state of the object.
CSOMarchingSquares()
Constructor.
void _createCell(int topLeftVoxel[2], CSOMarchingSquaresCell &cell, float values[4], char cellConfig)
Creates a new cell at position topLeftVoxel[2].
void findIsoLine(int startPosX, int startPosY, float isoValue, bool takeShortestPath, CSOMarchingSquaresCell::vecPoint2D &positions)
bool _isInImage(int x, int y) const
Returns whether the x,y coordinates are within the image.
unsigned int _getKey(const CSOMarchingSquaresCell &cell) const
Returns the key for a cell. For example, this can be used for hashtables.
void setFunction(CSOFunction *implicitFunction, const Matrix4 &voxelToWorldMatrix, int startX, int startY, int imgSizeX, int imgSizeY, int voxelZPosition)
void _createCell(int topLeftVoxel[2], std::set< unsigned int > &cellsVisited, std::queue< CSOMarchingSquaresCell > &cellFront)
Creates a new cell at position topLeftVoxel[2], and keeps track whether this cell has already been cr...
void setImage(float *image, int imgSizeX, int imgSizeY)
Sets the 2D image to track/find contours on.
~CSOMarchingSquares()
Destructor.
void setInterpolation(bool use)
Specifies whether the algorithm should interpolate the contour bi-linearly.
int _walkToCell(const CSOMarchingSquaresCell &fromCell, int fromDir, CSOMarchingSquaresCell &toCell)
CSOFunction * _function
An implicit function.
void _trackIsoCell(CSOMarchingSquaresCell startCell, const int initialFromDir, CSOMarchingSquaresCell::vecPoint2D &positions, std::vector< std::array< unsigned char, 2 > > *cellsVisitedDirections=nullptr)
int _startX
Starting voxel x (function).
bool _bInterpolatePoints
Should the contour be interpolated bi-linearly?
float _isoValue
The isovalue to find the isoline for.
void findAllIsoLines(float isoValue, bool takeShortestPath, std::vector< CSOMarchingSquaresCell::vecPoint2D > &vecPositions)
Finds all contours on the image with isovalue isovalue. Returns them in a vector of 2D position vecto...
bool _findNearestIsoCell(int voxelPosX, int voxelPosY, CSOMarchingSquaresCell &cell)
Searches for the first cell that is an iso-cell starting from [voxelPosX, voxelPosY]....
int _getPossibleEnterDirection(const CSOMarchingSquaresCell &cell) const
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
CSOSmoothingModes
Enumeration of smoothing modes.
bool shouldReduceCSOToOnlyOneSeedPoint
CSOSmoothingModes smoothingMode
CSOMarchingSquaresCell::vecPoint2D positions