12 #include <cuda/CudaExport.hpp>
16 #include <SymmetricTensor.hpp>
17 #include <TransferFunction.hpp>
18 #include <UnorderedMap.hpp>
19 #include <UnorderedSet.hpp>
44 typedef unsigned short ushort;
45 typedef unsigned int uint;
46 typedef unsigned long ulong;
54 typedef std::unordered_map<int, Point3f> IntPoint3fUMap;
59 typedef std::unordered_map<int, float> IntFloatUMap;
64 typedef std::unordered_map<int, int> IntIntUMap;
69 typedef std::unordered_map<int, HVec3U> IntHVec3uUMap;
74 typedef std::unordered_set<ulong> VIdUSet;
77 typedef std::unordered_set<vertex> VtxUSet;
86 typedef std::unordered_map<int, vvgraph> IntVVGraphUMap;
89 typedef std::unordered_map<int, VIdSet> IntVIdSetUMap;
94 typedef std::unordered_set<int> IntUSet;
103 typedef std::unordered_map<int, IntSet> IntIntSetUMap;
106 typedef std::unordered_map<vertex, int> VIntUMap;
113 typedef std::unordered_map<IntIntPair, float> IntIntFloatUMap;
116 typedef std::unordered_map<IntIntPair, VIdSet> IntIntVIdSetUMap;
119 typedef std::unordered_map<int, Matrix3f> IntMatrix3x3fUMap;
124 typedef std::unordered_map<int, util::SymmetricTensor> IntSymTensorUMap;
129 typedef std::unordered_map<vertex, vertex> VtxVtxUMap;
137 template <
typename T1,
typename T2>
struct hash<std::pair<T1, T2> > {
138 size_t operator()(
const std::pair<T1, T2>& v)
const
142 return h1(v.first) ^ h2(v.second);
168 friend class process::SetupProcess;
259 void setStack(
const Stack* s);
342 changed_label =
true;
350 changed_label =
true;
357 return changed_label;
443 if(v <= n or v <= m or n == m or !S.edge(v, n) or !S.edge(v, m) or !S.edge(n, m))
455 return setNormal(S, v);
513 return _labelCenterVis;
519 return _labelCenterVis;
530 return _labelNormalVis;
536 return _labelNormalVis;
547 return _parentCenter;
553 return _parentCenter;
564 return _parentNormal;
570 return _parentNormal;
580 return _parentCenterVis;
586 return _parentCenterVis;
597 return _parentNormalVis;
603 return _parentNormalVis;
615 return _labelNeighbors;
621 return _labelNeighbors;
666 void updateWallGeometry(
float borderSize);
679 void markBorder(
float borderSize);
685 void updateCentersNormals();
690 void prepareAxisDrawing(
float scaleAxisLength,
Colorf colorPositive,
Colorf colorNegative,
710 changed_surf_function =
true;
718 return changed_surf_function;
734 changed_heat_function =
true;
742 return changed_heat_function;
786 return _isSurfaceVisible;
792 _isSurfaceVisible =
true;
798 _isSurfaceVisible =
false;
940 return _isMeshVisible;
946 _isMeshVisible =
true;
952 _isMeshVisible =
false;
966 _meshView = ALL_MESH;
972 _meshView = CELL_MESH;
978 _meshView = BORDER_MESH;
984 _meshView = SELECTED_MESH;
998 return _showMeshLines;
1004 return _showMeshPoints;
1010 return _showMeshCellMap;
1017 _isMeshVisible = show;
1023 _showMeshLines = show;
1029 _showMeshPoints = show;
1035 _showMeshCellMap = show;
1041 std::vector<vertex> selectedVertices()
const;
1048 std::vector<vertex> activeVertices()
const;
1055 void getConnectedVertices(
const vvgraph& S,
vvgraph& vSet)
const;
1077 void correctSelection(
bool inclusive);
1090 void updateTriangles();
1098 void updatePositions();
1102 void updateSelection();
1145 return _heatMapUnit;
1149 return _heatMapUnit;
1153 return _heatMapBounds;
1157 return _heatMapBounds;
1174 return _cellAxisScaled;
1181 return _cellAxisColor;
1187 return _cellAxisWidth;
1192 return _cellAxisOffset;
1200 return _cellAxisType;
1208 return _cellAxisType;
1214 return _cellAxisUnit;
1220 return _cellAxisUnit;
1225 void clearCellAxis();
1229 return _VVCorrespondance;
1234 return _showVVCorrespondance;
1259 return _signalBounds;
1263 return _signalBounds;
1267 bool needsColorbar()
const
1269 return (isSurfaceVisible() and ((toShow() == HEAT and (_labelHeat.size() > 1 or _wallHeat.size() > 1))
1270 or (toShow() == NORMAL and coloring() == SIGNAL)));
1273 const BoundingBox3f& boundingBox()
const {
1276 BoundingBox3f& boundingBox() {
1279 void setBoundingBox(
const BoundingBox3f& bbox) {
1285 void resetModified();
1288 TransferFunction _surf_fct, _heat_fct;
1302 float _cellAxisWidth;
1303 float _cellAxisOffset;
1307 bool _showVVCorrespondance;
1311 QString _signalUnit, _heatMapUnit;
1312 Point2f _signalBounds, _heatMapBounds;
1313 bool changed_surf_function, changed_heat_function;
1318 bool _culling, _blending;
1319 bool _isSurfaceVisible, _isMeshVisible;
1322 float _opacity, _brightness;
1324 bool _showMeshLines, _showMeshPoints, _showMeshCellMap;
1325 bool _cells, _imgtex;
1332 const Stack* _stack;
1335 BoundingBox3f _bbox;
const IntIntVIdSetMap & wallVId() const
Returns the map from each wall to the list of vertexes in the wall.
Definition: Mesh.hpp:639
std::set< int > IntSet
Set of integers.
Definition: Mesh.hpp:93
bool cells() const
Returns true if the mesh has a cell structure.
Definition: Mesh.hpp:378
bool scaled() const
Returns true if the mesh is scaled.
Definition: Mesh.hpp:293
Color
Enumeration of the coloring modes possible to display a normal surface.
Definition: Mesh.hpp:194
Show the current heat map.
Definition: Mesh.hpp:177
Point2f & heatMapBounds()
Reference on the upper and lower bounds for the heat.
Definition: Mesh.hpp:1152
MeshView
Enumeration of the possible visualisations for the Mesh.
Definition: Mesh.hpp:184
std::pair< int, float > IntFloatPair
Element in IntFloatMap.
Definition: Mesh.hpp:61
std::map< int, Point3f > IntPoint3fMap
Map of an integer to a 3D point.
Definition: Mesh.hpp:53
void showSurface()
Show the surface to the user.
Definition: Mesh.hpp:791
std::pair< IntIntPair, VIdSet > IntIntVIdSetPair
Element in IntIntVIdSetMap.
Definition: Mesh.hpp:108
int id() const
Id of the current mesh.
Definition: Mesh.hpp:229
Edge of a vv graph.
Definition: Edge.hpp:35
std::map< int, HVec3U > IntHVec3uMap
Map of an integer to a host vector of 3 unsigned integers.
Definition: Mesh.hpp:68
void showParent()
Show the color of the surface.
Definition: Mesh.hpp:822
void setCulling(bool cul)
Cull the back surface.
Definition: Mesh.hpp:873
void setImgTex(const QImage &img)
Set the texture attached to the surface.
Definition: Mesh.hpp:918
void hideMesh()
Hide the mesh from the user.
Definition: Mesh.hpp:951
QString & signalUnit()
Reference on the unit used for the signal.
Definition: Mesh.hpp:1250
bool transformed() const
Returns true if the mesh is transformed.
Definition: Mesh.hpp:307
std::set< vertex > VtxSet
Set of vertices.
Definition: Mesh.hpp:76
std::pair< int, VIdSet > IntVIdSetPair
Element in IntVIdSetMap.
Definition: Mesh.hpp:91
const QString & file() const
Returns the name of the mesh file.
Definition: Mesh.hpp:264
IntIntSetMap & labelNeighbors()
Reference on the map from labels to the set of neighbor labels.
Definition: Mesh.hpp:614
void setShowMesh(bool show)
Set if the mesh visible at all.
Definition: Mesh.hpp:1016
const IntIntFloatMap & wallHeat() const
Returns the map from wall (i.e.
Definition: Mesh.hpp:1136
IntMatrix3x3fMap & cellAxisScaled()
Returns the map from label to cells axis (array of 3 Point3f), scaled for visualisation.
Definition: Mesh.hpp:1173
std::map< IntIntPair, VIdSet > IntIntVIdSetMap
Map of a pair of integers to a set of vertex ids.
Definition: Mesh.hpp:115
const IntPoint3fMap & parentNormal() const
Returns the map from parent label to normal.
Definition: Mesh.hpp:569
IntIntFloatMap & wallGeom()
Reference on the map from each wall to the length of the wall.
Definition: Mesh.hpp:651
IntPoint3fMap & labelNormalVis()
Reference on the map from label to a normal.
Definition: Mesh.hpp:529
std::pair< int, IntSet > IntIntSetPair
Element in IntIntSetMap.
Definition: Mesh.hpp:100
std::map< IntIntPair, float > IntIntFloatMap
Map of a pair of integers to a float.
Definition: Mesh.hpp:112
This file contains the definition of a vertex.
bool labelChanged() const
Returns true if the curr label has been changed during this process.
Definition: Mesh.hpp:356
bool showMeshLines() const
Are mesh lines visible.
Definition: Mesh.hpp:997
std::map< int, float > IntFloatMap
Map of an integer to a float.
Definition: Mesh.hpp:58
QString & cellAxisType()
Return the type of the current cell axis.
Definition: Mesh.hpp:1207
const IntIntFloatMap & wallGeom() const
Reference on the map from each wall to the length of the wall.
Definition: Mesh.hpp:657
const QString & cellAxisType() const
Return the type of the current cell axis.
Definition: Mesh.hpp:1199
TransferFunction surfFct() const
Return the transfer function used to draw the surface in normal mode.
Definition: Mesh.hpp:700
void setShowMeshPoints(bool show)
Set if the mesh points are visible.
Definition: Mesh.hpp:1028
IntPoint3fMap & parentCenterVis()
Reference on the map from parent label to a position.
Definition: Mesh.hpp:579
void showAllMesh()
Set the mesh view to all.
Definition: Mesh.hpp:965
Show the whole mesh.
Definition: Mesh.hpp:185
IntPoint3fMap & labelNormal()
Reference on the map from label to a normal.
Definition: Mesh.hpp:496
Color using the signal stored on the vertices.
Definition: Mesh.hpp:195
void setBlending(bool b)
Set the blending attribute.
Definition: Mesh.hpp:886
const Stack * stack() const
Returns the stack associated to this mesh.
Definition: Mesh.hpp:254
IntMatrix3x3fMap & vvCorrespondance()
Returns a reference to the map of correspondence between vertices in mesh1 and mesh2 (store vertices ...
Definition: Mesh.hpp:1228
void setShowBBox(bool on=true)
Set if the bounding box is shown.
Definition: Mesh.hpp:327
size_t size() const
Returns the number of vertices in the mesh.
Definition: Mesh.hpp:426
void setId(int i)
Change the id of the mesh.
Definition: Mesh.hpp:238
bool surfFctChanged() const
Returns true if the normal transfer function has been changed during the current process.
Definition: Mesh.hpp:717
void setLabel(int l)
Sets the current label.
Definition: Mesh.hpp:340
const QString & signalUnit() const
Returns the unit used for the signal.
Definition: Mesh.hpp:1254
SurfView
Enumeration of the possible visualisations for the surface.
Definition: Mesh.hpp:174
std::map< int, util::SymmetricTensor > IntSymTensorMap
Map an integer to a symmetric tensor.
Definition: Mesh.hpp:123
void setSurfFct(const TransferFunction &f)
Change the transfer function used to draw the surface in normal mode.
Definition: Mesh.hpp:706
float brightness() const
Get the current brightness of the surface.
Definition: Mesh.hpp:766
void showBorderMesh()
Set the mesh view to mesh border only.
Definition: Mesh.hpp:977
bool isMeshVisible() const
Is the mesh currently visible to the user.
Definition: Mesh.hpp:939
bool hasImgTex() const
True if the surface has a texture attached to it.
Definition: Mesh.hpp:906
IntIntFloatMap & wallHeat()
Reference on the map from wall (i.e.
Definition: Mesh.hpp:1131
vvgraph & graph()
Get the VV graph representing the topology of the mesh.
Definition: Mesh.hpp:408
std::map< int, int > IntIntMap
Map of an integer to another one.
Definition: Mesh.hpp:63
void showSignal()
Set the current color to be the signal (i.e.
Definition: Mesh.hpp:836
Color coloring() const
Returns the current coloring for the surface.
Definition: Mesh.hpp:899
std::pair< int, util::SymmetricTensor > IntSymTensorPair
Element in IntSymTensorMap.
Definition: Mesh.hpp:126
void setHeatFct(const TransferFunction &f)
Change the transfer function used to draw the surface in heat mode.
Definition: Mesh.hpp:730
IntIntMap & parentLabelMap()
Reference on the map from each label to a label in a different mesh.
Definition: Mesh.hpp:363
std::pair< IntIntPair, float > IntIntFloatPair
Element in IntIntFloatMap.
Definition: Mesh.hpp:110
SurfView toShow() const
Returns the current visualisation for the surface.
Definition: Mesh.hpp:893
const IntPoint3fMap & parentCenterVis() const
Returns the map from parent label to position.
Definition: Mesh.hpp:585
Show only the mesh border.
Definition: Mesh.hpp:186
std::map< int, VIdSet > IntVIdSetMap
Map of an integer to a set of vertex ids.
Definition: Mesh.hpp:88
const IntPoint3fMap & labelNormal() const
Returns the map from label to normal.
Definition: Mesh.hpp:502
void setOpacity(float f)
Change the current opactity level of the surface.
Definition: Mesh.hpp:754
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
bool blending() const
Return if the surface is rendered blended or not.
Definition: Mesh.hpp:880
graph::VVGraph< VertexData, EdgeData > vvgraph
Type of the VV graph holding the actual mesh.
Definition: Mesh.hpp:36
std::map< vertex, vertex > VtxVtxMap
Map of vertex to vertex.
Definition: Mesh.hpp:128
void hideSurface()
Hide the surface from the user.
Definition: Mesh.hpp:797
std::map< int, vvgraph > IntVVGraphMap
Map of an integer to a vvgraph.
Definition: Mesh.hpp:85
std::vector< int > IntVec
Vector of integers.
Definition: Mesh.hpp:96
bool showMeshCellMap() const
Are cell numbers visible.
Definition: Mesh.hpp:1009
Color using the 3D texture of the active stack.
Definition: Mesh.hpp:196
bool culling() const
Returns if the back surface is culled.
Definition: Mesh.hpp:867
std::pair< int, vvgraph > IntVVGraphPair
Integer, VVGraph pair.
Definition: Mesh.hpp:83
bool heatFctChanged() const
Returns true if the heat transfer function has been changed during the current process.
Definition: Mesh.hpp:741
const QString & cellAxisUnit() const
Unit for the length of the cell axis.
Definition: Mesh.hpp:1213
const Point2f & heatMapBounds() const
Return the upper and lower bounds for the heat.
Definition: Mesh.hpp:1156
Show the label of the triangles.
Definition: Mesh.hpp:176
void setShowMeshLines(bool show)
Set if the mesh lines are visible.
Definition: Mesh.hpp:1022
This file contains the definition of an edge data.
vvgraph::vertex_t vertex
Type of a vertex.
Definition: Mesh.hpp:39
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
const IntPoint3fMap & parentNormalVis() const
Returns the map from parent label to position.
Definition: Mesh.hpp:602
IntSymTensorMap & cellAxis()
Return the mapping of tensors for each cell.
Definition: Mesh.hpp:1166
IntFloatMap & labelHeat()
Reference on the map from label to intensity.
Definition: Mesh.hpp:1121
std::map< int, Matrix3f > IntMatrix3x3fMap
Map of an integer to a 3x3 matrix.
Definition: Mesh.hpp:118
Vertex of a vv graph.
Definition: Vertex.hpp:57
void showNormal()
Show the heat map of the surface, if any.
Definition: Mesh.hpp:804
void showCellMesh()
Set the mesh view to cell border only.
Definition: Mesh.hpp:971
Namespace containing all the utility classes.
Definition: Vector.hpp:37
bool showBBox() const
Returns true if the bounding box is shown.
Definition: Mesh.hpp:320
MeshView meshView() const
Return the current view mode for the mesh.
Definition: Mesh.hpp:958
void showLabel()
Show the labels of the surface triangles.
Definition: Mesh.hpp:810
const IntPoint3fMap & labelNormalVis() const
Returns the map from label to position.
Definition: Mesh.hpp:535
const QImage & imgTex() const
Get the current texture attached to the surface.
Definition: Mesh.hpp:912
std::pair< int, HVec3U > IntHVec3uPair
Element in IntHVec3uMap.
Definition: Mesh.hpp:71
bool setNormal(vertex v)
Update the normal of the vertex v in the mesh.
Definition: Mesh.hpp:454
bool & showVVCorrespondance()
Returns a boolean for visualization of lines between corresponding vertices.
Definition: Mesh.hpp:1233
void showImage()
Set the current color to be the texture attached to the mesh.
Definition: Mesh.hpp:853
const IntPoint3fMap & labelCenter() const
Returns the map from label to position.
Definition: Mesh.hpp:485
QString & cellAxisUnit()
Unit for the length of the cell axis.
Definition: Mesh.hpp:1219
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:25
IntIntVIdSetMap & wallVId()
Reference on the map from each wall to the list of vertexes in the wall.
Definition: Mesh.hpp:633
float opacity() const
Get the current opacity level of the surface.
Definition: Mesh.hpp:748
IntPoint3fMap & labelCenter()
Reference on the map from label to a position.
Definition: Mesh.hpp:479
Show the color option.
Definition: Mesh.hpp:175
std::pair< int, int > IntIntPair
Element in IntIntMap.
Definition: Mesh.hpp:66
const IntIntSetMap & labelNeighbors() const
Returns the map from labels to the set of neighbors labels.
Definition: Mesh.hpp:620
IntPoint3fMap & labelCenterVis()
Reference on the map from label to a position.
Definition: Mesh.hpp:512
const QString & heatMapUnit() const
Returns the unit used for the current heat map.
Definition: Mesh.hpp:1148
int userId() const
Id as seen by the user.
Definition: Mesh.hpp:247
bool showMeshPoints() const
Are mesh points visible.
Definition: Mesh.hpp:1003
void showHeat()
Show the color of the surface.
Definition: Mesh.hpp:816
std::set< ulong > VIdSet
Set of vertex ids.
Definition: Mesh.hpp:73
const QString & parentFile() const
Returns the name of the parent label file.
Definition: Mesh.hpp:271
void setShowMeshCellMap(bool show)
Set if the cell numbers are visible.
Definition: Mesh.hpp:1034
void setScaled(bool on=true)
Set if the mesh is scaled.
Definition: Mesh.hpp:300
QString & heatMapUnit()
Reference on the unit used for the current heat map.
Definition: Mesh.hpp:1144
IntPoint3fMap & parentNormalVis()
Reference on the map from parent label to a normal.
Definition: Mesh.hpp:596
const IntIntMap & parentLabelMap() const
Const reference on the map from each label to a label in a different mesh.
Definition: Mesh.hpp:369
void show(MeshView view)
Change the mesh view mode.
Definition: Mesh.hpp:990
void showMesh()
Make the mesh visible to the user.
Definition: Mesh.hpp:945
std::map< vertex, int > VIntMap
Map of a vertex to an integer.
Definition: Mesh.hpp:105
const IntFloatMap & labelHeat() const
Returns the map from label to intensity.
Definition: Mesh.hpp:1126
void show(Color color)
Change the color mode.
Definition: Mesh.hpp:860
void showTexture()
Set the current color to be the 3D texture at the position of the point.
Definition: Mesh.hpp:846
const IntPoint3fMap & labelCenterVis() const
Returns the map from label to position.
Definition: Mesh.hpp:518
std::vector< float > FloatVec
Vector of floats.
Definition: Mesh.hpp:98
bool empty() const
True if the mesh is empty (i.e.
Definition: Mesh.hpp:420
int changes() const
Returns what changed in the current process.
Definition: Mesh.hpp:1105
Contain the definition of the VVGraph template class.
const IntPoint3fMap & parentCenter() const
Returns the map from parent label to position.
Definition: Mesh.hpp:552
int viewLabel() const
Returns the current label, without modifying it.
Definition: Mesh.hpp:334
void showSelectedMesh()
Set the mesh view to selected mesh only.
Definition: Mesh.hpp:983
IntPoint3fMap & parentNormal()
Reference on the map from parent label to a normal.
Definition: Mesh.hpp:563
void show(SurfView view)
Change the view mode.
Definition: Mesh.hpp:829
int nextLabel()
Increment the current label and return.
Definition: Mesh.hpp:348
std::vector< vvgraph > VVGraphVec
Vector of vvgraphs.
Definition: Mesh.hpp:81
bool uniqueTri(const vertex &v, const vertex &n, const vertex &m) const
Returns true if (v,n,m) correspond to a canonical triangle.
Definition: Mesh.hpp:441
void setTransformed(bool on=true)
Set if the mesh is transformed.
Definition: Mesh.hpp:313
TransferFunction heatFct() const
Return the transfer function used to draw the surface in heat mode.
Definition: Mesh.hpp:724
const vvgraph & graph() const
Get the VV graph representing the topology of the mesh.
Definition: Mesh.hpp:414
std::pair< int, Point3f > IntPoint3fPair
Element in IntPoint3fMap.
Definition: Mesh.hpp:56
std::vector< vertex > VtxVec
Vector of vertices.
Definition: Mesh.hpp:79
bool isSurfaceVisible() const
True if the surface is currently visible to the user.
Definition: Mesh.hpp:785
void clearImgTex()
Remove any texture attached to the surface.
Definition: Mesh.hpp:926
std::pair< int, Matrix3f > IntMatrix3x3fPair
Element in IntMatrix3x3fMap.
Definition: Mesh.hpp:121
Class defining a transfer function as linear interpolation between set values.
Definition: TransferFunction.hpp:23
IntPoint3fMap & parentCenter()
Reference on the map from parent label to a position.
Definition: Mesh.hpp:546
const Point2f & signalBounds() const
Return the upper and lower bounds for the signal.
Definition: Mesh.hpp:1262
float & cellAxisWidth()
Returns the cell axis width.
Definition: Mesh.hpp:1186
IntMatrix3x3fMap & cellAxisColor()
Returns the map from label to cells axis colors (array of 3 Point3f)
Definition: Mesh.hpp:1180
vvgraph::edge_t edge
Type of an edge.
Definition: Mesh.hpp:42
void setBrightness(float f)
Change the current brightness of the surface.
Definition: Mesh.hpp:772
void setCells(bool value=true)
Set if the mesh has a cell structure.
Definition: Mesh.hpp:387
Point2f & signalBounds()
Reference on the upper and lower bounds for the signal.
Definition: Mesh.hpp:1258
std::map< int, IntSet > IntIntSetMap
Map of an integer to a set of integers.
Definition: Mesh.hpp:102
float & cellAxisOffset()
Returns a reference to the cell axis z-offset for drawing.
Definition: Mesh.hpp:1191
Show only the cell borders (i.e. interface between labels)
Definition: Mesh.hpp:187