MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Friends | List of all members
mgx::Mesh Class Reference

This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualization ones. More...

#include <Mesh.hpp>

Public Types

enum  SurfView { NORMAL, LABEL, HEAT, PARENT }
 Enumeration of the possible visualisations for the surface. More...
 
enum  MeshView { ALL_MESH, BORDER_MESH, CELL_MESH, SELECTED_MESH }
 Enumeration of the possible visualisations for the Mesh. More...
 
enum  Color { SIGNAL, TEXTURE, IMAGE }
 Enumeration of the coloring modes possible to display a normal surface. More...
 

Public Member Functions

 Mesh (const Stack *stack)
 Create an empty mesh attached to the stack.
 
 Mesh (int id, const Stack *stack)
 Create an empty mesh attached to the stack.
 
 Mesh (const Mesh &copy)
 Copy the mesh.
 
 ~Mesh ()
 Mesh destructor.
 
bool needsColorbar () const
 
const BoundingBox3fboundingBox () const
 
BoundingBox3fboundingBox ()
 
void setBoundingBox (const BoundingBox3f &bbox)
 
void updateBBox ()
 
Global properties

Properties for both mesh and surface

int id () const
 Id of the current mesh. More...
 
void setId (int i)
 Change the id of the mesh. More...
 
int userId () const
 Id as seen by the user. More...
 
const Stackstack () const
 Returns the stack associated to this mesh.
 
void setStack (const Stack *s)
 
const QStringfile () const
 Returns the name of the mesh file.
 
const QStringparentFile () const
 Returns the name of the parent label file.
 
void setFile (const QString &file=QString())
 Set the name of the mesh file. More...
 
void setParentFile (const QString &file=QString())
 Set the name of the parent label file. More...
 
bool scaled () const
 Returns true if the mesh is scaled.
 
void setScaled (bool on=true)
 Set if the mesh is scaled.
 
bool transformed () const
 Returns true if the mesh is transformed.
 
void setTransformed (bool on=true)
 Set if the mesh is transformed.
 
bool showBBox () const
 Returns true if the bounding box is shown.
 
void setShowBBox (bool on=true)
 Set if the bounding box is shown.
 
int viewLabel () const
 Returns the current label, without modifying it.
 
void setLabel (int l)
 Sets the current label.
 
int nextLabel ()
 Increment the current label and return.
 
bool labelChanged () const
 Returns true if the curr label has been changed during this process.
 
IntIntMapparentLabelMap ()
 Reference on the map from each label to a label in a different mesh.
 
const IntIntMapparentLabelMap () const
 Const reference on the map from each label to a label in a different mesh.
 
bool cells () const
 Returns true if the mesh has a cell structure. More...
 
void setCells (bool value=true)
 Set if the mesh has a cell structure. More...
 
void reset ()
 Reset the whole mesh and its properties. More...
 
Surface methods
TransferFunction surfFct () const
 Return the transfer function used to draw the surface in normal mode.
 
void setSurfFct (const TransferFunction &f)
 Change the transfer function used to draw the surface in normal mode.
 
bool surfFctChanged () const
 Returns true if the normal transfer function has been changed during the current process.
 
TransferFunction heatFct () const
 Return the transfer function used to draw the surface in heat mode.
 
void setHeatFct (const TransferFunction &f)
 Change the transfer function used to draw the surface in heat mode.
 
bool heatFctChanged () const
 Returns true if the heat transfer function has been changed during the current process.
 
float opacity () const
 Get the current opacity level of the surface.
 
void setOpacity (float f)
 Change the current opactity level of the surface.
 
float brightness () const
 Get the current brightness of the surface.
 
void setBrightness (float f)
 Change the current brightness of the surface.
 
bool isSurfaceVisible () const
 True if the surface is currently visible to the user.
 
void showSurface ()
 Show the surface to the user.
 
void hideSurface ()
 Hide the surface from the user.
 
void showNormal ()
 Show the heat map of the surface, if any.
 
void showLabel ()
 Show the labels of the surface triangles.
 
void showHeat ()
 Show the color of the surface.
 
void showParent ()
 Show the color of the surface.
 
void show (SurfView view)
 Change the view mode.
 
void showSignal ()
 Set the current color to be the signal (i.e. More...
 
void showTexture ()
 Set the current color to be the 3D texture at the position of the point. More...
 
void showImage ()
 Set the current color to be the texture attached to the mesh.
 
void show (Color color)
 Change the color mode.
 
bool culling () const
 Returns if the back surface is culled.
 
void setCulling (bool cul)
 Cull the back surface.
 
bool blending () const
 Return if the surface is rendered blended or not.
 
void setBlending (bool b)
 Set the blending attribute.
 
SurfView toShow () const
 Returns the current visualisation for the surface.
 
Color coloring () const
 Returns the current coloring for the surface.
 
bool hasImgTex () const
 True if the surface has a texture attached to it.
 
const QImageimgTex () const
 Get the current texture attached to the surface.
 
void setImgTex (const QImage &img)
 Set the texture attached to the surface.
 
void clearImgTex ()
 Remove any texture attached to the surface.
 
Updating the graphical representation
void updateAll ()
 To be called when the mesh structure changed.
 
void updateTriangles ()
 To be called if properties of the triangles changed.
 
void updateLines ()
 To be called if properties of the lines changed.
 
void updatePositions ()
 To be called if the position of the points changed.
 
void updateSelection ()
 To be called if the selection of the points changed.
 
int changes () const
 Returns what changed in the current process.
 
Heat Map methods

The heat map associate a heat (from 0 to 1) to a label or a wall.

As the heat is always from 0 to 1, the bounds of the heat map have to be specified separatly for presentation purposes and correspond to the actual value associated to 0 and 1.

IntFloatMaplabelHeat ()
 Reference on the map from label to intensity.
 
const IntFloatMaplabelHeat () const
 Returns the map from label to intensity.
 
IntIntFloatMapwallHeat ()
 Reference on the map from wall (i.e. More...
 
const IntIntFloatMapwallHeat () const
 Returns the map from wall (i.e. More...
 
QStringheatMapUnit ()
 Reference on the unit used for the current heat map. More...
 
const QStringheatMapUnit () const
 Returns the unit used for the current heat map.
 
Point2fheatMapBounds ()
 Reference on the upper and lower bounds for the heat.
 
const Point2fheatMapBounds () const
 Return the upper and lower bounds for the heat.
 
IntSymTensorMapcellAxis ()
 Return the mapping of tensors for each cell. More...
 
IntMatrix3x3fMapcellAxisScaled ()
 Returns the map from label to cells axis (array of 3 Point3f), scaled for visualisation.
 
IntMatrix3x3fMapcellAxisColor ()
 Returns the map from label to cells axis colors (array of 3 Point3f)
 
float & cellAxisWidth ()
 Returns the cell axis width.
 
float & cellAxisOffset ()
 Returns a reference to the cell axis z-offset for drawing.
 
const QStringcellAxisType () const
 Return the type of the current cell axis. More...
 
QStringcellAxisType ()
 Return the type of the current cell axis. More...
 
const QStringcellAxisUnit () const
 Unit for the length of the cell axis.
 
QStringcellAxisUnit ()
 Unit for the length of the cell axis.
 
void clearCellAxis ()
 Remove any cell axis.
 
IntMatrix3x3fMapvvCorrespondance ()
 Returns a reference to the map of correspondence between vertices in mesh1 and mesh2 (store vertices positions)
 
bool & showVVCorrespondance ()
 Returns a boolean for visualization of lines between corresponding vertices.
 
Signal methods

The signal spans from 0 to 1, but may correspond to any range of values.

These methods specifies the range and the units.

QStringsignalUnit ()
 Reference on the unit used for the signal. More...
 
const QStringsignalUnit () const
 Returns the unit used for the signal.
 
Point2fsignalBounds ()
 Reference on the upper and lower bounds for the signal.
 
const Point2fsignalBounds () const
 Return the upper and lower bounds for the signal.
 

Friends

class process::SetupProcess
 

Structure

vvgraphgraph ()
 Get the VV graph representing the topology of the mesh.
 
const vvgraphgraph () const
 Get the VV graph representing the topology of the mesh.
 
bool empty () const
 True if the mesh is empty (i.e. More...
 
size_t size () const
 Returns the number of vertices in the mesh.
 
int getLabel (vertex v1, vertex v2, vertex v3, bool useParentLabel=true) const
 Returns the label of the triangle (v1,v2,v3)
 
bool uniqueTri (const vertex &v, const vertex &n, const vertex &m) const
 Returns true if (v,n,m) correspond to a canonical triangle. More...
 
bool setNormal (vertex v)
 Update the normal of the vertex v in the mesh. More...
 
bool setNormals ()
 Update all the normals of the mesh. More...
 
IntPoint3fMaplabelCenter ()
 Reference on the map from label to a position. More...
 
const IntPoint3fMaplabelCenter () const
 Returns the map from label to position.
 
IntPoint3fMaplabelNormal ()
 Reference on the map from label to a normal. More...
 
const IntPoint3fMaplabelNormal () const
 Returns the map from label to normal.
 
IntPoint3fMaplabelCenterVis ()
 Reference on the map from label to a position. More...
 
const IntPoint3fMaplabelCenterVis () const
 Returns the map from label to position.
 
IntPoint3fMaplabelNormalVis ()
 Reference on the map from label to a normal. More...
 
const IntPoint3fMaplabelNormalVis () const
 Returns the map from label to position.
 
IntPoint3fMapparentCenter ()
 Reference on the map from parent label to a position. More...
 
const IntPoint3fMapparentCenter () const
 Returns the map from parent label to position.
 
IntPoint3fMapparentNormal ()
 Reference on the map from parent label to a normal. More...
 
const IntPoint3fMapparentNormal () const
 Returns the map from parent label to normal.
 
IntPoint3fMapparentCenterVis ()
 Reference on the map from parent label to a position. More...
 
const IntPoint3fMapparentCenterVis () const
 Returns the map from parent label to position.
 
IntPoint3fMapparentNormalVis ()
 Reference on the map from parent label to a normal. More...
 
const IntPoint3fMapparentNormalVis () const
 Returns the map from parent label to position.
 
IntIntSetMaplabelNeighbors ()
 Reference on the map from labels to the set of neighbor labels. More...
 
const IntIntSetMaplabelNeighbors () const
 Returns the map from labels to the set of neighbors labels.
 
IntIntVIdSetMapwallVId ()
 Reference on the map from each wall to the list of vertexes in the wall. More...
 
const IntIntVIdSetMapwallVId () const
 Returns the map from each wall to the list of vertexes in the wall.
 
IntIntFloatMapwallGeom ()
 Reference on the map from each wall to the length of the wall. More...
 
const IntIntFloatMapwallGeom () const
 Reference on the map from each wall to the length of the wall.
 
void updateWallGeometry (float borderSize)
 Update labelNeighbors, wallVId and wallGeom to reflect current data structure. More...
 
bool isBordTriangle (int label, vertex v, vertex n, vertex m, IntIntPair &rp) const
 True if (v,n,m) is on the border of the label. More...
 
void markBorder (float borderSize)
 Mark all triangles closer than borderSize from a border as being a border triangle.
 
void updateCentersNormals ()
 Search for the vertex closest to position of cell center fills in labelCenter, labelNormal, labelCenterVis, labelNormalVis.
 
void prepareAxisDrawing (float scaleAxisLength, Colorf colorPositive, Colorf colorNegative, const Point3b &showAxis=Point3b(true, true, true))
 Prepare the axis drawing structures.
 
static bool setNormal (vvgraph &S, vertex v)
 Update the normal of the vertex v in S. More...
 

Mesh methods

bool isMeshVisible () const
 Is the mesh currently visible to the user.
 
void showMesh ()
 Make the mesh visible to the user.
 
void hideMesh ()
 Hide the mesh from the user.
 
MeshView meshView () const
 Return the current view mode for the mesh.
 
void showAllMesh ()
 Set the mesh view to all.
 
void showCellMesh ()
 Set the mesh view to cell border only.
 
void showBorderMesh ()
 Set the mesh view to mesh border only.
 
void showSelectedMesh ()
 Set the mesh view to selected mesh only.
 
void show (MeshView view)
 Change the mesh view mode.
 
bool showMeshLines () const
 Are mesh lines visible.
 
bool showMeshPoints () const
 Are mesh points visible.
 
bool showMeshCellMap () const
 Are cell numbers visible.
 
void setShowMesh (bool show)
 Set if the mesh visible at all.
 
void setShowMeshLines (bool show)
 Set if the mesh lines are visible.
 
void setShowMeshPoints (bool show)
 Set if the mesh points are visible.
 
void setShowMeshCellMap (bool show)
 Set if the cell numbers are visible.
 
std::vector< vertexselectedVertices () const
 Returns a vector with the list of selected vertices.
 
std::vector< vertexactiveVertices () const
 Returns a vector with the list of active vertices. More...
 
void getConnectedVertices (const vvgraph &S, vvgraph &vSet) const
 Starting with a set of vertices, extend to connected region.
 
int getConnectedRegions (const vvgraph &S, VVGraphVec &cellVId, VIntMap &vtxCell) const
 Get a list of connected regions (3D cells)
 
void correctSelection (bool inclusive)
 Correct selection. More...
 
static void getNhbd (const vvgraph &S, const vertex &v, float radius, VtxSet &nbs)
 Get the neighborhood of a vertex.
 

Detailed Description

This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualization ones.

Note that, in MorphoGraphX, the user sees the surface, or the mesh. The surface is continuous, when the mesh is the actual connectivity of the vertices.

Member Enumeration Documentation

Enumeration of the coloring modes possible to display a normal surface.

Enumerator
SIGNAL 

Color using the signal stored on the vertices.

TEXTURE 

Color using the 3D texture of the active stack.

IMAGE 

Color using the texture stored with the mesh.

Enumeration of the possible visualisations for the Mesh.

Enumerator
ALL_MESH 

Show the whole mesh.

BORDER_MESH 

Show only the mesh border.

CELL_MESH 

Show only the cell borders (i.e. interface between labels)

SELECTED_MESH 

Show only the selected part of the mesh.

Enumeration of the possible visualisations for the surface.

Enumerator
NORMAL 

Show the color option.

LABEL 

Show the label of the triangles.

HEAT 

Show the current heat map.

PARENT 

Show the parent label.

Member Function Documentation

std::vector<vertex> mgx::Mesh::activeVertices ( ) const

Returns a vector with the list of active vertices.

These are either the selected vertices, or all of them if no vertex was selected.

IntSymTensorMap& mgx::Mesh::cellAxis ( )
inline

Return the mapping of tensors for each cell.

The tensors are encoded as three vectors: ev1, ev2, evals. Where ev1 and ev2 are the two first eigenvectors and evals is the vector with the three eigenvalues.

const QString& mgx::Mesh::cellAxisType ( ) const
inline

Return the type of the current cell axis.

If an empty string, there is no cell axis.

QString& mgx::Mesh::cellAxisType ( )
inline

Return the type of the current cell axis.

If an empty string, there is no cell axis.

bool mgx::Mesh::cells ( ) const
inline

Returns true if the mesh has a cell structure.

This means that some vertexes correspond to cell centers and other the junctions.

void mgx::Mesh::correctSelection ( bool  inclusive)

Correct selection.

Make sure the vertices are "correctly" selected. This means that:

  • border vertices will be selected if all their non-border neighbors are
  • border vertices will be selected if they don't have a non-border neighbors and at least one border neighbor is selected
  • if the selection is inclusive, border vertices will be selected if at least one non-border neighbor is selected
bool mgx::Mesh::empty ( ) const
inline

True if the mesh is empty (i.e.

the graph is empty)

QString& mgx::Mesh::heatMapUnit ( )
inline

Reference on the unit used for the current heat map.

It is shown on the color bar.

int mgx::Mesh::id ( ) const
inline

Id of the current mesh.

This is the same id used in the Process:mesh(int) method.

bool mgx::Mesh::isBordTriangle ( int  label,
vertex  v,
vertex  n,
vertex  m,
IntIntPair rp 
) const

True if (v,n,m) is on the border of the label.

rp will be set to the wall the triangle is on, if any.

IntPoint3fMap& mgx::Mesh::labelCenter ( )
inline

Reference on the map from label to a position.

This position will be intepreted as the center of the label, and used to draw the label number on the mesh or growth directions on cellular mesh.

IntPoint3fMap& mgx::Mesh::labelCenterVis ( )
inline

Reference on the map from label to a position.

This position will be intepreted as the center of the label, and used to draw growth directions on a non-cellular mesh.

IntIntSetMap& mgx::Mesh::labelNeighbors ( )
inline

Reference on the map from labels to the set of neighbor labels.

A label is neighbors of another ones if they share at least an edge of the mesh.

Note
You shouldn't need to modify this structure directly. You should instead call Mesh::updateWallGeometry()
IntPoint3fMap& mgx::Mesh::labelNormal ( )
inline

Reference on the map from label to a normal.

This vector will be intepreted as the normal of the label, and used to draw the cell axis (e.g. principal directions of growth, MT orientation...).

IntPoint3fMap& mgx::Mesh::labelNormalVis ( )
inline

Reference on the map from label to a normal.

This vector will be intepreted as the normal of the label, and used to draw the cell axis (e.g. principal directions of growth, MT orientation...).

IntPoint3fMap& mgx::Mesh::parentCenter ( )
inline

Reference on the map from parent label to a position.

This position will be intepreted as the center of the parent label, and used to draw the parent label number on the mesh or growth directions on cellular mesh.

IntPoint3fMap& mgx::Mesh::parentCenterVis ( )
inline

Reference on the map from parent label to a position.

This position will be intepreted as the center of the parent label, and used to draw growth directions on a non-cellular mesh.

IntPoint3fMap& mgx::Mesh::parentNormal ( )
inline

Reference on the map from parent label to a normal.

This vector will be intepreted as the normal of the parent label, and used to draw the cell axis (e.g. principal directions of growth, MT orientation...).

IntPoint3fMap& mgx::Mesh::parentNormalVis ( )
inline

Reference on the map from parent label to a normal.

This vector will be intepreted as the normal of the parent label, and used to draw the cell axis (e.g. principal directions of growth, MT orientation...).

void mgx::Mesh::reset ( )

Reset the whole mesh and its properties.

In the end, the mesh is empty, so doesn't contain cells, texture and is neither scaled nor transformed.

The next label stays untouched, as it is important to keep coordination between different meshes/stacks.

void mgx::Mesh::setCells ( bool  value = true)
inline

Set if the mesh has a cell structure.

This means that some vertexes correspond to cell centers and other the junctions.

void mgx::Mesh::setFile ( const QString file = QString())

Set the name of the mesh file.

This is called when the mesh is loaded or saved. Processes that create a new mesh should call this without a parameter to reset the filename to null.

void mgx::Mesh::setId ( int  i)
inline

Change the id of the mesh.

Please do not use this method for meshes attached to a process.

bool mgx::Mesh::setNormal ( vertex  v)
inline

Update the normal of the vertex v in the mesh.

Returns false if the normal cannot be computed

static bool mgx::Mesh::setNormal ( vvgraph S,
vertex  v 
)
static

Update the normal of the vertex v in S.

Returns false if the normal cannot be computed

bool mgx::Mesh::setNormals ( )

Update all the normals of the mesh.

Returns false if any normal cannot be computed

void mgx::Mesh::setParentFile ( const QString file = QString())

Set the name of the parent label file.

This is called when the parent labels are loaded or saved.

void mgx::Mesh::showSignal ( )
inline

Set the current color to be the signal (i.e.

intensity) on each triangle

void mgx::Mesh::showTexture ( )
inline

Set the current color to be the 3D texture at the position of the point.

This represent the surface as a cut through the volume. The 3D texture selected correspond to the current one for the stack attached to this mesh.

QString& mgx::Mesh::signalUnit ( )
inline

Reference on the unit used for the signal.

It is shown on the color bar.

bool mgx::Mesh::uniqueTri ( const vertex v,
const vertex n,
const vertex m 
) const
inline

Returns true if (v,n,m) correspond to a canonical triangle.

This means it returns true only for one of all the possible triangles made from v, n and m (i.e. (v,n,m), (v,m,n), ...)

void mgx::Mesh::updateWallGeometry ( float  borderSize)

Update labelNeighbors, wallVId and wallGeom to reflect current data structure.

Parameters
borderSizeDistance from the wall up to which the triangles are considered part of the wall. This is important mostly for signal intensity.
int mgx::Mesh::userId ( ) const
inline

Id as seen by the user.

This is, typically id()+1

IntIntFloatMap& mgx::Mesh::wallGeom ( )
inline

Reference on the map from each wall to the length of the wall.

The length is calculated as the sum of the edges making the wall. This means the number returned is will depend on the discretization of the surface.

Note
You shouldn't need to modify this structure directly. You should instead call Mesh::updateWallGeometry()
IntIntFloatMap& mgx::Mesh::wallHeat ( )
inline

Reference on the map from wall (i.e.

pair of vertex id) to intensity

const IntIntFloatMap& mgx::Mesh::wallHeat ( ) const
inline

Returns the map from wall (i.e.

pair of vertex id) to intensity

IntIntVIdSetMap& mgx::Mesh::wallVId ( )
inline

Reference on the map from each wall to the list of vertexes in the wall.

A wall is identified as the interface between two labels, and as such, is given as a pair of labels. Note that there is a difference between the wall (i,j) and (j,i), as the first label is considered as the interior of the wall, and used as such when calculating the signal along a wall.

Note
You shouldn't need to modify this structure directly. You should instead call Mesh::updateWallGeometry()

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