MorphoGraphX  2.0-1-227
MeshProcessMeasures.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_PROCESS_MEASURES_HPP
12 #define MESH_PROCESS_MEASURES_HPP
13 
14 #include <Process.hpp>
15 #include <Progress.hpp>
16 #include <Information.hpp>
17 
18 #include <limits>
19 
20 namespace mgx
21 {
22  typedef std::pair<vertex, vertex> VertexPr;
23  typedef std::set<vertex> Set;
24  typedef std::pair<VertexPr, Set> VertexPrSet;
25  //typedef std::pair<int, int> IntInt;
26 
27 
28  class mgxBase_EXPORT MeasureSignal : public Process
29  {
30 
31  public:
32  MeasureSignal(const Process& process) : Process(process)
33  {
34  setName("Mesh/Heat Map/Measures/Signal/Signal Parameters");
35  setDesc("Generate heat map based on signal for the current mesh");
36  setIcon(QIcon(":/images/MakeHeatMap.png"));
37 
38  addParm("Type","Type of signal","Cell Total", QStringList() << "Cell Total" << "Cell Border" << "Cell Interior" << "Cell Border/Total" << "Cell Interior/Total" << "Cell Border/Interior"); // 0
39  addParm("Average","Count the signal average or total?","Yes",booleanChoice());
40  addParm("Border Size","Size of the cell border","1.0");
41 
42  }
43 
44  bool run()
45  {
46  if(!checkState().mesh(MESH_ANY))
47  return false;
48  Mesh *mesh = currentMesh();
49  return run(mesh, mesh->labelHeat(), parm("Type"), stringToBool(parm("Average")), parm("Border Size").toDouble());
50 
51  }
52 
53  bool run(Mesh* mesh, IntFloatAttr& heatMap, QString type, bool signalAvg, double borderSize);
54 
55  };
56 
57  class mgxBase_EXPORT MeasureSignalBorder : public Process
58  {
59 
60  public:
61  MeasureSignalBorder(const Process& process) : Process(process)
62  {
63  setName("Mesh/Heat Map/Measures/Signal/Signal Border");
64  setDesc("Generate heat map based on signal close to the cell border for the current mesh");
65  setIcon(QIcon(":/images/MakeHeatMap.png"));
66  }
67 
68  bool run()
69  {
70  if(!checkState().mesh(MESH_ANY))
71  return false;
72  Mesh *mesh = currentMesh();
73  return run(mesh, mesh->labelHeat());
74 
75  }
76 
77  bool run(Mesh* mesh, IntFloatAttr& heatMap);
78 
79  };
80 
81  class mgxBase_EXPORT MeasureSignalInterior : public Process
82  {
83 
84  public:
85  MeasureSignalInterior(const Process& process) : Process(process)
86  {
87  setName("Mesh/Heat Map/Measures/Signal/Signal Interior");
88  setDesc("Generate heat map based on signal in the cell interior for the current mesh");
89  setIcon(QIcon(":/images/MakeHeatMap.png"));
90  }
91 
92  bool run()
93  {
94  if(!checkState().mesh(MESH_ANY))
95  return false;
96  Mesh *mesh = currentMesh();
97  return run(mesh, mesh->labelHeat());
98 
99  }
100 
101  bool run(Mesh* mesh, IntFloatAttr& heatMap);
102 
103  };
104 
105  class mgxBase_EXPORT MeasureSignalTotal : public Process
106  {
107 
108  public:
109  MeasureSignalTotal(const Process& process) : Process(process)
110  {
111  setName("Mesh/Heat Map/Measures/Signal/Signal Total");
112  setDesc("Generate heat map based on signal in the cells of the current mesh");
113  setIcon(QIcon(":/images/MakeHeatMap.png"));
114  }
115 
116  bool run()
117  {
118  if(!checkState().mesh(MESH_ANY))
119  return false;
120  Mesh *mesh = currentMesh();
121  return run(mesh, mesh->labelHeat());
122 
123  }
124 
125  bool run(Mesh* mesh, IntFloatAttr& heatMap);
126 
127  };
128 
129  class mgxBase_EXPORT MeasureArea : public Process
130  {
131  public:
132  MeasureArea(const Process& process) : Process(process)
133  {
134  setName("Mesh/Heat Map/Measures/Geometry/Area");
135  setDesc("Computes area of cells on the mesh.");
136  setIcon(QIcon(":/images/MakeHeatMap.png"));
137  }
138 
139  void calculateArea(vvGraph &S, IntFloatAttr& heatMap);
140 
141  bool run()
142  {
143  if(!checkState().mesh(MESH_ANY))
144  return false;
145  Mesh *mesh = currentMesh();
146  return run(mesh, mesh->labelHeat());
147 
148  }
149 
150  bool run(Mesh* mesh, IntFloatAttr& heatMap);
151 
152  };
153 
154  class mgxBase_EXPORT MeasurePerimeter : public Process
155  {
156  public:
157  MeasurePerimeter(const Process& process) : Process(process)
158  {
159  setName("Mesh/Heat Map/Measures/Geometry/Perimeter");
160  setDesc("Computes the perimeter of cells on the mesh");
161  setIcon(QIcon(":/images/MakeHeatMap.png"));
162  }
163 
164  void calculatePerimeter(vvGraph& S, IntFloatAttr& heatMap);
165 
166  bool run()
167  {
168  if(!checkState().mesh(MESH_ANY))
169  return false;
170  Mesh *mesh = currentMesh();
171  return run(mesh, mesh->labelHeat());
172  }
173 
174  bool run(Mesh* mesh, IntFloatAttr& heatMap);
175  };
176 
177  class mgxBase_EXPORT MeasureBending : public Process
178  {
179  public:
180  MeasureBending(const Process& process) : Process(process)
181  {
182  setName("Mesh/Heat Map/ToBeDeleted/Measures/Shape/Bending");
183  setDesc("Computes bending of cells on the mesh.\n"
184  "adds up the norm of the scalar product of the border segments.");
185  setIcon(QIcon(":/images/MakeHeatMap.png"));
186  }
187 
188  void calculateBending(vvGraph &S, IntFloatAttr& heatMap);
189 
190  bool run()
191  {
192  if(!checkState().mesh(MESH_ANY))
193  return false;
194  Mesh *mesh = currentMesh();
195  return run(mesh, mesh->labelHeat());
196  }
197 
198  bool run(Mesh* mesh, IntFloatAttr& heatMap);
199 
200  };
201 
202  class mgxBase_EXPORT MeasureStomatalBending : public Process
203  {
204  public:
205  MeasureStomatalBending(const Process& process) : Process(process)
206  {
207  setName("Mesh/Heat Map/ToBeDeleted/Measures/Shape/Common Bending");
208  setDesc("Computes bending of a cell together with its closest neighbor on the mesh");
209  setIcon(QIcon(":/images/MakeHeatMap.png"));
210  }
211 
212  void calculateStomatalBending(vvGraph& T, IntFloatAttr& heatMap);
213 
214  bool run()
215  {
216  if(!checkState().mesh(MESH_ANY))
217  return false;
218  Mesh *mesh = currentMesh();
219  return run(mesh, mesh->labelHeat());
220  }
221 
222  bool run(Mesh* mesh, IntFloatAttr& heatMap);
223 
224  };
225 
226  class mgxBase_EXPORT MeasureAspectRatio : public Process
227  {
228  public:
229  MeasureAspectRatio(const Process& process) : Process(process)
230  {
231  setName("Mesh/Heat Map/Measures/Geometry/Aspect Ratio");
232  setDesc("Computes the ratio of the length of the major over the minor axis of the cells by using the PCA Shape Analysis 2D process in Cell Axis");
233  setIcon(QIcon(":/images/MakeHeatMap.png"));
234  }
235 
236  void calculateAspectRatio(vvGraph& S, IntFloatAttr& heatMap);
237  bool run(IntFloatAttr& heatMap);
238 
239  bool run()
240  {
241  if(!checkState().mesh(MESH_ANY))
242  return false;
243  Mesh *mesh = currentMesh();
244  return run(mesh, mesh->labelHeat());
245  }
246 
247 /* bool run(Mesh* mesh){
248  return run(mesh, mesh->labelHeat());
249  }*/
250 
251  bool run(Mesh* mesh, IntFloatAttr& heatMap);
252 
253  };
254 
255  class mgxBase_EXPORT MeasureMajorAxis : public Process
256  {
257  public:
258  MeasureMajorAxis(const Process& process) : Process(process)
259  {
260  setName("Mesh/Heat Map/Measures/Geometry/Length Major Axis");
261  setDesc("Computes the length of the major axis of the cells by using the PCA Shape Analysis 2D process in Cell Axis");
262  setIcon(QIcon(":/images/MakeHeatMap.png"));
263  }
264 
265  bool run(IntFloatAttr& heatMap);
266 
267  bool run()
268  {
269  if(!checkState().mesh(MESH_ANY))
270  return false;
271  Mesh *mesh = currentMesh();
272  return run(mesh, mesh->labelHeat());
273  }
274 
275  bool run(Mesh* mesh, IntFloatAttr& heatMap);
276 
277  };
278 
279 
280  class mgxBase_EXPORT MeasureMinorAxis : public Process
281  {
282  public:
283  MeasureMinorAxis(const Process& process) : Process(process)
284  {
285  setName("Mesh/Heat Map/Measures/Geometry/Length Minor Axis");
286  setDesc("Computes the length of the minor axis of the cells by using the PCA Shape Analysis 2D process in Cell Axis");
287  setIcon(QIcon(":/images/MakeHeatMap.png"));
288  }
289 
290  bool run(IntFloatAttr& heatMap);
291 
292  bool run()
293  {
294  if(!checkState().mesh(MESH_ANY))
295  return false;
296  Mesh *mesh = currentMesh();
297  return run(mesh, mesh->labelHeat());
298  }
299 
300  bool run(Mesh* mesh, IntFloatAttr& heatMap);
301 
302  };
303 
304  class mgxBase_EXPORT MeasureNeighbors : public Process
305  {
306  public:
307  MeasureNeighbors(const Process& process) : Process(process)
308  {
309  setName("Mesh/Heat Map/Measures/Network/Neighbors");
310  setDesc("Computes the number of neighbors of cells");
311  setIcon(QIcon(":/images/MakeHeatMap.png"));
312  }
313 
314  void findNeighbourVertices(vvGraph& S, std::map<int, std::set<vertex> > &Nhbr);
315 
316  void calculateNeighbors(vvGraph& S, IntFloatAttr& heatMap);
317 
318  bool run()
319  {
320  if(!checkState().mesh(MESH_ANY))
321  return false;
322  Mesh *mesh = currentMesh();
323  return run(mesh, mesh->labelHeat());
324  }
325 
326  bool run(Mesh* mesh, IntFloatAttr& heatMap);
327 
328  };
329 
330  class mgxBase_EXPORT MeasureMinRadius : public Process
331  {
332  public:
333  MeasureMinRadius(const Process& process) : Process(process)
334  {
335  setName("Mesh/Heat Map/Measures/Geometry/Minimum Radius");
336  setDesc("Computes the minimum distance from the cell center to the border");
337  setIcon(QIcon(":/images/MakeHeatMap.png"));
338  }
339 
340  bool run()
341  {
342  if(!checkState().mesh(MESH_ANY))
343  return false;
344  Mesh *mesh = currentMesh();
345  return run(mesh, mesh->labelHeat());
346  }
347 
348  bool run(Mesh* mesh, IntFloatAttr& heatMap);
349 
350  };
351 
352  class mgxBase_EXPORT MeasureMaxRadius : public Process
353  {
354  public:
355  MeasureMaxRadius(const Process& process) : Process(process)
356  {
357  setName("Mesh/Heat Map/Measures/Geometry/Maximum Radius");
358  setDesc("Computes the maximum distance from the cell center to the border");
359  setIcon(QIcon(":/images/MakeHeatMap.png"));
360  }
361 
362  bool run()
363  {
364  if(!checkState().mesh(MESH_ANY))
365  return false;
366  Mesh *mesh = currentMesh();
367  return run(mesh, mesh->labelHeat());
368  }
369 
370  bool run(Mesh* mesh, IntFloatAttr& heatMap);
371 
372  };
373 
374  class mgxBase_EXPORT MeasureAvgRadius : public Process
375  {
376  public:
377  MeasureAvgRadius(const Process& process) : Process(process)
378  {
379  setName("Mesh/Heat Map/Measures/Geometry/Average Radius");
380  setDesc("Computes the average distance from the cell center to the border");
381  setIcon(QIcon(":/images/MakeHeatMap.png"));
382  }
383 
384  bool run()
385  {
386  if(!checkState().mesh(MESH_ANY))
387  return false;
388  Mesh *mesh = currentMesh();
389  return run(mesh, mesh->labelHeat());
390  }
391 
392  bool run(Mesh* mesh, IntFloatAttr& heatMap);
393 
394  };
395 
396  class mgxBase_EXPORT MeasureDistanceToMesh : public Process
397  {
398  public:
399  MeasureDistanceToMesh(const Process& process) : Process(process)
400  {
401  setName("Mesh/Heat Map/Measures/Location/Distance to Mesh");
402  setDesc("Computes the closest distance to the other mesh");
403  setIcon(QIcon(":/images/MakeHeatMap.png"));
404  }
405 
406  bool run()
407  {
408  if(!checkState().mesh(MESH_ANY))
409  return false;
410  Mesh *m = currentMesh();
411  Mesh *m2 = mesh(1);
412  if(m == m2)
413  m2 = mesh(0);
414  Stack *s1 = currentStack();
415  Stack *s2 = stack(1);
416  if(s1 == s2)
417  s2 = stack(0);
418  return run(s1, s2, m, m2, m->labelHeat());
419  }
420 
421  bool run(const Stack *s1, const Stack *s2, Mesh* mesh, Mesh* m2, IntFloatAttr &data);
422 
423  };
424 
425  class mgxBase_EXPORT MeasureMajorAxisTheta : public Process
426  {
427  public:
428  MeasureMajorAxisTheta(const Process& process) : Process(process)
429  {
430  setName("Mesh/Heat Map/Measures/Location/Major Axis Theta");
431  setDesc("Computes the angle between the major axis of a cell and a reference direction");
432  setIcon(QIcon(":/images/MakeHeatMap.png"));
433 
434  addParm("Reference Direction","Reference Direction","X-Axis",QStringList() << "X-Axis" << "Y-Axis" << "Z-Axis" << "Custom X"<< "Custom Y"<< "Custom Z");
435  }
436 
437  bool run()
438  {
439  if(!checkState().mesh(MESH_ANY))
440  return false;
441  Mesh *mesh = currentMesh();
442  Stack *s1 = currentStack();
443  return run(s1, mesh, mesh->labelHeat(), parm("Reference Direction"));
444  }
445 
446  bool run(const Stack *s1, Mesh* mesh, IntFloatAttr& heatMap, QString refDir);
447 
448  };
449 
450  class mgxBase_EXPORT MeasureDistanceToBezier : public Process
451  {
452  public:
453  MeasureDistanceToBezier(const Process& process) : Process(process)
454  {
455  setName("Mesh/Heat Map/Measures/Location/Distance to Bezier");
456  setDesc("Computes for each cell the distance to a defined Bezier grid or line");
457  setIcon(QIcon(":/images/MakeHeatMap.png"));
458 
459  addParm("Consider Orientation","Consider Orientation","Yes",booleanChoice());
460  addParm("Reverse Orientation","Reverse Orientation","No",booleanChoice());
461  }
462  //void findNeighbourVertices(vvGraph& S, std::map<int, std::set<vertex> > &Nhbr);
463  //void calculateNeighbors(vvGraph& S, IntFloatAttr& heatMap);
464 
465  bool run()
466  {
467  if(!checkState().mesh(MESH_ANY))
468  return false;
469  Mesh *mesh = currentMesh();
470  Stack *s1 = currentStack();
471  return run(s1, mesh, mesh->labelHeat());
472  }
473 
474  bool run(const Stack *s1, Mesh* mesh, IntFloatAttr& heatMap);
475 
476  };
477 
478  class mgxBase_EXPORT MeasureBezierCoord : public Process
479  {
480  public:
481  MeasureBezierCoord(const Process& process) : Process(process)
482  {
483  setName("Mesh/Heat Map/Measures/Location/Bezier Coord");
484  setDesc("Computes for each cell centroid the nearest point on a Bezier grid or line and assigns it the Bezier coordinate");
485  setIcon(QIcon(":/images/MakeHeatMap.png"));
486 
487  addParm("Coordinate","Coordinate","X", QStringList() << "X" << "Y"); // 1
488  }
489 
490  bool run()
491  {
492  if(!checkState().mesh(MESH_ANY))
493  return false;
494  Mesh *mesh = currentMesh();
495  Stack *s1 = currentStack();
496  return run(s1, mesh, parm("Coordinate"), mesh->labelHeat());
497  }
498 
499  bool run(const Stack *s1, Mesh* mesh, QString bezCoord, IntFloatAttr& heatMap);
500  };
501 
502  class mgxBase_EXPORT MeasureBezierLineCoord : public Process
503  {
504  public:
505  MeasureBezierLineCoord(const Process& process) : Process(process)
506  {
507  setName("Mesh/Heat Map/Measures/Location/Bezier Line Coord");
508  setDesc("Computes for each cell centroid the nearest point on a Bezier grid or line and assigns it the Bezier coordinate");
509  setIcon(QIcon(":/images/MakeHeatMap.png"));
510 
511  addParm("Reverse Line","Reverse Line","No", booleanChoice()); // 1
512  }
513 
514  bool run()
515  {
516  if(!checkState().mesh(MESH_ANY))
517  return false;
518  Mesh *mesh = currentMesh();
519  Stack *s1 = currentStack();
520  return run(s1, mesh, stringToBool(parm("Reverse Line")), mesh->labelHeat());
521  }
522 
523  bool run(const Stack *s1, Mesh* mesh, bool reverse, IntFloatAttr& heatMap);
524  };
525 
526 
527 
528  class mgxBase_EXPORT MeasurePolarCoord : public Process
529  {
530  public:
531  MeasurePolarCoord(const Process& process) : Process(process)
532  {
533  setName("Mesh/Heat Map/Measures/Location/Polar Coord");
534  setDesc("Computes a position of cells according to a defined polar coordinate system.\n"
535  "This process writes all coordinates in attribute maps and shows the selected option as heat map.");
536  setIcon(QIcon(":/images/MakeHeatMap.png"));
537 
538  addParm("Central Axis","Central Axis","Z", QStringList() << "X" << "Y" << "Z"); // 1
539  addParm("Coordinate","Coordinate","Longitudinal", QStringList() << "Longitudinal" << "Radial" << "Circumferential"); // 1
540  }
541 
542  bool run()
543  {
544  if(!checkState().mesh(MESH_ANY))
545  return false;
546  Mesh *mesh = currentMesh();
547  Stack *s1 = currentStack();
548  return run(s1, mesh, parm("Central Axis"), parm("Coordinate"), mesh->labelHeat());
549  }
550 
551  bool run(const Stack *s1, Mesh* mesh, QString axis, QString coord, IntFloatAttr& heatMap);
552  };
553 
554  class mgxBase_EXPORT MeasureVariabilityRadius : public Process
555  {
556  public:
557  MeasureVariabilityRadius(const Process& process) : Process(process)
558  {
559  setName("Mesh/Heat Map/ToBeDeleted/Measures/Shape/Variability Radius");
560  setDesc("Computes variability of radius of 2 similar cells on the mesh");
561  setIcon(QIcon(":/images/MakeHeatMap.png"));
562  }
563 
564  void findCommonNeighbors(vvGraph& S, std::map<VertexPr, Set> &NhbrElem);
565 
566  void calculateVariabilityRadius(vvGraph& S, IntFloatAttr& heatMap);
567 
568  bool run()
569  {
570  if(!checkState().mesh(MESH_ANY))
571  return false;
572  Mesh *mesh = currentMesh();
573  return run(mesh, mesh->labelHeat());
574  }
575 
576  bool run(Mesh* mesh, IntFloatAttr& heatMap);
577 
578  };
579 
580  class mgxBase_EXPORT MeasureCommonNhbrs : public Process
581  {
582  public:
583  MeasureCommonNhbrs(const Process& process) : Process(process)
584  {
585  setName("Mesh/Heat Map/ToBeDeleted/Measures/Shape/Common Neighbors");
586  setDesc("Computes Common neighbors of 2 similar cells on the mesh");
587  setIcon(QIcon(":/images/MakeHeatMap.png"));
588  }
589 
590  void calculateCommonNhbrs(vvGraph& S, IntFloatAttr& heatMap);
591 
592  void calculateClosestNhbr(vvGraph& S, std::set<VertexPr> &NeighbourMap);
593 
594  bool run()
595  {
596  if(!checkState().mesh(MESH_ANY))
597  return false;
598  Mesh *mesh = currentMesh();
599  return run(mesh, mesh->labelHeat());
600  }
601 
602  bool run(Mesh* mesh, IntFloatAttr& heatMap);
603 
604  };
605 
606 
607  class mgxBase_EXPORT MeasureStomataArea : public Process
608  {
609  public:
610  MeasureStomataArea(const Process& process) : Process(process)
611  {
612  setName("Mesh/Heat Map/ToBeDeleted/Measures/Shape/Stomata Area");
613  setDesc("Computes Common neighbors of 2 similar cells on the mesh");
614  setIcon(QIcon(":/images/MakeHeatMap.png"));
615  }
616 
617  void calculateStomataArea(vvGraph& S, IntFloatAttr &heatMap);
618 
619  bool run()
620  {
621  if(!checkState().mesh(MESH_ANY))
622  return false;
623  Mesh *mesh = currentMesh();
624  return run(mesh, mesh->labelHeat());
625  }
626 
627  bool run(Mesh* mesh, IntFloatAttr &heatMap);
628 
629  };
630 
631  class mgxBase_EXPORT MeasureNeighborhoodArea : public Process
632  {
633  public:
634  MeasureNeighborhoodArea(const Process& process) : Process(process)
635  {
636  setName("Mesh/Heat Map/ToBeDeleted/Measures/Neighborhood/Area");
637  setDesc("Computes average area of neighborhood cells on the mesh");
638  setIcon(QIcon(":/images/MakeHeatMap.png"));
639  }
640 
641  bool run()
642  {
643  if(!checkState().mesh(MESH_ANY))
644  return false;
645  Mesh *mesh = currentMesh();
646  return run(mesh, mesh->labelHeat());
647  }
648 
649  bool run(Mesh* mesh, IntFloatAttr &heatMap);
650 
651  };
652 
653  class mgxBase_EXPORT MeasureNeighborhoodPerimeter : public Process
654  {
655  public:
656  MeasureNeighborhoodPerimeter(const Process& process) : Process(process)
657  {
658  setName("Mesh/Heat Map/ToBeDeleted/Measures/Neighborhood/Perimeter");
659  setDesc("Computes average perimeter of neighborhood cells on the mesh");
660  setIcon(QIcon(":/images/MakeHeatMap.png"));
661  }
662 
663  bool run()
664  {
665  if(!checkState().mesh(MESH_ANY))
666  return false;
667  Mesh *mesh = currentMesh();
668  return run(mesh, mesh->labelHeat());
669  }
670 
671  bool run(Mesh* mesh, IntFloatAttr &heatMap);
672 
673  };
674 
675  class mgxBase_EXPORT MeasureNeighborhoodAspectRatio : public Process
676  {
677  public:
678  MeasureNeighborhoodAspectRatio(const Process& process) : Process(process)
679  {
680  setName("Mesh/Heat Map/ToBeDeleted/Measures/Neighborhood/Aspect Ratio");
681  setDesc("Computes LenBr of cells on the mesh");
682  setIcon(QIcon(":/images/MakeHeatMap.png"));
683  }
684 
685  bool run(IntFloatAttr& heatMap);
686 
687  bool run()
688  {
689  if(!checkState().mesh(MESH_ANY))
690  return false;
691  Mesh *mesh = currentMesh();
692  return run(mesh, mesh->labelHeat());
693  }
694 
695  bool run(Mesh* mesh, IntFloatAttr& heatMap);
696 
697  };
698 
699  class mgxBase_EXPORT MeasureNeighborhoodNeighbors : public Process
700  {
701  public:
702  MeasureNeighborhoodNeighbors(const Process& process) : Process(process)
703  {
704  setName("Mesh/Heat Map/ToBeDeleted/Measures/Neighborhood/Neighbors");
705  setDesc("Computes neighbors of cells on the mesh");
706  setIcon(QIcon(":/images/MakeHeatMap.png"));
707  }
708 
709  bool run()
710  {
711  if(!checkState().mesh(MESH_ANY))
712  return false;
713  Mesh *mesh = currentMesh();
714  return run(mesh, mesh->labelHeat());
715  }
716 
717  bool run(Mesh* mesh, IntFloatAttr& heatMap);
718 
719  };
720 
721  class mgxBase_EXPORT MeasureNeighborhoodVariabilityRadius : public Process
722  {
723  public:
725  {
726  setName("Mesh/Heat Map/ToBeDeleted/Measures/Neighborhood/Variability Radius");
727  setDesc("Computes variability of radius of 2 similar cells on the mesh");
728  setIcon(QIcon(":/images/MakeHeatMap.png"));
729  }
730 
731  bool run()
732  {
733  if(!checkState().mesh(MESH_ANY))
734  return false;
735  Mesh *mesh = currentMesh();
736  return run(mesh, mesh->labelHeat());
737  }
738 
739  bool run(Mesh* mesh, IntFloatAttr& heatMap);
740 
741  };
742 
743  class mgxBase_EXPORT MeasureCellDistance : public Process
744  {
745  public:
746  MeasureCellDistance(const Process& process) : Process(process)
747  {
748  setName("Mesh/Heat Map/Measures/Location/Cell Distance");
749  setDesc("Computes the shortest path between selected cells and the remaining cells");
750  setIcon(QIcon(":/images/MakeHeatMap.png"));
751 
752  addParm("Wall Weights","Wall Weights","Euclidean", QStringList() << "1 / Wall Length" << "1" << "Euclidean"); // 0
753  addParm("Restrict connectivity to same cell type", "Restrict connectivity to same cell type", "No", booleanChoice());
754 
755  }
756 
757  bool run()
758  {
759  if(!checkState().mesh(MESH_ANY))
760  return false;
761  Mesh *mesh = currentMesh();
762  return run(mesh, parm("Wall Weights"), stringToBool(parm("Restrict connectivity to same cell type")), mesh->labelHeat());
763  }
764 
765  bool run(Mesh* mesh, QString weight, bool cellTypes, IntFloatAttr &heatmap);
766 
767  };
768 
769  class mgxBase_EXPORT MeasureCellCoord : public Process
770  {
771  public:
772  MeasureCellCoord(const Process& process) : Process(process)
773  {
774  setName("Mesh/Heat Map/Measures/Location/Cell Coordinate");
775  setDesc("Computes the shortest path between selected cells and the remaining cells");
776  setIcon(QIcon(":/images/MakeHeatMap.png"));
777 
778  addParm("Dimension","Dimension","X", QStringList() << "X" << "Y" << "Z" << "Distance Origin"); // 0
779 
780  }
781 
782  bool run()
783  {
784  if(!checkState().mesh(MESH_ANY))
785  return false;
786  Mesh *mesh = currentMesh();
787  Stack* s = currentStack();
788  return run(s, mesh, parm("Dimension"), mesh->labelHeat());
789  }
790 
791  bool run(Stack* s, Mesh* mesh, QString dim, IntFloatAttr &heatmap);
792 
793  };
794 
795 
796 
803  class mgxBase_EXPORT JunctionDistance : public Process
804  {
805  public:
806  JunctionDistance(const Process& process) : Process(process)
807  {
808  setName("Mesh/Heat Map/Measures/Geometry/Junction Distance");
809  setDesc("Calculates the distance between junctions of a cell.");
810  setIcon(QIcon(":/images/MakeHeatMap.png"));
811 
812  addParm("Mode","Min or Max","Min", QStringList() << "Min" << "Max");
813  addParm("Direct Junctions Only","Consider Only Direct Cell Junctions. If No then also neighboring cell junctions will be considered.","No",booleanChoice());
814  addParm("Ignore Border Cells","Heat values for border cells should be ignored for this Measure","Yes",booleanChoice());
815 
816  }
817 
818  bool run()
819  {
820  Mesh *m = currentMesh();
821  return run(m, parm("Mode"), stringToBool(parm("Direct Junctions Only")), stringToBool(parm("Ignore Border Cells")), m->labelHeat());
822  }
823 
824  bool run(Mesh *m, QString mode, bool onlyDirect, bool ignoreBorderCells, IntFloatAttr& heatMap);
825 
826  };
827 
828 }
829 
830 #endif
mgx::MeasurePerimeter::MeasurePerimeter
MeasurePerimeter(const Process &process)
Definition: MeshProcessMeasures.hpp:157
mgx::MeasureMinRadius::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:340
mgx::MeasureAspectRatio::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:239
mgx::MeasureCellCoord
Definition: MeshProcessMeasures.hpp:769
mgx::MeasureSignal::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:44
mgx::MeasureNeighbors::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:318
mgx::MeasurePolarCoord::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:542
mgx::MeasureDistanceToBezier::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:465
mgx::MeasureAspectRatio::MeasureAspectRatio
MeasureAspectRatio(const Process &process)
Definition: MeshProcessMeasures.hpp:229
Process.hpp
mgx::MeasureStomatalBending::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:214
mgx::JunctionDistance::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:818
mgx::MeasureAspectRatio
Definition: MeshProcessMeasures.hpp:226
Information.hpp
mgx::MeasureNeighborhoodNeighbors::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:709
mgx::MeasureAvgRadius::MeasureAvgRadius
MeasureAvgRadius(const Process &process)
Definition: MeshProcessMeasures.hpp:377
mgx::MeasureBezierLineCoord::MeasureBezierLineCoord
MeasureBezierLineCoord(const Process &process)
Definition: MeshProcessMeasures.hpp:505
mgx::MeasureNeighborhoodVariabilityRadius::MeasureNeighborhoodVariabilityRadius
MeasureNeighborhoodVariabilityRadius(const Process &process)
Definition: MeshProcessMeasures.hpp:724
mgx::MeasureSignal
Definition: MeshProcessMeasures.hpp:28
mgx::MeasureBezierCoord
Definition: MeshProcessMeasures.hpp:478
mgx::MeasureDistanceToBezier::MeasureDistanceToBezier
MeasureDistanceToBezier(const Process &process)
Definition: MeshProcessMeasures.hpp:453
mgx::MeasureMinorAxis
Definition: MeshProcessMeasures.hpp:280
mgx::MeasureNeighborhoodAspectRatio::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:687
mgx::MeasureStomatalBending
Definition: MeshProcessMeasures.hpp:202
mgx::MeasureBending::MeasureBending
MeasureBending(const Process &process)
Definition: MeshProcessMeasures.hpp:180
mgx::MeasureNeighborhoodPerimeter::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:663
mgx::MeasureCellCoord::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:782
mgx::MeasureDistanceToMesh::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:406
mgx::MeasureSignal::MeasureSignal
MeasureSignal(const Process &process)
Definition: MeshProcessMeasures.hpp:32
mgx::MeasureNeighborhoodArea
Definition: MeshProcessMeasures.hpp:631
mgx::MeasureBezierCoord::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:490
mgx::Stack
Definition: Stack.hpp:33
mgx::MeasureSignalInterior
Definition: MeshProcessMeasures.hpp:81
mgx::MeasureVariabilityRadius::MeasureVariabilityRadius
MeasureVariabilityRadius(const Process &process)
Definition: MeshProcessMeasures.hpp:557
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::MeasureCellDistance::MeasureCellDistance
MeasureCellDistance(const Process &process)
Definition: MeshProcessMeasures.hpp:746
mgx::MeasureSignalTotal
Definition: MeshProcessMeasures.hpp:105
mgx::MeasureCommonNhbrs
Definition: MeshProcessMeasures.hpp:580
mgx::MeasureCommonNhbrs::MeasureCommonNhbrs
MeasureCommonNhbrs(const Process &process)
Definition: MeshProcessMeasures.hpp:583
mgx::VertexPrSet
std::pair< VertexPr, Set > VertexPrSet
Definition: MeshProcessMeasures.hpp:24
mgx::MeasureNeighborhoodPerimeter
Definition: MeshProcessMeasures.hpp:653
mgx::MeasureCommonNhbrs::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:594
mgx::MeasureSignalTotal::MeasureSignalTotal
MeasureSignalTotal(const Process &process)
Definition: MeshProcessMeasures.hpp:109
mgx::MeasureStomataArea::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:619
mgx::Process
Definition: Process.hpp:219
mgx::MeasureSignalBorder
Definition: MeshProcessMeasures.hpp:57
mgx::MeasureMaxRadius::MeasureMaxRadius
MeasureMaxRadius(const Process &process)
Definition: MeshProcessMeasures.hpp:355
mgx::MeasureDistanceToMesh
Definition: MeshProcessMeasures.hpp:396
mgx::MeasureStomataArea::MeasureStomataArea
MeasureStomataArea(const Process &process)
Definition: MeshProcessMeasures.hpp:610
mgx::MeasureMajorAxis::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:267
mgx::stringToBool
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
mgx::MeasureNeighborhoodNeighbors
Definition: MeshProcessMeasures.hpp:699
mgx::MeasureMaxRadius
Definition: MeshProcessMeasures.hpp:352
mgx::MeasureBezierLineCoord
Definition: MeshProcessMeasures.hpp:502
mgx::MeasureMinorAxis::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:292
mgx::MeasureDistanceToMesh::MeasureDistanceToMesh
MeasureDistanceToMesh(const Process &process)
Definition: MeshProcessMeasures.hpp:399
mgx::MeasureBezierLineCoord::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:514
mgx::MeasureCellCoord::MeasureCellCoord
MeasureCellCoord(const Process &process)
Definition: MeshProcessMeasures.hpp:772
mgx::MeasureArea
Definition: MeshProcessMeasures.hpp:129
mgx::MeasureMajorAxis
Definition: MeshProcessMeasures.hpp:255
mgx::MeasureNeighborhoodArea::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:641
mgx::MeasureVariabilityRadius::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:568
mgx::MeasureMinorAxis::MeasureMinorAxis
MeasureMinorAxis(const Process &process)
Definition: MeshProcessMeasures.hpp:283
mgx::VertexPr
std::pair< vertex, vertex > VertexPr
Definition: MeshProcessHeatMap.hpp:36
Progress.hpp
mgx::MeasureNeighborhoodPerimeter::MeasureNeighborhoodPerimeter
MeasureNeighborhoodPerimeter(const Process &process)
Definition: MeshProcessMeasures.hpp:656
mgx::MeasureVariabilityRadius
Definition: MeshProcessMeasures.hpp:554
mgx::MeasureNeighborhoodVariabilityRadius::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:731
mgx::JunctionDistance::JunctionDistance
JunctionDistance(const Process &process)
Definition: MeshProcessMeasures.hpp:806
mgx::MeasureArea::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:141
mgx::MeasureNeighborhoodAspectRatio
Definition: MeshProcessMeasures.hpp:675
mgx::MeasureBezierCoord::MeasureBezierCoord
MeasureBezierCoord(const Process &process)
Definition: MeshProcessMeasures.hpp:481
mgx::MeasureCellDistance::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:757
mgx::MeasureSignalBorder::MeasureSignalBorder
MeasureSignalBorder(const Process &process)
Definition: MeshProcessMeasures.hpp:61
mgx::Mesh::labelHeat
IntFloatAttr & labelHeat()
Reference to map of heat data by label.
Definition: Mesh.hpp:901
mgx::Mesh
Definition: Mesh.hpp:54
mgx::MeasurePolarCoord
Definition: MeshProcessMeasures.hpp:528
mgx::MeasureCellDistance
Definition: MeshProcessMeasures.hpp:743
mgx::MeasureMaxRadius::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:362
mgx::MeasureNeighbors
Definition: MeshProcessMeasures.hpp:304
mgx::MeasureAvgRadius::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:384
mgx::MeasureNeighborhoodNeighbors::MeasureNeighborhoodNeighbors
MeasureNeighborhoodNeighbors(const Process &process)
Definition: MeshProcessMeasures.hpp:702
mgx::MeasurePerimeter::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:166
mgx::MeasureSignalInterior::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:92
mgx::MeasureMajorAxisTheta
Definition: MeshProcessMeasures.hpp:425
mgx::MeasureStomatalBending::MeasureStomatalBending
MeasureStomatalBending(const Process &process)
Definition: MeshProcessMeasures.hpp:205
mgx::MeasureMajorAxisTheta::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:437
mgx::MeasurePerimeter
Definition: MeshProcessMeasures.hpp:154
mgx::MeasureBending
Definition: MeshProcessMeasures.hpp:177
mgx::MeasureSignalTotal::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:116
mgx::MeasureNeighborhoodAspectRatio::MeasureNeighborhoodAspectRatio
MeasureNeighborhoodAspectRatio(const Process &process)
Definition: MeshProcessMeasures.hpp:678
mgx::MeasureAvgRadius
Definition: MeshProcessMeasures.hpp:374
mgx::MeasureNeighborhoodVariabilityRadius
Definition: MeshProcessMeasures.hpp:721
mgx::MeasureArea::MeasureArea
MeasureArea(const Process &process)
Definition: MeshProcessMeasures.hpp:132
mgx::MeasureSignalBorder::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:68
mgx::VVGraph< VertexData, EdgeData >
mgx::MeasureMinRadius::MeasureMinRadius
MeasureMinRadius(const Process &process)
Definition: MeshProcessMeasures.hpp:333
mgx::MeasureMinRadius
Definition: MeshProcessMeasures.hpp:330
mgx::MeasureNeighborhoodArea::MeasureNeighborhoodArea
MeasureNeighborhoodArea(const Process &process)
Definition: MeshProcessMeasures.hpp:634
mgx::MeasureMajorAxis::MeasureMajorAxis
MeasureMajorAxis(const Process &process)
Definition: MeshProcessMeasures.hpp:258
mgx::MeasureSignalInterior::MeasureSignalInterior
MeasureSignalInterior(const Process &process)
Definition: MeshProcessMeasures.hpp:85
mgx::MeasurePolarCoord::MeasurePolarCoord
MeasurePolarCoord(const Process &process)
Definition: MeshProcessMeasures.hpp:531
mgx::MeasureMajorAxisTheta::MeasureMajorAxisTheta
MeasureMajorAxisTheta(const Process &process)
Definition: MeshProcessMeasures.hpp:428
mgx::MeasureNeighbors::MeasureNeighbors
MeasureNeighbors(const Process &process)
Definition: MeshProcessMeasures.hpp:307
mgx::JunctionDistance
Definition: MeshProcessMeasures.hpp:803
mgx::AttrMap< int, float >
mgx::MeasureStomataArea
Definition: MeshProcessMeasures.hpp:607
mgx::MeasureBending::run
bool run()
Runs the process.
Definition: MeshProcessMeasures.hpp:190
mgx::MeasureDistanceToBezier
Definition: MeshProcessMeasures.hpp:450
mgx::map
CU_HOST_DEVICE Vector< dim, T > map(const T &(*fct)(const T1 &), const Vector< dim, T1 > &v)
Definition: Vector.hpp:1380
mgx::Set
std::set< vertex > Set
Definition: MeshProcessHeatMap.hpp:37