All Classes Functions Variables Enumerations Pages
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ilato::surfaceExtraction Class Reference

Classes

struct  fcp
 The fcp struct determines on which side of an active voxel the face center point is located (= ori), where it is located in the scalar field of density values (index i refers to the position in xfIndex, yfIndex or zfIndex - depending on the face orientation ori). The Boolean variables visitedNorth etc. indicate which direction has already been taken in previous visits to the FCP. More...
 
struct  fcpPOA
 
struct  poa
 This struct determines the point of ambiguity (=POA) and his 4 adjacent FCPs. The start members indicates in which direction the POA is located, viewed from the respective FCP from. More...
 

Public Member Functions

void createSurface (volume_parameters &settings, MyMesh &mesh, double threshold=7000, bool connected=false, bool mixedMode=true, bool extraPoints=false)
 This function generates a surface from a 3-dimensional scalar field using the VESTA algorithm. The values of the scalar field have to be available as a std::vector of doubles, the surface is stored in a TriMesh. More...
 
void setBorderOffset (double bOffset)
 This setter determines whether the surface should protrude from the scalar field when it gets to the edge of the scalar field. The surface has to protrude from the scalar field, if there are no zero faces (and holes) may arise. More...
 
void clear4refresh ()
 This function sets all the private member variables to 0. It is required if another surface is to be generated with the same surfaceExtraction object with which a surface has been generated already.
 
bool existComplexEdges ()
 This function reports whether during the last calculation of the surface complex edges have occured. More...
 
void setMediumMode ()
 This sets a mode that switches to the high resolution mode, if the cycle length is equal 8 or greater.
 
bool getMediumMode ()
 This function reports whether the medium mode is set. More...
 
void setSemiConnectedMode ()
 This sets a mode that calculates 8 cycles in the low resolution mode in a secure way.
 
bool getSpecialMode ()
 This function reports whether the special mode is set. More...
 
void setSpecialMode ()
 This sets a mode that switches to the high resolution mode, if complex edges occurs.
 
void setModeDecided (bool decided)
 This function determines whether you will be asked if you want to switch to the special mode in the case of occurance of edges. More...
 
void setSurfaceColor (int n)
 With this funtion, the color of the surface can be set. More...
 
void setFeatureEdges (bool fEdges)
 This setter determines whether additional red edges are drawn for highlighting the cycles of the VESTA algorithm. Thereby the mesh becomes slightly damaged (because edges are drawn twice). This highlighting is used for test purposes. More...
 
void setDeleteZeroFaces (bool zerofaced)
 This setter determines whether defective zero faces should be deleted. This kind of faces is not generated (so far as it has been observed). More...
 

Private Types

enum  start { north, east, south, west }
 Defines the directions in which one can travel from the face center point of a cube side.
 

Private Member Functions

std::vector< int > * stdIndex (int ori, start dir)
 This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle. More...
 
std::vector< int > * altIndex (int ori)
 This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle. More...
 
surfaceExtraction::start iterDir (start dir, int i)
 This helper function for the nextFCP function returns the direction of the next VESTA segment in clockwise order. More...
 
surfaceExtraction::start prevDir (start dir)
 This helper function for the nextFCP function returns the direction of the next VESTA segment in counterclockwise order. More...
 
surfaceExtraction::start stdDir (int ori, start dir, bool connec)
 This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir]. More...
 
surfaceExtraction::start altDir (int ori, start dir, bool connec)
 This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir]. More...
 
int offset (int orientation, start dir, int case012, bool connec)
 This helper function for the next FCP function determines the offset to the adjacent FCPs. This offset concern the xfIndex-, yfIndex- or zfIndex- vector. More...
 
int cubeSide (int orientation, start dir, bool connec)
 This helper function for the next FCP function returns the cube side of the first case in the crucial query. More...
 
int nextOri (int ori, start dir)
 This function is not used. It returns a cube side if traveling from ori 1-6 in direction NESW (=0-3) via cube[ori][dir]. That describes the geometry of the cube with the sides 1-6.
 
int nextFCP (int inIndex, start &direction, bool connec)
 That is the crucial function of the VESTA algorithm. Given a face center point (=FCP) and a direction (=NESW), it computes the next FCP of the VESTA cycle. More...
 
int threeNeighboursFCPNew (int i, start direction, int &a, int &b, start &d1, start &d2, start &d3)
 Given a FCP and a direction, this function find the three FCPs adjacent to a POA. More...
 
void setPOAconnected (int i, bool connected)
 This function specifies that 4 FCP cycles are connected or disconnected. More...
 
void setFCPconnected (int fcpIndex, start direction, bool connected)
 This function specifies that a FCP is connected in a specific direction. More...
 
double poaDensity (int fcp1i, int fcp1ori, int fcp2i, volume_parameters &settings)
 This function computes the density at a point of ambiguity (=between two FCPs) More...
 
double fcpDensity (int fcpOri, int vd, int xEdgeLength, int yEdgeLength, std::vector< double > &densities)
 This function computes the density at a FCP (=between two Voxels of the scalar field) More...
 
void fillup (volume_parameters &settings, double isoValue, MyMesh &mesh)
 This function computes the face center points and puts them all in the allFCP vector. Furthermore, it computes the cuboid which contains the pointers (=indices) pointing to the FCPs in the allFCP vector (this cuboid is represented by the vectors xfIndex, yfIndex and zfIndex). Finally, this function computes edge1 and edge2 (the offsets in y- and z-direction in the cuboid of pointers) and the derived member variables doffset and offsetCube. More...
 
void createTriangles (int fcpCycle[], int lengthOfCycle, MyMesh &mesh, bool extraPoints)
 This function computes the triangulations (= 4-/5-/6-/7-/8-/9-/12-cycle decomposition), and draws the triangles, by calling drawTriangles. More...
 
int computeStartIndex (int &lengthOfCycle, int fcpCycle[], bool semicon)
 This function computes the start index of the 8 cycle. More...
 
bool drawTriangles (int startIndex, int fcpCycle[], int lengthOfCycle, std::vector< MyMesh::FaceHandle > *fHandles, MyMesh &mesh)
 This function draws the triangles of a triangulation. If an error occurs (complex edge), the user will be asked to select how the procedure is continued. Either the function is exited, or the triangles are still drawn. More...
 
void computeExtraPoint (int &startIndex, int fcpCycle[], int &lengthOfCycle, MyMesh &mesh)
 This function computes the center of gravity and adds this point at the beginning and at the end of the fcpCycle. Therefore, the length of the cycle increases by 2. More...
 
bool isSameVoxel (int index1, int index2)
 This function checks if two faces belong to the same density value/cube. This is needed for computing a better cycle order. More...
 

Private Attributes

bool complexEdgeError = false
 If an complex edge error occurs, this variable is set to true.
 
bool mediumMode = false
 True if the medium mode is set.
 
bool semiConnectedMode = false
 True if 8 cycles are calculated in the low resolution mode in a secure way.
 
bool specialMode = false
 True if the special mode is set (low resolution mode and high resolution mode in case of complex edges).
 
bool modeDecided = false
 True if high resolution mode is selected in case of complex edges.
 
bool drawPOAs = false
 If this variable is true, points of ambiguities will be drawn.
 
double borderOffset = 0.0
 If this parameter is greater than zero, the surface protrude from the scalar field.
 
bool computeNormals = true
 True if face normals are to be calculated.
 
bool deleteZeroFaces = true
 If this variable is true, it will be checked whether faces of zero length were drawn, and these faces will be deleted.
 
bool featureEdges = false
 True if feature edges should be drawn.
 
double minSpacing = 0.000001
 the minimal distance between the center of a voxel and a FCP
 
MyMesh::Color fcpColor = MyMesh::Color(0,0.9,0,0.9)
 This variable defines the color of the face center points and therefore it determines the color of the surface.
 
int cube [7][4]
 
start stdDirection [7][4]
 determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir] More...
 
start altDirection [7][4]
 determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir] More...
 
int offsetCube [7][4][3]
 The offsets for the nextFCP function.
 
int doffset [7]
 The offsets between two adjacent voxels depending on the side of the voxel.
 
std::vector< fcpallFCP
 This vector contains all face center points (=FCP) of the surface.
 
std::vector< int > xfIndex
 
std::vector< int > yfIndex
 
std::vector< int > zfIndex
 
std::vector< int > * indexStd [7][2]
 
std::vector< int > * indexAlt [7]
 
std::vector< poaallPOA
 This vector contains all points of ambiguity (=POA) of the surface.
 
std::vector< fcpPOAallFCPpoa
 This vector contains all the fcpPOAs. It is as large as the allFCP vector.
 

Member Function Documentation

surfaceExtraction::start ilato::surfaceExtraction::altDir ( int  ori,
start  dir,
bool  connec 
)
private

This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir].

Parameters
orithe current orientation of the FCP
dirthe current direction
connectrue if the voxels are sould be connected, otherwise false
Returns
the next direction of the VESTA cycle
std::vector< int > * ilato::surfaceExtraction::altIndex ( int  ori)
private

This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle.

Parameters
orithe orientation of the FCP
dirthe current direction
Returns
the proper vector if we hop on neighbor cube while maintaining current orientation (0 degree turn)
void ilato::surfaceExtraction::computeExtraPoint ( int &  startIndex,
int  fcpCycle[],
int &  lengthOfCycle,
MyMesh mesh 
)
inlineprivate

This function computes the center of gravity and adds this point at the beginning and at the end of the fcpCycle. Therefore, the length of the cycle increases by 2.

Parameters
startIndexis the index of the FCP which is shared by all triangles.
fcpCyclecontains all the FCPs of a cycle
lengthOfCyclendicates the length of the cycle.
meshis the mesh, in which everything is drawn.
int ilato::surfaceExtraction::computeStartIndex ( int &  lengthOfCycle,
int  fcpCycle[],
bool  semicon 
)
inlineprivate

This function computes the start index of the 8 cycle.

Parameters
lengthOfCyclelength of the cycle (= 8)
fcpCyclethe indices of the FCPs of the cycle in allFCP
semiconTrue if 8 cycles are to be calculated in a secure way
Returns
the start index
void ilato::surfaceExtraction::createSurface ( volume_parameters settings,
MyMesh mesh,
double  threshold = 7000,
bool  connected = false,
bool  mixedMode = true,
bool  extraPoints = false 
)

This function generates a surface from a 3-dimensional scalar field using the VESTA algorithm. The values of the scalar field have to be available as a std::vector of doubles, the surface is stored in a TriMesh.

Parameters
settingsis a volume_parameters struct object. This object contains among others a std::vector<double> densities, a std::vector<int> dimSize and an Eigen::Vector3d called offset.
meshin this TriMesh, the surface is stored.
thresholdindicates at which density value the surface should be drawn.
connectedindicates whether diagonally adjacent densitiy values that are above the threshold should always be connected or not.
mixedModeis this parameter true, then it is decided automatically whether adjacent values are connected or not (depending on the local environment).
extraPointsindicates whether the high resolution mode should be used.
void ilato::surfaceExtraction::createTriangles ( int  fcpCycle[],
int  lengthOfCycle,
MyMesh mesh,
bool  extraPoints 
)
private

This function computes the triangulations (= 4-/5-/6-/7-/8-/9-/12-cycle decomposition), and draws the triangles, by calling drawTriangles.

Parameters
fcpCyclecontains all the FCPs of a cycle
lengthOfCycleindicates the length of the cycle.
meshis the mesh, in which everything is drawn.
extraPointsif this variable is true, the high resolution mode is selected.
int ilato::surfaceExtraction::cubeSide ( int  orientation,
start  dir,
bool  connec 
)
private

This helper function for the next FCP function returns the cube side of the first case in the crucial query.

Parameters
orientationthe current orientation ori of the FCP
dirthe current direction of the VESTA cycle
connectrue if the voxels are sould be connected, otherwise false
Returns
the cube side of the first case in the crucial query
bool ilato::surfaceExtraction::drawTriangles ( int  startIndex,
int  fcpCycle[],
int  lengthOfCycle,
std::vector< MyMesh::FaceHandle > *  fHandles,
MyMesh mesh 
)
inlineprivate

This function draws the triangles of a triangulation. If an error occurs (complex edge), the user will be asked to select how the procedure is continued. Either the function is exited, or the triangles are still drawn.

Parameters
startIndexis the index of the FCP which is shared by all triangles.
fcpCyclecontains all the FCPs of a cycle
lengthOfCycleindicates the length of the cycle.
fHandlesin this vector the face handles of all triangles of the triangulation are stored.
meshis the mesh, in which everything is drawn.
Returns
true if an complex edge error occurs.
bool ilato::surfaceExtraction::existComplexEdges ( )

This function reports whether during the last calculation of the surface complex edges have occured.

Returns
true if complex edges occured, false otherwise.
double ilato::surfaceExtraction::fcpDensity ( int  fcpOri,
int  vd,
int  xEdgeLength,
int  yEdgeLength,
std::vector< double > &  densities 
)
private

This function computes the density at a FCP (=between two Voxels of the scalar field)

Parameters
fcpOrithe orientation of the FCP.
vdthe position in the densities vector (=scalar field)
xEdgeLengththe length of the scalar field in x-direction
yEdgeLengththe length of the scalar field in y-direction
densitiesthe scalar field
Returns
void ilato::surfaceExtraction::fillup ( volume_parameters settings,
double  isoValue,
MyMesh mesh 
)
private

This function computes the face center points and puts them all in the allFCP vector. Furthermore, it computes the cuboid which contains the pointers (=indices) pointing to the FCPs in the allFCP vector (this cuboid is represented by the vectors xfIndex, yfIndex and zfIndex). Finally, this function computes edge1 and edge2 (the offsets in y- and z-direction in the cuboid of pointers) and the derived member variables doffset and offsetCube.

Parameters
settingsthis object contains the scalar field
isoValuethe threshold for the isosurface.
meshis the mesh, in which everything is drawn.
bool ilato::surfaceExtraction::getMediumMode ( )

This function reports whether the medium mode is set.

Returns
true if the medium mode is set.
bool ilato::surfaceExtraction::getSpecialMode ( )

This function reports whether the special mode is set.

Returns
true if the special mode is set.
bool ilato::surfaceExtraction::isSameVoxel ( int  index1,
int  index2 
)
private

This function checks if two faces belong to the same density value/cube. This is needed for computing a better cycle order.

Parameters
index1the index of the first FCP in allFCP
index2the index of the second FCP in allFCP
Returns
true, if the FCPs belongs to the same density value
surfaceExtraction::start ilato::surfaceExtraction::iterDir ( start  dir,
int  i 
)
private

This helper function for the nextFCP function returns the direction of the next VESTA segment in clockwise order.

Parameters
dirthe direction
ithe number of jumps in clockwise order
Returns
the next direction
int ilato::surfaceExtraction::nextFCP ( int  inIndex,
start direction,
bool  connec 
)
private

That is the crucial function of the VESTA algorithm. Given a face center point (=FCP) and a direction (=NESW), it computes the next FCP of the VESTA cycle.

Parameters
inIndexis the index of the fcp in the allFCP vector.
directionis the direction in which the VESTA algorithm goes in this step. After returning, this variable indicates the new direction in the next step.
connecindicates whether the connected mode has to be selected.
Returns
the index of the nect face center point.
int ilato::surfaceExtraction::offset ( int  orientation,
start  dir,
int  case012,
bool  connec 
)
private

This helper function for the next FCP function determines the offset to the adjacent FCPs. This offset concern the xfIndex-, yfIndex- or zfIndex- vector.

Parameters
orientationthe current orientation of the FCP
dirthe direction
case012case 0,1 or 2 of the three possible cases of the crucial query
connectrue if the voxels are sould be connected, otherwise false
Returns
the offset to an adjacent FCP
double ilato::surfaceExtraction::poaDensity ( int  fcp1i,
int  fcp1ori,
int  fcp2i,
volume_parameters settings 
)
private

This function computes the density at a point of ambiguity (=between two FCPs)

Parameters
fcp1ithe index of the first FCP in allFCP
fcp1orithe orientation ori of the first FCP
fcp2ithe index of the first FCP in allFCP
settingsthe scalar field
Returns
the density value at the POA
surfaceExtraction::start ilato::surfaceExtraction::prevDir ( start  dir)
private

This helper function for the nextFCP function returns the direction of the next VESTA segment in counterclockwise order.

Parameters
dirthe direction
Returns
the next direction
void ilato::surfaceExtraction::setBorderOffset ( double  bOffset)

This setter determines whether the surface should protrude from the scalar field when it gets to the edge of the scalar field. The surface has to protrude from the scalar field, if there are no zero faces (and holes) may arise.

Parameters
bOffsetif this parameter is greater than zero, the surface protrude from the scalar field.
void ilato::surfaceExtraction::setDeleteZeroFaces ( bool  zerofaced)

This setter determines whether defective zero faces should be deleted. This kind of faces is not generated (so far as it has been observed).

Parameters
zerofacedif this parameter is false, zero faces are not drawn.
void ilato::surfaceExtraction::setFCPconnected ( int  fcpIndex,
start  direction,
bool  connected 
)
private

This function specifies that a FCP is connected in a specific direction.

Parameters
fcpIndexthe index of the FCP in allFCP
directionthe direction
connectedtrue if connected, false otherwise
void ilato::surfaceExtraction::setFeatureEdges ( bool  fEdges)

This setter determines whether additional red edges are drawn for highlighting the cycles of the VESTA algorithm. Thereby the mesh becomes slightly damaged (because edges are drawn twice). This highlighting is used for test purposes.

Parameters
fEdgesif this parameter is true, then additional red edges are drawn.
void ilato::surfaceExtraction::setModeDecided ( bool  decided)

This function determines whether you will be asked if you want to switch to the special mode in the case of occurance of edges.

Parameters
decidedhas to be true, if you want to be asked.
void ilato::surfaceExtraction::setPOAconnected ( int  i,
bool  connected 
)
private

This function specifies that 4 FCP cycles are connected or disconnected.

Parameters
ithe index if the POA in allPOA
connectedtrue if connected, false otherwise
void ilato::surfaceExtraction::setSurfaceColor ( int  n)

With this funtion, the color of the surface can be set.

Parameters
ndetermines the color: 1 = blue, 2 = violet, other = green
surfaceExtraction::start ilato::surfaceExtraction::stdDir ( int  ori,
start  dir,
bool  connec 
)
private

This helper function for the next FCP function determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir].

Parameters
orithe current orientation of the FCP
dirthe current direction
connectrue if the voxels are sould be connected, otherwise false
Returns
the next direction of the VESTA cycle
std::vector< int > * ilato::surfaceExtraction::stdIndex ( int  ori,
start  dir 
)
private

This helper function for the next FCP function returns the xfIndex-, yfIndex- or zfIndex- vector depending on the orientation ori of the current FCP and a the current direction of the VESTA cycle.

Parameters
orithe orientation or of the FCP
dirthe current direction
Returns
the proper vector if we don't hop on neighbor cube while maintaining current orientation (90 degree turn or 270 degree turn)
int ilato::surfaceExtraction::threeNeighboursFCPNew ( int  i,
start  direction,
int &  a,
int &  b,
start d1,
start d2,
start d3 
)
private

Given a FCP and a direction, this function find the three FCPs adjacent to a POA.

Parameters
iThe index of the given FCP in allFCP
directionThe direction, in which the POA is located.
aAfter returning, this variable contains the index of the first FCP adjacent to the POA.
bAfter returning, this variable contains the index of the second FCP adjacent to the POA.
d1the direction, in which the POA is located viewed from the third FCP
d2the direction, in which the POA is located viewed from the first FCP
d3the direction, in which the POA is located viewed from the second FCP
Returns
The index of the third FCP adjacent to the POA.

Member Data Documentation

start ilato::surfaceExtraction::altDirection[7][4]
private
Initial value:
= {{north, north, north, north},
{west, west, west, west}, {north, north, north, south}, {east, north, west, south},
{west, north, east, south}, {south, north, south, south}, {east, east, east, east}}

determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 0 or 180 degree corner via cube[ori][dir]

int ilato::surfaceExtraction::cube[7][4]
private
Initial value:
= {{0,0,0,0},
{3,2,4,5}, {1,3,6,4}, {1,5,6,2},
{1,2,6,5}, {1,4,6,3}, {4,2,3,5}}

Determines next cube side if traveling from ori 1-6 in direction NESW (=0-3) via cube[ori][dir]. That describes the geometry of the cube with the sides 1-6.

std::vector<int>* ilato::surfaceExtraction::indexAlt[7]
private
Initial value:
= {&yfIndex,
&yfIndex, &xfIndex, &zfIndex, &zfIndex, &xfIndex, &yfIndex}

determines proper vector to find next FCP if traveling from ori 1-6 in direction NESW (=0-3) in this case we hop on neighbor cube while maintaining current orientation (0 degree turn - also valid for 180 degree turns)

std::vector<int>* ilato::surfaceExtraction::indexStd[7][2]
private
Initial value:

determines proper vector for to find next FCP if traveling from ori 1-6 in direction NESW (=0-3) in this case we stay on same cube (90 degree turn - also valid for hops with 270 degree turns)

start ilato::surfaceExtraction::stdDirection[7][4]
private
Initial value:
= {{north, north, north, north},
{east, east, east, east}, {south, north, south, south}, {east, north, west, south},
{west, north, east, south}, {north, north, north, south}, {west, west, west, west}}

determines next movement direction if traveling from ori 1-6 in direction NESW (=0-3) around 90 or 270 degree corner via cube[ori][dir]

std::vector<int> ilato::surfaceExtraction::xfIndex
private

This vector defines a cuboid which contains pointers (=indices) pointing to FCPs in the allFCP vector. These pointers refers to FCPs which are located between two density values in x-direction. This means that for example xfIndex[5] is to the right of densities[5] and to the left of densities[6]. A value of -1 means that there is no FCP at this point.

std::vector<int> ilato::surfaceExtraction::yfIndex
private

This vector defines a cuboid which contains pointers (=indices) pointing to FCPs in the all FCP vector. These pointers refers to FCPs which are located between two density values in y-direction. This means that for example yfIndex[5] is above densities[5] and below densities[5+edge1].

std::vector<int> ilato::surfaceExtraction::zfIndex
private

This vector defines a cuboid which contains pointers (=indices) pointing to FCPs in the all FCP vector. These pointers refers to FCPs which are located between two density values in z-direction. This means that for example zfIndex[5] is in front of densities[5] and behind densities[5+edge2].


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