#include <CSOMarchingSquares.h>
Classes | |
| struct | AmbiguousCell |
| This structure stores an ambiguous cell for a later resolving. More... | |
Public Types | |
| typedef std::map< int, AmbiguousCell > | mapAmbigousCell |
| A map of ambiguous cell for a fast look-up. | |
| typedef mapAmbigousCell::iterator | mapAmbigousCellIter |
| An iterator for the map of ambiguous cells. | |
| typedef std::map< int, CSOMarchingSquaresCell > | mapCell |
| A map of all cells for a fast look-up. | |
| typedef mapCell::iterator | mapCellIter |
| An iterator for the map of cells. | |
Public Member Functions | |
| CSOMarchingSquares () | |
| Constructor. | |
| ~CSOMarchingSquares () | |
| Destructor. | |
| void | reset () |
| Resets the state of the object. | |
| void | setInterpolation (bool use) |
| Specifies if the algorithm should interpolate the contour bi-linearly. | |
| void | setImage (float *image, int imgSizeX, int imgSizeY) |
| Sets the 2D image to track/find contours on. | |
| void | setFunction (CSOFunction *implicitFunction, const Matrix4 &voxelToWorldMatrix, int startX, int startY, int imgSizeX, int imgSizeY, int voxelZPosition) |
| Sets a 3D interpolation function, an image size and voxel size and a fixed z-offset. | |
| void | findIsoLine (int startPosX, int startPosY, float isoValue, bool takeShortestPath, CSOMarchingSquaresCell::vecPoint2D &positions) |
Looks for an isoline on the image. | |
| 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 vectors. | |
| bool | fillCSO (CSO *cso, CSOMarchingSquaresCell::vecPoint2D &positions, float posZ, PagedImage *pImg, bool useSmoothing, float smoothingFactor, int numSmoothPasses, int smoothRange, CSOSmoothingModes smoothingMode) const |
| Fills the given CSO with seedpoints according to the given list of points. | |
Protected Member Functions | |
| void | _findStartPosition (int &startX, int &startY) |
| Searches for a starting position such that startX/startY make up the top-left voxel position of a cell which is intersected by the isoline. | |
| bool | _findNearestIsoCell (int voxelPosX, int voxelPosY, CSOMarchingSquaresCell &cell) |
Searches for the first cell that is an iso cell starting from [voxelPosX, voxelPosY]. Returns true if a cell was found, i.e. cell is valid. | |
| bool | _findNearestIsoCell (int voxelPos[2], CSOMarchingSquaresCell &cell) |
Searches for the first cell that is an iso cell starting from [voxelPos[0], voxelPos[1]]. Returns true if a cell was found, i.e. cell is valid. | |
| void | _trackIsoCell (CSOMarchingSquaresCell startCell, int fromDir, CSOMarchingSquaresCell::vecPoint2D &positions, mapCell *pVisitedCells=NULL) |
Tracks the isoline starting from the startCell. | |
| void | _createCell (int topLeftVoxel[2], CSOMarchingSquaresCell &cell) |
Create a new cell at position topLeftVoxel[2]. | |
| int | _walkToCell (const CSOMarchingSquaresCell &fromCell, int fromDir, CSOMarchingSquaresCell &toCell) |
Create a cell toCell from the cell fromCell coming from fromDir. | |
| int | _getPossibleEnterDirection (const CSOMarchingSquaresCell &cell) const |
| unsigned int | _getKey (const CSOMarchingSquaresCell &cell) const |
| Returns the key for a cell. E.g. for hashtables. | |
| unsigned int | _getKey (int x, int y) const |
| Returns the key for a position for hashtables. | |
| float | _getValueAt (int x, int y) |
| Returns the value of the image or function at the given position. | |
Protected Attributes | |
| float * | _image |
| Pointer to input image. | |
| int | _imageSizeX |
| The x extent of the input image. | |
| int | _imageSizeY |
| The y extent of the input image. | |
| int | _startX |
| Starting voxel x (function). | |
| int | _startY |
| Starting voxel y (function). | |
| float | _isoValue |
| The iso value to find the iso line for. | |
| CSOFunction * | _function |
| An implicit function. | |
| int | _voxelZPosition |
| The z-position of the voxels. | |
| Matrix4 | _voxelToWorldMatrix |
| The voxelToWorld matrix. | |
| bool | _bInterpolatePoints |
| Should the contour be interpolated bi-linearly? | |
| mapAmbigousCell | _mapAmbiguities |
| A map holding all ambiguity cells found during traversal. | |
| std::map< int, double > | _existingValues |
| A map holding all computed image/function values. | |
One can either find an iso line starting from a start point or find all contours on that slice.
Definition at line 25 of file CSOMarchingSquares.h.
| typedef std::map<int, AmbiguousCell> ml::CSOMarchingSquares::mapAmbigousCell |
| typedef mapAmbigousCell::iterator ml::CSOMarchingSquares::mapAmbigousCellIter |
| typedef std::map<int, CSOMarchingSquaresCell> ml::CSOMarchingSquares::mapCell |
| typedef mapCell::iterator ml::CSOMarchingSquares::mapCellIter |
| ml::CSOMarchingSquares::CSOMarchingSquares | ( | ) |
Constructor.
| ml::CSOMarchingSquares::~CSOMarchingSquares | ( | ) |
Destructor.
| void ml::CSOMarchingSquares::_createCell | ( | int | topLeftVoxel[2], | |
| CSOMarchingSquaresCell & | cell | |||
| ) | [protected] |
Create a new cell at position topLeftVoxel[2].
| bool ml::CSOMarchingSquares::_findNearestIsoCell | ( | int | voxelPos[2], | |
| CSOMarchingSquaresCell & | cell | |||
| ) | [protected] |
Searches for the first cell that is an iso cell starting from [voxelPos[0], voxelPos[1]]. Returns true if a cell was found, i.e. cell is valid.
| bool ml::CSOMarchingSquares::_findNearestIsoCell | ( | int | voxelPosX, | |
| int | voxelPosY, | |||
| CSOMarchingSquaresCell & | cell | |||
| ) | [protected] |
Searches for the first cell that is an iso cell starting from [voxelPosX, voxelPosY]. Returns true if a cell was found, i.e. cell is valid.
| void ml::CSOMarchingSquares::_findStartPosition | ( | int & | startX, | |
| int & | startY | |||
| ) | [protected] |
Searches for a starting position such that startX/startY make up the top-left voxel position of a cell which is intersected by the isoline.
| unsigned int ml::CSOMarchingSquares::_getKey | ( | int | x, | |
| int | y | |||
| ) | const [inline, protected] |
Returns the key for a position for hashtables.
Definition at line 189 of file CSOMarchingSquares.h.
References _imageSizeX, _startX, and _startY.
| unsigned int ml::CSOMarchingSquares::_getKey | ( | const CSOMarchingSquaresCell & | cell | ) | const [inline, protected] |
Returns the key for a cell. E.g. for hashtables.
Definition at line 182 of file CSOMarchingSquares.h.
References ml::CSOMarchingSquaresCell::_topLeftVoxel.
| int ml::CSOMarchingSquares::_getPossibleEnterDirection | ( | const CSOMarchingSquaresCell & | cell | ) | const [inline, protected] |
Definition at line 196 of file CSOMarchingSquares.h.
References ml::CSOMarchingSquaresCell::getToDirection().
| float ml::CSOMarchingSquares::_getValueAt | ( | int | x, | |
| int | y | |||
| ) | [protected] |
Returns the value of the image or function at the given position.
| void ml::CSOMarchingSquares::_trackIsoCell | ( | CSOMarchingSquaresCell | startCell, | |
| int | fromDir, | |||
| CSOMarchingSquaresCell::vecPoint2D & | positions, | |||
| mapCell * | pVisitedCells = NULL | |||
| ) | [protected] |
Tracks the isoline starting from the startCell.
If this is not an iso-cell (i.e. the isoline intersects this cell) it just returns. One can optionally pass a map where to save all visited cells.
| int ml::CSOMarchingSquares::_walkToCell | ( | const CSOMarchingSquaresCell & | fromCell, | |
| int | fromDir, | |||
| CSOMarchingSquaresCell & | toCell | |||
| ) | [protected] |
Create a cell toCell from the cell fromCell coming from fromDir.
So this method first looks for the direction leaving the fromCell coming from the direction fromDir.
toCell | bool ml::CSOMarchingSquares::fillCSO | ( | CSO * | cso, | |
| CSOMarchingSquaresCell::vecPoint2D & | positions, | |||
| float | posZ, | |||
| PagedImage * | pImg, | |||
| bool | useSmoothing, | |||
| float | smoothingFactor, | |||
| int | numSmoothPasses, | |||
| int | smoothRange, | |||
| CSOSmoothingModes | smoothingMode | |||
| ) | const |
Fills the given CSO with seedpoints according to the given list of points.
| void ml::CSOMarchingSquares::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 vectors.
| void ml::CSOMarchingSquares::findIsoLine | ( | int | startPosX, | |
| int | startPosY, | |||
| float | isoValue, | |||
| bool | takeShortestPath, | |||
| CSOMarchingSquaresCell::vecPoint2D & | positions | |||
| ) |
Looks for an isoline on the image.
It starts searching for a starting cell using the startPos parameters and then tracks this cell. All contour points are pushed back to the positions vector.
| void ml::CSOMarchingSquares::reset | ( | ) |
Resets the state of the object.
| void ml::CSOMarchingSquares::setFunction | ( | CSOFunction * | implicitFunction, | |
| const Matrix4 & | voxelToWorldMatrix, | |||
| int | startX, | |||
| int | startY, | |||
| int | imgSizeX, | |||
| int | imgSizeY, | |||
| int | voxelZPosition | |||
| ) | [inline] |
Sets a 3D interpolation function, an image size and voxel size and a fixed z-offset.
NOTE that this approach supports an axial scanning of the function only at the moment; if this class should can in sagittal or coronal direction as well, some extra flag needs to be provided.
Definition at line 153 of file CSOMarchingSquares.h.
References _function, _image, _imageSizeX, _imageSizeY, _startX, _startY, _voxelToWorldMatrix, and _voxelZPosition.
| void ml::CSOMarchingSquares::setImage | ( | float * | image, | |
| int | imgSizeX, | |||
| int | imgSizeY | |||
| ) | [inline] |
Sets the 2D image to track/find contours on.
Definition at line 139 of file CSOMarchingSquares.h.
References _function, _image, _imageSizeX, _imageSizeY, _startX, _startY, and _voxelZPosition.
| void ml::CSOMarchingSquares::setInterpolation | ( | bool | use | ) | [inline] |
Specifies if the algorithm should interpolate the contour bi-linearly.
Definition at line 175 of file CSOMarchingSquares.h.
References _bInterpolatePoints.
bool ml::CSOMarchingSquares::_bInterpolatePoints [protected] |
Should the contour be interpolated bi-linearly?
Definition at line 128 of file CSOMarchingSquares.h.
Referenced by setInterpolation().
std::map<int, double> ml::CSOMarchingSquares::_existingValues [protected] |
A map holding all computed image/function values.
Definition at line 134 of file CSOMarchingSquares.h.
CSOFunction* ml::CSOMarchingSquares::_function [protected] |
An implicit function.
Definition at line 121 of file CSOMarchingSquares.h.
Referenced by setFunction(), and setImage().
float* ml::CSOMarchingSquares::_image [protected] |
Pointer to input image.
Definition at line 107 of file CSOMarchingSquares.h.
Referenced by setFunction(), and setImage().
int ml::CSOMarchingSquares::_imageSizeX [protected] |
The x extent of the input image.
Definition at line 109 of file CSOMarchingSquares.h.
Referenced by _getKey(), setFunction(), and setImage().
int ml::CSOMarchingSquares::_imageSizeY [protected] |
The y extent of the input image.
Definition at line 111 of file CSOMarchingSquares.h.
Referenced by setFunction(), and setImage().
float ml::CSOMarchingSquares::_isoValue [protected] |
A map holding all ambiguity cells found during traversal.
This allows to track the contour again using a different direction.
Definition at line 131 of file CSOMarchingSquares.h.
int ml::CSOMarchingSquares::_startX [protected] |
Starting voxel x (function).
Definition at line 114 of file CSOMarchingSquares.h.
Referenced by _getKey(), setFunction(), and setImage().
int ml::CSOMarchingSquares::_startY [protected] |
Starting voxel y (function).
Definition at line 116 of file CSOMarchingSquares.h.
Referenced by _getKey(), setFunction(), and setImage().
Matrix4 ml::CSOMarchingSquares::_voxelToWorldMatrix [protected] |
The voxelToWorld matrix.
Definition at line 125 of file CSOMarchingSquares.h.
Referenced by setFunction().
int ml::CSOMarchingSquares::_voxelZPosition [protected] |
The z-position of the voxels.
Definition at line 123 of file CSOMarchingSquares.h.
Referenced by setFunction(), and setImage().
1.5.8