MorphoGraphX
|
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 the mesh. | |
~Mesh () | |
Mesh destructor. | |
bool | needsColorbar () const |
const BoundingBox3f & | boundingBox () const |
BoundingBox3f & | boundingBox () |
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 Stack * | stack () const |
Returns the stack associated to this mesh. | |
void | setStack (const Stack *s) |
const QString & | file () const |
Returns the name of the mesh file. | |
const QString & | parentFile () 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. | |
IntIntMap & | parentLabelMap () |
Reference on the map from each label to a label in a different mesh. | |
const IntIntMap & | parentLabelMap () 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 QImage & | imgTex () 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. | |
IntFloatMap & | labelHeat () |
Reference on the map from label to intensity. | |
const IntFloatMap & | labelHeat () const |
Returns the map from label to intensity. | |
IntIntFloatMap & | wallHeat () |
Reference on the map from wall (i.e. More... | |
const IntIntFloatMap & | wallHeat () const |
Returns the map from wall (i.e. More... | |
QString & | heatMapUnit () |
Reference on the unit used for the current heat map. More... | |
const QString & | heatMapUnit () const |
Returns the unit used for the current heat map. | |
Point2f & | heatMapBounds () |
Reference on the upper and lower bounds for the heat. | |
const Point2f & | heatMapBounds () const |
Return the upper and lower bounds for the heat. | |
IntSymTensorMap & | cellAxis () |
Return the mapping of tensors for each cell. More... | |
IntMatrix3x3fMap & | cellAxisScaled () |
Returns the map from label to cells axis (array of 3 Point3f), scaled for visualisation. | |
IntMatrix3x3fMap & | cellAxisColor () |
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 QString & | cellAxisType () const |
Return the type of the current cell axis. More... | |
QString & | cellAxisType () |
Return the type of the current cell axis. More... | |
const QString & | cellAxisUnit () const |
Unit for the length of the cell axis. | |
QString & | cellAxisUnit () |
Unit for the length of the cell axis. | |
void | clearCellAxis () |
Remove any cell axis. | |
IntMatrix3x3fMap & | vvCorrespondance () |
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. | |
QString & | signalUnit () |
Reference on the unit used for the signal. More... | |
const QString & | signalUnit () const |
Returns the unit used for the signal. | |
Point2f & | signalBounds () |
Reference on the upper and lower bounds for the signal. | |
const Point2f & | signalBounds () const |
Return the upper and lower bounds for the signal. | |
Friends | |
class | process::SetupProcess |
Structure | |
vvgraph & | graph () |
Get the VV graph representing the topology of the mesh. | |
const vvgraph & | graph () 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... | |
IntPoint3fMap & | labelCenter () |
Reference on the map from label to a position. More... | |
const IntPoint3fMap & | labelCenter () const |
Returns the map from label to position. | |
IntPoint3fMap & | labelNormal () |
Reference on the map from label to a normal. More... | |
const IntPoint3fMap & | labelNormal () const |
Returns the map from label to normal. | |
IntPoint3fMap & | labelCenterVis () |
Reference on the map from label to a position. More... | |
const IntPoint3fMap & | labelCenterVis () const |
Returns the map from label to position. | |
IntPoint3fMap & | labelNormalVis () |
Reference on the map from label to a normal. More... | |
const IntPoint3fMap & | labelNormalVis () const |
Returns the map from label to position. | |
IntPoint3fMap & | parentCenter () |
Reference on the map from parent label to a position. More... | |
const IntPoint3fMap & | parentCenter () const |
Returns the map from parent label to position. | |
IntPoint3fMap & | parentNormal () |
Reference on the map from parent label to a normal. More... | |
const IntPoint3fMap & | parentNormal () const |
Returns the map from parent label to normal. | |
IntPoint3fMap & | parentCenterVis () |
Reference on the map from parent label to a position. More... | |
const IntPoint3fMap & | parentCenterVis () const |
Returns the map from parent label to position. | |
IntPoint3fMap & | parentNormalVis () |
Reference on the map from parent label to a normal. More... | |
const IntPoint3fMap & | parentNormalVis () const |
Returns the map from parent label to position. | |
IntIntSetMap & | labelNeighbors () |
Reference on the map from labels to the set of neighbor labels. More... | |
const IntIntSetMap & | labelNeighbors () const |
Returns the map from labels to the set of neighbors labels. | |
IntIntVIdSetMap & | wallVId () |
Reference on the map from each wall to the list of vertexes in the wall. More... | |
const IntIntVIdSetMap & | wallVId () const |
Returns the map from each wall to the list of vertexes in the wall. | |
IntIntFloatMap & | wallGeom () |
Reference on the map from each wall to the length of the wall. More... | |
const IntIntFloatMap & | wallGeom () 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< vertex > | selectedVertices () const |
Returns a vector with the list of selected vertices. | |
std::vector< vertex > | activeVertices () 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. | |
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.
enum mgx::Mesh::Color |
enum mgx::Mesh::MeshView |
Enumeration of the possible visualisations for the Mesh.
enum mgx::Mesh::SurfView |
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.
|
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.
|
inline |
Return the type of the current cell axis.
If an empty string, there is no cell axis.
|
inline |
Return the type of the current cell axis.
If an empty string, there is no cell axis.
|
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:
|
inline |
True if the mesh is empty (i.e.
the graph is empty)
|
inline |
Reference on the unit used for the current heat map.
It is shown on the color bar.
|
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.
|
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.
|
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.
|
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.
|
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...).
|
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...).
|
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.
|
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.
|
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...).
|
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.
|
inline |
Set if the mesh has a cell structure.
This means that some vertexes correspond to cell centers and other the junctions.
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.
|
inline |
Change the id of the mesh.
Please do not use this method for meshes attached to a process.
|
inline |
Update the normal of the vertex v
in the mesh.
Returns false if the normal cannot be computed
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
Set the name of the parent label file.
This is called when the parent labels are loaded or saved.
|
inline |
Set the current color to be the signal (i.e.
intensity) on each triangle
|
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.
|
inline |
Reference on the unit used for the signal.
It is shown on the color bar.
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.
borderSize | Distance from the wall up to which the triangles are considered part of the wall. This is important mostly for signal intensity. |
|
inline |
Id as seen by the user.
This is, typically id()+1
|
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.
|
inline |
Reference on the map from wall (i.e.
pair of vertex id) to intensity
|
inline |
Returns the map from wall (i.e.
pair of vertex id) to intensity
|
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.