MorphoGraphX
Mesh.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef MESH_HPP
12 #define MESH_HPP
13 
20 #include <Config.hpp>
21 
22 #include <cuda/CudaExport.hpp>
23 #include <EdgeData.hpp>
24 #include <Geometry.hpp>
25 #include <Stack.hpp>
26 #include <SymmetricTensor.hpp>
27 #include <TransferFunction.hpp>
28 #include <UnorderedMap.hpp>
29 #include <UnorderedSet.hpp>
30 #include <VertexData.hpp>
31 #include <VVGraph.hpp>
32 
33 #include <map>
34 #include <omp.h>
35 #include <QImage>
36 #include <QString>
37 #include <set>
38 #include <string.h>
39 #include <typeinfo>
40 
41 namespace mgx {
42 
47 
50 
53 
54  typedef unsigned short ushort;
55  typedef unsigned int uint;
56  typedef unsigned long ulong;
57 
58  typedef util::Color<float> Colorf;
59 
61 
63  typedef std::map<int, Point3f> IntPoint3fMap;
64  typedef std::unordered_map<int, Point3f> IntPoint3fUMap;
66  typedef std::pair<int, Point3f> IntPoint3fPair;
68  typedef std::map<int, float> IntFloatMap;
69  typedef std::unordered_map<int, float> IntFloatUMap;
71  typedef std::pair<int, float> IntFloatPair;
73  typedef std::map<int, int> IntIntMap;
74  typedef std::unordered_map<int, int> IntIntUMap;
76  typedef std::pair<int, int> IntIntPair;
78  typedef std::map<int, HVec3U> IntHVec3uMap;
79  typedef std::unordered_map<int, HVec3U> IntHVec3uUMap;
81  typedef std::pair<int, HVec3U> IntHVec3uPair;
83  typedef std::set<ulong> VIdSet;
84  typedef std::unordered_set<ulong> VIdUSet;
86  typedef std::set<vertex> VtxSet;
87  typedef std::unordered_set<vertex> VtxUSet;
89  typedef std::vector<vertex> VtxVec;
91  typedef std::vector<vvgraph> VVGraphVec;
93  typedef std::pair<int, vvgraph> IntVVGraphPair;
95  typedef std::map<int, vvgraph> IntVVGraphMap;
96  typedef std::unordered_map<int, vvgraph> IntVVGraphUMap;
98  typedef std::map<int, VIdSet> IntVIdSetMap;
99  typedef std::unordered_map<int, VIdSet> IntVIdSetUMap;
101  typedef std::pair<int, VIdSet> IntVIdSetPair;
103  typedef std::set<int> IntSet;
104  typedef std::unordered_set<int> IntUSet;
106  typedef std::vector<int> IntVec;
108  typedef std::vector<float> FloatVec;
110  typedef std::pair<int, IntSet> IntIntSetPair;
112  typedef std::map<int, IntSet> IntIntSetMap;
113  typedef std::unordered_map<int, IntSet> IntIntSetUMap;
115  typedef std::map<vertex, int> VIntMap;
116  typedef std::unordered_map<vertex, int> VIntUMap;
118  typedef std::pair<IntIntPair, VIdSet> IntIntVIdSetPair;
120  typedef std::pair<IntIntPair, float> IntIntFloatPair;
122  typedef std::map<IntIntPair, float> IntIntFloatMap;
123  typedef std::unordered_map<IntIntPair, float> IntIntFloatUMap;
125  typedef std::map<IntIntPair, VIdSet> IntIntVIdSetMap;
126  typedef std::unordered_map<IntIntPair, VIdSet> IntIntVIdSetUMap;
128  typedef std::map<int, Matrix3f> IntMatrix3x3fMap;
129  typedef std::unordered_map<int, Matrix3f> IntMatrix3x3fUMap;
131  typedef std::pair<int, Matrix3f> IntMatrix3x3fPair;
133  typedef std::map<int, util::SymmetricTensor> IntSymTensorMap;
134  typedef std::unordered_map<int, util::SymmetricTensor> IntSymTensorUMap;
136  typedef std::pair<int, util::SymmetricTensor> IntSymTensorPair;
138  typedef std::map<vertex, vertex> VtxVtxMap;
139  typedef std::unordered_map<vertex, vertex> VtxVtxUMap;
140 }
141 
142 namespace std {
143 #ifdef HASH_NEED_TR1
144 namespace tr1 {
145 #endif
146 
147 template <typename T1, typename T2> struct hash<std::pair<T1, T2> > {
148  size_t operator()(const std::pair<T1, T2>& v) const
149  {
150  std::hash<T1> h1;
151  std::hash<T2> h2;
152  return h1(v.first) ^ h2(v.second);
153  }
154 };
155 
156 #ifdef HASH_NEED_TR1
157 } // namspace tr1
158 #endif
159 } // namespace std
160 
161 namespace mgx {
162 
163  namespace process {
164  class SetupProcess;
165  }
166 
177  class mgx_EXPORT Mesh {
178  friend class process::SetupProcess;
179 
180  public:
184  enum SurfView {
188  PARENT
189  };
190 
194  enum MeshView {
198  SELECTED_MESH
199  };
200 
204  enum Color {
207  IMAGE
208  };
209 
213  Mesh(const Stack* stack);
214 
218  Mesh(int id, const Stack* stack);
219 
223  Mesh(const Mesh& copy);
224 
228  ~Mesh();
229 
231 
239  int id() const {
240  return _id;
241  }
242 
248  void setId(int i) {
249  _id = i;
250  }
251 
257  int userId() const {
258  return _id + 1;
259  }
260 
264  const Stack* stack() const {
265  return _stack;
266  }
267 
268  // For now, a mesh is always with the same stack
269  void setStack(const Stack* s);
270 
274  const QString& file() const {
275  return _file;
276  }
277 
281  const QString& parentFile() const {
282  return _parentFile;
283  }
284 
291  void setFile(const QString& file = QString());
292 
298  void setParentFile(const QString& file = QString());
299 
303  bool scaled() const {
304  return _scaled;
305  }
306 
310  void setScaled(bool on = true) {
311  _scaled = on;
312  }
313 
317  bool transformed() const {
318  return _transformed;
319  }
323  void setTransformed(bool on = true) {
324  _transformed = on;
325  }
326 
330  bool showBBox() const {
331  return _showBBox;
332  }
333 
337  void setShowBBox(bool on = true) {
338  _showBBox = on;
339  }
340 
344  int viewLabel() const {
345  return _currLabel;
346  }
350  void setLabel(int l)
351  {
352  changed_label = true;
353  _currLabel = l;
354  }
358  int nextLabel()
359  {
360  changed_label = true;
361  return ++_currLabel;
362  }
366  bool labelChanged() const {
367  return changed_label;
368  }
369 
374  return _parentLabel;
375  }
379  const IntIntMap& parentLabelMap() const {
380  return _parentLabel;
381  }
388  bool cells() const {
389  return _cells;
390  }
397  void setCells(bool value = true) {
398  _cells = value;
399  }
400 
408  void reset();
409 
411 
413 
419  return S;
420  }
424  const vvgraph& graph() const {
425  return S;
426  }
430  bool empty() const {
431  return S.empty();
432  }
436  size_t size() const {
437  return S.size();
438  }
439 
443  int getLabel(vertex v1, vertex v2, vertex v3, bool useParentLabel = true) const;
444 
451  bool uniqueTri(const vertex& v, const vertex& n, const vertex& m) const
452  {
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))
454  return false;
455  else
456  return true;
457  }
458 
464  bool setNormal(vertex v) {
465  return setNormal(S, v);
466  }
467 
473  static bool setNormal(vvgraph& S, vertex v);
474 
480  bool setNormals();
481 
490  return _labelCenter;
491  }
495  const IntPoint3fMap& labelCenter() const {
496  return _labelCenter;
497  }
498 
507  return _labelNormal;
508  }
512  const IntPoint3fMap& labelNormal() const {
513  return _labelNormal;
514  }
523  return _labelCenterVis;
524  }
528  const IntPoint3fMap& labelCenterVis() const {
529  return _labelCenterVis;
530  }
531 
540  return _labelNormalVis;
541  }
545  const IntPoint3fMap& labelNormalVis() const {
546  return _labelNormalVis;
547  }
548 
557  return _parentCenter;
558  }
562  const IntPoint3fMap& parentCenter() const {
563  return _parentCenter;
564  }
565 
574  return _parentNormal;
575  }
579  const IntPoint3fMap& parentNormal() const {
580  return _parentNormal;
581  }
590  return _parentCenterVis;
591  }
596  return _parentCenterVis;
597  }
598 
607  return _parentNormalVis;
608  }
613  return _parentNormalVis;
614  }
615 
625  return _labelNeighbors;
626  }
630  const IntIntSetMap& labelNeighbors() const {
631  return _labelNeighbors;
632  }
644  return _wallVId;
645  }
649  const IntIntVIdSetMap& wallVId() const {
650  return _wallVId;
651  }
662  return _wallGeom;
663  }
667  const IntIntFloatMap& wallGeom() const {
668  return _wallGeom;
669  }
670 
676  void updateWallGeometry(float borderSize);
677 
683  bool isBordTriangle(int label, vertex v, vertex n, vertex m, IntIntPair& rp) const;
684 
689  void markBorder(float borderSize);
690 
695  void updateCentersNormals();
696 
700  void prepareAxisDrawing(float scaleAxisLength, Colorf colorPositive, Colorf colorNegative,
701  const Point3b& showAxis = Point3b(true, true, true)); // ,float DisplayThreshold)
702 
704 
706 
711  return _surf_fct;
712  }
717  {
718  if(_surf_fct != f) {
719  _surf_fct = f;
720  changed_surf_function = true;
721  }
722  }
727  bool surfFctChanged() const {
728  return changed_surf_function;
729  }
730 
735  return _heat_fct;
736  }
741  {
742  if(_heat_fct != f) {
743  _heat_fct = f;
744  changed_heat_function = true;
745  }
746  }
751  bool heatFctChanged() const {
752  return changed_heat_function;
753  }
754 
758  float opacity() const {
759  return _opacity;
760  }
764  void setOpacity(float f)
765  {
766  if(f < 0)
767  _opacity = 0;
768  else if(f > 1)
769  _opacity = 1;
770  else
771  _opacity = f;
772  }
776  float brightness() const {
777  return _brightness;
778  }
782  void setBrightness(float f)
783  {
784  if(f < 0)
785  _brightness = 0;
786  else if(f > 1)
787  _brightness = 1;
788  else
789  _brightness = f;
790  }
791 
795  bool isSurfaceVisible() const {
796  return _isSurfaceVisible;
797  }
801  void showSurface() {
802  _isSurfaceVisible = true;
803  }
807  void hideSurface() {
808  _isSurfaceVisible = false;
809  }
810 
814  void showNormal() {
815  _show = NORMAL;
816  }
820  void showLabel() {
821  _show = LABEL;
822  }
826  void showHeat() {
827  _show = HEAT;
828  }
832  void showParent() {
833  _show = PARENT;
834  }
835 
839  void show(SurfView view) {
840  _show = view;
841  }
842 
846  void showSignal() {
847  _color = SIGNAL;
848  }
856  void showTexture() {
857  _color = TEXTURE;
858  }
859 
863  void showImage() {
864  _color = IMAGE;
865  }
866 
870  void show(Color color) {
871  _color = color;
872  }
873 
877  bool culling() const {
878  return _culling;
879  }
883  void setCulling(bool cul) {
884  _culling = cul;
885  }
886 
890  bool blending() const {
891  return _blending;
892  }
896  void setBlending(bool b) {
897  _blending = b;
898  }
899 
903  SurfView toShow() const {
904  return _show;
905  }
909  Color coloring() const {
910  return _color;
911  }
912 
916  bool hasImgTex() const {
917  return _imgtex;
918  }
922  const QImage& imgTex() const {
923  return _image;
924  }
928  void setImgTex(const QImage& img)
929  {
930  _imgtex = true;
931  _image = img;
932  }
936  void clearImgTex()
937  {
938  _imgtex = false;
939  _image = QImage();
940  }
941 
943 
945 
949  bool isMeshVisible() const {
950  return _isMeshVisible;
951  }
955  void showMesh() {
956  _isMeshVisible = true;
957  }
961  void hideMesh() {
962  _isMeshVisible = false;
963  }
964 
968  MeshView meshView() const {
969  return _meshView;
970  }
971 
975  void showAllMesh() {
976  _meshView = ALL_MESH;
977  }
981  void showCellMesh() {
982  _meshView = CELL_MESH;
983  }
987  void showBorderMesh() {
988  _meshView = BORDER_MESH;
989  }
994  _meshView = SELECTED_MESH;
995  }
996 
1000  void show(MeshView view) {
1001  _meshView = view;
1002  }
1003 
1007  bool showMeshLines() const {
1008  return _showMeshLines;
1009  }
1013  bool showMeshPoints() const {
1014  return _showMeshPoints;
1015  }
1019  bool showMeshCellMap() const {
1020  return _showMeshCellMap;
1021  }
1022 
1026  void setShowMesh(bool show) {
1027  _isMeshVisible = show;
1028  }
1032  void setShowMeshLines(bool show) {
1033  _showMeshLines = show;
1034  }
1038  void setShowMeshPoints(bool show) {
1039  _showMeshPoints = show;
1040  }
1044  void setShowMeshCellMap(bool show) {
1045  _showMeshCellMap = show;
1046  }
1047 
1051  std::vector<vertex> selectedVertices() const;
1052 
1058  std::vector<vertex> activeVertices() const;
1059 
1060  // These next two should really be algorithms for the graph as they don't rely on
1061  // any Mesh variables.
1065  void getConnectedVertices(const vvgraph& S, vvgraph& vSet) const;
1066 
1070  int getConnectedRegions(const vvgraph& S, VVGraphVec& cellVId, VIntMap& vtxCell) const;
1071 
1075  static void getNhbd(const vvgraph& S, const vertex& v, float radius, VtxSet& nbs);
1076 
1087  void correctSelection(bool inclusive);
1088 
1090 
1092 
1096  void updateAll();
1100  void updateTriangles();
1104  void updateLines();
1108  void updatePositions();
1112  void updateSelection();
1115  int changes() const {
1116  return _changed;
1117  }
1119 
1121 
1132  return _labelHeat;
1133  }
1136  const IntFloatMap& labelHeat() const {
1137  return _labelHeat;
1138  }
1142  return _wallHeat;
1143  }
1146  const IntIntFloatMap& wallHeat() const {
1147  return _wallHeat;
1148  }
1155  return _heatMapUnit;
1156  }
1158  const QString& heatMapUnit() const {
1159  return _heatMapUnit;
1160  }
1163  return _heatMapBounds;
1164  }
1166  const Point2f& heatMapBounds() const {
1167  return _heatMapBounds;
1168  }
1169 
1177  return _cellAxis;
1178  }
1179 
1184  return _cellAxisScaled;
1185  } // added by ALR
1186 
1191  return _cellAxisColor;
1192  } // added by ALR
1193 
1196  float& cellAxisWidth() {
1197  return _cellAxisWidth;
1198  } // added by ALR
1201  float& cellAxisOffset() {
1202  return _cellAxisOffset;
1203  }
1209  const QString& cellAxisType() const {
1210  return _cellAxisType;
1211  }
1218  return _cellAxisType;
1219  }
1223  const QString& cellAxisUnit() const {
1224  return _cellAxisUnit;
1225  }
1230  return _cellAxisUnit;
1231  }
1235  void clearCellAxis();
1239  return _VVCorrespondance;
1240  } // added by ALR
1244  return _showVVCorrespondance;
1245  } // added by ALR
1246 
1248 
1250 
1261  return _signalUnit;
1262  }
1264  const QString& signalUnit() const {
1265  return _signalUnit;
1266  }
1269  return _signalBounds;
1270  }
1272  const Point2f& signalBounds() const {
1273  return _signalBounds;
1274  }
1276 
1277  bool needsColorbar() const
1278  {
1279  return (isSurfaceVisible() and ((toShow() == HEAT and (_labelHeat.size() > 1 or _wallHeat.size() > 1))
1280  or (toShow() == NORMAL and coloring() == SIGNAL)));
1281  }
1282 
1283  const BoundingBox3f& boundingBox() const {
1284  return _bbox;
1285  }
1286  BoundingBox3f& boundingBox() {
1287  return _bbox;
1288  }
1289  void setBoundingBox(const BoundingBox3f& bbox) {
1290  _bbox = bbox;
1291  }
1292  void updateBBox();
1293 
1294  private:
1295  void resetModified();
1296 
1297  vvgraph S;
1298  TransferFunction _surf_fct, _heat_fct;
1299  IntFloatMap _labelHeat;
1300  IntIntFloatMap _wallHeat;
1301  IntPoint3fMap _labelCenter;
1302  IntPoint3fMap _labelCenterVis;
1303  IntPoint3fMap _labelNormal;
1304  IntPoint3fMap _labelNormalVis;
1305  IntPoint3fMap _parentCenter;
1306  IntPoint3fMap _parentCenterVis;
1307  IntPoint3fMap _parentNormal;
1308  IntPoint3fMap _parentNormalVis;
1309  IntSymTensorMap _cellAxis;
1310  IntMatrix3x3fMap _cellAxisScaled;
1311  IntMatrix3x3fMap _cellAxisColor;
1312  float _cellAxisWidth;
1313  float _cellAxisOffset;
1314  QString _cellAxisType;
1315  QString _cellAxisUnit;
1316  IntMatrix3x3fMap _VVCorrespondance;
1317  bool _showVVCorrespondance;
1318  IntIntSetMap _labelNeighbors;
1319  IntIntVIdSetMap _wallVId;
1320  IntIntFloatMap _wallGeom;
1321  QString _signalUnit, _heatMapUnit;
1322  Point2f _signalBounds, _heatMapBounds;
1323  bool changed_surf_function, changed_heat_function;
1324  bool changed_label;
1325  int _changed;
1326  SurfView _show;
1327  Color _color;
1328  bool _culling, _blending;
1329  bool _isSurfaceVisible, _isMeshVisible;
1330  int _currLabel;
1331  IntIntMap _parentLabel;
1332  float _opacity, _brightness;
1333  MeshView _meshView;
1334  bool _showMeshLines, _showMeshPoints, _showMeshCellMap;
1335  bool _cells, _imgtex;
1336  QString _file;
1337  QString _parentFile;
1338  bool _scaled;
1339  bool _transformed;
1340  bool _showBBox;
1341  int _id;
1342  const Stack* _stack;
1343  QImage _image;
1344 
1345  BoundingBox3f _bbox;
1346 
1347  void init();
1348  };
1349 }
1350 
1351 #endif
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
STL namespace.
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