22 #include <cuda/CudaExport.hpp> 26 #include <SymmetricTensor.hpp> 27 #include <TransferFunction.hpp> 28 #include <UnorderedMap.hpp> 29 #include <UnorderedSet.hpp> 54 typedef unsigned short ushort;
55 typedef unsigned int uint;
56 typedef unsigned long ulong;
64 typedef std::unordered_map<int, Point3f> IntPoint3fUMap;
69 typedef std::unordered_map<int, float> IntFloatUMap;
74 typedef std::unordered_map<int, int> IntIntUMap;
79 typedef std::unordered_map<int, HVec3U> IntHVec3uUMap;
84 typedef std::unordered_set<ulong> VIdUSet;
87 typedef std::unordered_set<vertex> VtxUSet;
96 typedef std::unordered_map<int, vvgraph> IntVVGraphUMap;
99 typedef std::unordered_map<int, VIdSet> IntVIdSetUMap;
104 typedef std::unordered_set<int> IntUSet;
113 typedef std::unordered_map<int, IntSet> IntIntSetUMap;
116 typedef std::unordered_map<vertex, int> VIntUMap;
123 typedef std::unordered_map<IntIntPair, float> IntIntFloatUMap;
126 typedef std::unordered_map<IntIntPair, VIdSet> IntIntVIdSetUMap;
129 typedef std::unordered_map<int, Matrix3f> IntMatrix3x3fUMap;
134 typedef std::unordered_map<int, util::SymmetricTensor> IntSymTensorUMap;
139 typedef std::unordered_map<vertex, vertex> VtxVtxUMap;
147 template <
typename T1,
typename T2>
struct hash<
std::pair<T1, T2> > {
148 size_t operator()(
const std::pair<T1, T2>& v)
const 152 return h1(v.first) ^ h2(v.second);
178 friend class process::SetupProcess;
269 void setStack(
const Stack* s);
352 changed_label =
true;
360 changed_label =
true;
367 return changed_label;
453 if(v <= n or v <= m or n == m or !S.edge(v, n) or !S.edge(v, m) or !S.edge(n, m))
465 return setNormal(S, v);
523 return _labelCenterVis;
529 return _labelCenterVis;
540 return _labelNormalVis;
546 return _labelNormalVis;
557 return _parentCenter;
563 return _parentCenter;
574 return _parentNormal;
580 return _parentNormal;
590 return _parentCenterVis;
596 return _parentCenterVis;
607 return _parentNormalVis;
613 return _parentNormalVis;
625 return _labelNeighbors;
631 return _labelNeighbors;
676 void updateWallGeometry(
float borderSize);
689 void markBorder(
float borderSize);
695 void updateCentersNormals();
700 void prepareAxisDrawing(
float scaleAxisLength,
Colorf colorPositive,
Colorf colorNegative,
720 changed_surf_function =
true;
728 return changed_surf_function;
744 changed_heat_function =
true;
752 return changed_heat_function;
796 return _isSurfaceVisible;
802 _isSurfaceVisible =
true;
808 _isSurfaceVisible =
false;
950 return _isMeshVisible;
956 _isMeshVisible =
true;
962 _isMeshVisible =
false;
976 _meshView = ALL_MESH;
982 _meshView = CELL_MESH;
988 _meshView = BORDER_MESH;
994 _meshView = SELECTED_MESH;
1008 return _showMeshLines;
1014 return _showMeshPoints;
1020 return _showMeshCellMap;
1027 _isMeshVisible = show;
1033 _showMeshLines = show;
1039 _showMeshPoints = show;
1045 _showMeshCellMap = show;
1051 std::vector<vertex> selectedVertices()
const;
1058 std::vector<vertex> activeVertices()
const;
1065 void getConnectedVertices(
const vvgraph& S,
vvgraph& vSet)
const;
1087 void correctSelection(
bool inclusive);
1100 void updateTriangles();
1108 void updatePositions();
1112 void updateSelection();
1155 return _heatMapUnit;
1159 return _heatMapUnit;
1163 return _heatMapBounds;
1167 return _heatMapBounds;
1184 return _cellAxisScaled;
1191 return _cellAxisColor;
1197 return _cellAxisWidth;
1202 return _cellAxisOffset;
1210 return _cellAxisType;
1218 return _cellAxisType;
1224 return _cellAxisUnit;
1230 return _cellAxisUnit;
1235 void clearCellAxis();
1239 return _VVCorrespondance;
1244 return _showVVCorrespondance;
1269 return _signalBounds;
1273 return _signalBounds;
1277 bool needsColorbar()
const 1279 return (isSurfaceVisible() and ((toShow() == HEAT and (_labelHeat.size() > 1 or _wallHeat.size() > 1))
1280 or (toShow() == NORMAL and coloring() == SIGNAL)));
1295 void resetModified();
1312 float _cellAxisWidth;
1313 float _cellAxisOffset;
1317 bool _showVVCorrespondance;
1321 QString _signalUnit, _heatMapUnit;
1322 Point2f _signalBounds, _heatMapBounds;
1323 bool changed_surf_function, changed_heat_function;
1328 bool _culling, _blending;
1329 bool _isSurfaceVisible, _isMeshVisible;
1332 float _opacity, _brightness;
1334 bool _showMeshLines, _showMeshPoints, _showMeshCellMap;
1335 bool _cells, _imgtex;
1342 const Stack* _stack;
const IntIntVIdSetMap & wallVId() const
Returns the map from each wall to the list of vertexes in the wall.
Definition: Mesh.hpp:649
std::set< int > IntSet
Set of integers.
Definition: Mesh.hpp:103
bool cells() const
Returns true if the mesh has a cell structure.
Definition: Mesh.hpp:388
bool scaled() const
Returns true if the mesh is scaled.
Definition: Mesh.hpp:303
Color
Enumeration of the coloring modes possible to display a normal surface.
Definition: Mesh.hpp:204
Show the current heat map.
Definition: Mesh.hpp:187
Point2f & heatMapBounds()
Reference on the upper and lower bounds for the heat.
Definition: Mesh.hpp:1162
MeshView
Enumeration of the possible visualisations for the Mesh.
Definition: Mesh.hpp:194
std::pair< int, float > IntFloatPair
Element in IntFloatMap.
Definition: Mesh.hpp:71
std::map< int, Point3f > IntPoint3fMap
Map of an integer to a 3D point.
Definition: Mesh.hpp:63
void showSurface()
Show the surface to the user.
Definition: Mesh.hpp:801
std::pair< IntIntPair, VIdSet > IntIntVIdSetPair
Element in IntIntVIdSetMap.
Definition: Mesh.hpp:118
int id() const
Id of the current mesh.
Definition: Mesh.hpp:239
Edge of a vv graph.
Definition: Edge.hpp:45
std::map< int, HVec3U > IntHVec3uMap
Map of an integer to a host vector of 3 unsigned integers.
Definition: Mesh.hpp:78
void showParent()
Show the color of the surface.
Definition: Mesh.hpp:832
void setCulling(bool cul)
Cull the back surface.
Definition: Mesh.hpp:883
void setImgTex(const QImage &img)
Set the texture attached to the surface.
Definition: Mesh.hpp:928
void hideMesh()
Hide the mesh from the user.
Definition: Mesh.hpp:961
QString & signalUnit()
Reference on the unit used for the signal.
Definition: Mesh.hpp:1260
bool transformed() const
Returns true if the mesh is transformed.
Definition: Mesh.hpp:317
std::set< vertex > VtxSet
Set of vertices.
Definition: Mesh.hpp:86
std::pair< int, VIdSet > IntVIdSetPair
Element in IntVIdSetMap.
Definition: Mesh.hpp:101
const QString & file() const
Returns the name of the mesh file.
Definition: Mesh.hpp:274
IntIntSetMap & labelNeighbors()
Reference on the map from labels to the set of neighbor labels.
Definition: Mesh.hpp:624
void setShowMesh(bool show)
Set if the mesh visible at all.
Definition: Mesh.hpp:1026
const IntIntFloatMap & wallHeat() const
Returns the map from wall (i.e.
Definition: Mesh.hpp:1146
IntMatrix3x3fMap & cellAxisScaled()
Returns the map from label to cells axis (array of 3 Point3f), scaled for visualisation.
Definition: Mesh.hpp:1183
std::map< IntIntPair, VIdSet > IntIntVIdSetMap
Map of a pair of integers to a set of vertex ids.
Definition: Mesh.hpp:125
const IntPoint3fMap & parentNormal() const
Returns the map from parent label to normal.
Definition: Mesh.hpp:579
IntIntFloatMap & wallGeom()
Reference on the map from each wall to the length of the wall.
Definition: Mesh.hpp:661
IntPoint3fMap & labelNormalVis()
Reference on the map from label to a normal.
Definition: Mesh.hpp:539
std::pair< int, IntSet > IntIntSetPair
Element in IntIntSetMap.
Definition: Mesh.hpp:110
std::map< IntIntPair, float > IntIntFloatMap
Map of a pair of integers to a float.
Definition: Mesh.hpp:122
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:366
bool showMeshLines() const
Are mesh lines visible.
Definition: Mesh.hpp:1007
std::map< int, float > IntFloatMap
Map of an integer to a float.
Definition: Mesh.hpp:68
QString & cellAxisType()
Return the type of the current cell axis.
Definition: Mesh.hpp:1217
const IntIntFloatMap & wallGeom() const
Reference on the map from each wall to the length of the wall.
Definition: Mesh.hpp:667
const QString & cellAxisType() const
Return the type of the current cell axis.
Definition: Mesh.hpp:1209
TransferFunction surfFct() const
Return the transfer function used to draw the surface in normal mode.
Definition: Mesh.hpp:710
void setShowMeshPoints(bool show)
Set if the mesh points are visible.
Definition: Mesh.hpp:1038
IntPoint3fMap & parentCenterVis()
Reference on the map from parent label to a position.
Definition: Mesh.hpp:589
void showAllMesh()
Set the mesh view to all.
Definition: Mesh.hpp:975
Show the whole mesh.
Definition: Mesh.hpp:195
IntPoint3fMap & labelNormal()
Reference on the map from label to a normal.
Definition: Mesh.hpp:506
Color using the signal stored on the vertices.
Definition: Mesh.hpp:205
void setBlending(bool b)
Set the blending attribute.
Definition: Mesh.hpp:896
const Stack * stack() const
Returns the stack associated to this mesh.
Definition: Mesh.hpp:264
IntMatrix3x3fMap & vvCorrespondance()
Returns a reference to the map of correspondence between vertices in mesh1 and mesh2 (store vertices ...
Definition: Mesh.hpp:1238
void setShowBBox(bool on=true)
Set if the bounding box is shown.
Definition: Mesh.hpp:337
size_t size() const
Returns the number of vertices in the mesh.
Definition: Mesh.hpp:436
void setId(int i)
Change the id of the mesh.
Definition: Mesh.hpp:248
bool surfFctChanged() const
Returns true if the normal transfer function has been changed during the current process.
Definition: Mesh.hpp:727
void setLabel(int l)
Sets the current label.
Definition: Mesh.hpp:350
const QString & signalUnit() const
Returns the unit used for the signal.
Definition: Mesh.hpp:1264
SurfView
Enumeration of the possible visualisations for the surface.
Definition: Mesh.hpp:184
std::map< int, util::SymmetricTensor > IntSymTensorMap
Map an integer to a symmetric tensor.
Definition: Mesh.hpp:133
void setSurfFct(const TransferFunction &f)
Change the transfer function used to draw the surface in normal mode.
Definition: Mesh.hpp:716
float brightness() const
Get the current brightness of the surface.
Definition: Mesh.hpp:776
void showBorderMesh()
Set the mesh view to mesh border only.
Definition: Mesh.hpp:987
bool isMeshVisible() const
Is the mesh currently visible to the user.
Definition: Mesh.hpp:949
bool hasImgTex() const
True if the surface has a texture attached to it.
Definition: Mesh.hpp:916
IntIntFloatMap & wallHeat()
Reference on the map from wall (i.e.
Definition: Mesh.hpp:1141
vvgraph & graph()
Get the VV graph representing the topology of the mesh.
Definition: Mesh.hpp:418
std::map< int, int > IntIntMap
Map of an integer to another one.
Definition: Mesh.hpp:73
void showSignal()
Set the current color to be the signal (i.e.
Definition: Mesh.hpp:846
Color coloring() const
Returns the current coloring for the surface.
Definition: Mesh.hpp:909
std::pair< int, util::SymmetricTensor > IntSymTensorPair
Element in IntSymTensorMap.
Definition: Mesh.hpp:136
void setHeatFct(const TransferFunction &f)
Change the transfer function used to draw the surface in heat mode.
Definition: Mesh.hpp:740
IntIntMap & parentLabelMap()
Reference on the map from each label to a label in a different mesh.
Definition: Mesh.hpp:373
std::pair< IntIntPair, float > IntIntFloatPair
Element in IntIntFloatMap.
Definition: Mesh.hpp:120
SurfView toShow() const
Returns the current visualisation for the surface.
Definition: Mesh.hpp:903
const IntPoint3fMap & parentCenterVis() const
Returns the map from parent label to position.
Definition: Mesh.hpp:595
Show only the mesh border.
Definition: Mesh.hpp:196
std::map< int, VIdSet > IntVIdSetMap
Map of an integer to a set of vertex ids.
Definition: Mesh.hpp:98
const IntPoint3fMap & labelNormal() const
Returns the map from label to normal.
Definition: Mesh.hpp:512
void setOpacity(float f)
Change the current opactity level of the surface.
Definition: Mesh.hpp:764
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:177
bool blending() const
Return if the surface is rendered blended or not.
Definition: Mesh.hpp:890
graph::VVGraph< VertexData, EdgeData > vvgraph
Type of the VV graph holding the actual mesh.
Definition: Mesh.hpp:46
std::map< vertex, vertex > VtxVtxMap
Map of vertex to vertex.
Definition: Mesh.hpp:138
void hideSurface()
Hide the surface from the user.
Definition: Mesh.hpp:807
std::map< int, vvgraph > IntVVGraphMap
Map of an integer to a vvgraph.
Definition: Mesh.hpp:95
std::vector< int > IntVec
Vector of integers.
Definition: Mesh.hpp:106
bool showMeshCellMap() const
Are cell numbers visible.
Definition: Mesh.hpp:1019
Color using the 3D texture of the active stack.
Definition: Mesh.hpp:206
bool culling() const
Returns if the back surface is culled.
Definition: Mesh.hpp:877
std::pair< int, vvgraph > IntVVGraphPair
Integer, VVGraph pair.
Definition: Mesh.hpp:93
bool heatFctChanged() const
Returns true if the heat transfer function has been changed during the current process.
Definition: Mesh.hpp:751
const QString & cellAxisUnit() const
Unit for the length of the cell axis.
Definition: Mesh.hpp:1223
const Point2f & heatMapBounds() const
Return the upper and lower bounds for the heat.
Definition: Mesh.hpp:1166
Show the label of the triangles.
Definition: Mesh.hpp:186
void setShowMeshLines(bool show)
Set if the mesh lines are visible.
Definition: Mesh.hpp:1032
This file contains the definition of an edge data.
vvgraph::vertex_t vertex
Type of a vertex.
Definition: Mesh.hpp:49
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:612
IntSymTensorMap & cellAxis()
Return the mapping of tensors for each cell.
Definition: Mesh.hpp:1176
IntFloatMap & labelHeat()
Reference on the map from label to intensity.
Definition: Mesh.hpp:1131
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
std::map< int, Matrix3f > IntMatrix3x3fMap
Map of an integer to a 3x3 matrix.
Definition: Mesh.hpp:128
Vertex of a vv graph.
Definition: Vertex.hpp:67
void showNormal()
Show the heat map of the surface, if any.
Definition: Mesh.hpp:814
void showCellMesh()
Set the mesh view to cell border only.
Definition: Mesh.hpp:981
Namespace containing all the utility classes.
Definition: Vector.hpp:47
bool showBBox() const
Returns true if the bounding box is shown.
Definition: Mesh.hpp:330
MeshView meshView() const
Return the current view mode for the mesh.
Definition: Mesh.hpp:968
void showLabel()
Show the labels of the surface triangles.
Definition: Mesh.hpp:820
const IntPoint3fMap & labelNormalVis() const
Returns the map from label to position.
Definition: Mesh.hpp:545
const QImage & imgTex() const
Get the current texture attached to the surface.
Definition: Mesh.hpp:922
std::pair< int, HVec3U > IntHVec3uPair
Element in IntHVec3uMap.
Definition: Mesh.hpp:81
bool setNormal(vertex v)
Update the normal of the vertex v in the mesh.
Definition: Mesh.hpp:464
bool & showVVCorrespondance()
Returns a boolean for visualization of lines between corresponding vertices.
Definition: Mesh.hpp:1243
void showImage()
Set the current color to be the texture attached to the mesh.
Definition: Mesh.hpp:863
const IntPoint3fMap & labelCenter() const
Returns the map from label to position.
Definition: Mesh.hpp:495
QString & cellAxisUnit()
Unit for the length of the cell axis.
Definition: Mesh.hpp:1229
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:35
IntIntVIdSetMap & wallVId()
Reference on the map from each wall to the list of vertexes in the wall.
Definition: Mesh.hpp:643
float opacity() const
Get the current opacity level of the surface.
Definition: Mesh.hpp:758
IntPoint3fMap & labelCenter()
Reference on the map from label to a position.
Definition: Mesh.hpp:489
Show the color option.
Definition: Mesh.hpp:185
std::pair< int, int > IntIntPair
Element in IntIntMap.
Definition: Mesh.hpp:76
const IntIntSetMap & labelNeighbors() const
Returns the map from labels to the set of neighbors labels.
Definition: Mesh.hpp:630
IntPoint3fMap & labelCenterVis()
Reference on the map from label to a position.
Definition: Mesh.hpp:522
const QString & heatMapUnit() const
Returns the unit used for the current heat map.
Definition: Mesh.hpp:1158
int userId() const
Id as seen by the user.
Definition: Mesh.hpp:257
bool showMeshPoints() const
Are mesh points visible.
Definition: Mesh.hpp:1013
void showHeat()
Show the color of the surface.
Definition: Mesh.hpp:826
std::set< ulong > VIdSet
Set of vertex ids.
Definition: Mesh.hpp:83
const QString & parentFile() const
Returns the name of the parent label file.
Definition: Mesh.hpp:281
This namespace contains all the classes needed to define processes.
void setShowMeshCellMap(bool show)
Set if the cell numbers are visible.
Definition: Mesh.hpp:1044
void setScaled(bool on=true)
Set if the mesh is scaled.
Definition: Mesh.hpp:310
QString & heatMapUnit()
Reference on the unit used for the current heat map.
Definition: Mesh.hpp:1154
IntPoint3fMap & parentNormalVis()
Reference on the map from parent label to a normal.
Definition: Mesh.hpp:606
const IntIntMap & parentLabelMap() const
Const reference on the map from each label to a label in a different mesh.
Definition: Mesh.hpp:379
void show(MeshView view)
Change the mesh view mode.
Definition: Mesh.hpp:1000
void showMesh()
Make the mesh visible to the user.
Definition: Mesh.hpp:955
std::map< vertex, int > VIntMap
Map of a vertex to an integer.
Definition: Mesh.hpp:115
const IntFloatMap & labelHeat() const
Returns the map from label to intensity.
Definition: Mesh.hpp:1136
void show(Color color)
Change the color mode.
Definition: Mesh.hpp:870
void showTexture()
Set the current color to be the 3D texture at the position of the point.
Definition: Mesh.hpp:856
const IntPoint3fMap & labelCenterVis() const
Returns the map from label to position.
Definition: Mesh.hpp:528
std::vector< float > FloatVec
Vector of floats.
Definition: Mesh.hpp:108
bool empty() const
True if the mesh is empty (i.e.
Definition: Mesh.hpp:430
int changes() const
Returns what changed in the current process.
Definition: Mesh.hpp:1115
Contain the definition of the VVGraph template class.
const IntPoint3fMap & parentCenter() const
Returns the map from parent label to position.
Definition: Mesh.hpp:562
int viewLabel() const
Returns the current label, without modifying it.
Definition: Mesh.hpp:344
void showSelectedMesh()
Set the mesh view to selected mesh only.
Definition: Mesh.hpp:993
IntPoint3fMap & parentNormal()
Reference on the map from parent label to a normal.
Definition: Mesh.hpp:573
void show(SurfView view)
Change the view mode.
Definition: Mesh.hpp:839
int nextLabel()
Increment the current label and return.
Definition: Mesh.hpp:358
std::vector< vvgraph > VVGraphVec
Vector of vvgraphs.
Definition: Mesh.hpp:91
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:451
void setTransformed(bool on=true)
Set if the mesh is transformed.
Definition: Mesh.hpp:323
TransferFunction heatFct() const
Return the transfer function used to draw the surface in heat mode.
Definition: Mesh.hpp:734
const vvgraph & graph() const
Get the VV graph representing the topology of the mesh.
Definition: Mesh.hpp:424
std::pair< int, Point3f > IntPoint3fPair
Element in IntPoint3fMap.
Definition: Mesh.hpp:66
std::vector< vertex > VtxVec
Vector of vertices.
Definition: Mesh.hpp:89
bool isSurfaceVisible() const
True if the surface is currently visible to the user.
Definition: Mesh.hpp:795
void clearImgTex()
Remove any texture attached to the surface.
Definition: Mesh.hpp:936
std::pair< int, Matrix3f > IntMatrix3x3fPair
Element in IntMatrix3x3fMap.
Definition: Mesh.hpp:131
Class defining a transfer function as linear interpolation between set values.
Definition: TransferFunction.hpp:33
IntPoint3fMap & parentCenter()
Reference on the map from parent label to a position.
Definition: Mesh.hpp:556
const Point2f & signalBounds() const
Return the upper and lower bounds for the signal.
Definition: Mesh.hpp:1272
float & cellAxisWidth()
Returns the cell axis width.
Definition: Mesh.hpp:1196
IntMatrix3x3fMap & cellAxisColor()
Returns the map from label to cells axis colors (array of 3 Point3f)
Definition: Mesh.hpp:1190
vvgraph::edge_t edge
Type of an edge.
Definition: Mesh.hpp:52
void setBrightness(float f)
Change the current brightness of the surface.
Definition: Mesh.hpp:782
void setCells(bool value=true)
Set if the mesh has a cell structure.
Definition: Mesh.hpp:397
Point2f & signalBounds()
Reference on the upper and lower bounds for the signal.
Definition: Mesh.hpp:1268
std::map< int, IntSet > IntIntSetMap
Map of an integer to a set of integers.
Definition: Mesh.hpp:112
float & cellAxisOffset()
Returns a reference to the cell axis z-offset for drawing.
Definition: Mesh.hpp:1201
Show only the cell borders (i.e. interface between labels)
Definition: Mesh.hpp:197