MorphoGraphX  2.0-1-227
MeshProcessCellAxis.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_PROCESSS_CELLAXIS_HPP
12 #define MESH_PROCESSS_CELLAXIS_HPP
13 
14 #include <Process.hpp>
15 
16 #include <MeshProcessCellMesh.hpp>
17 
18 namespace mgx
19 {
20 
21  //mgx_EXPORT SymmetricTensor customDirectionTensor(SymmetricTensor& origTensor, Point3f customX, Point3f customY, bool shear);
22 
25 
28  class mgxBase_EXPORT SaveCellAxis : public Process
29  {
30  public:
31  SaveCellAxis(const Process& process) : Process(process)
32  {
33  setName("Mesh/Cell Axis/Cell Axis Save");
34  setDesc("Save 3D Cell Axis to a csv file.");
35  setIcon(QIcon(":/images/CellAxisSave.png"));
36 
37  addParm("Output File","Path to output file","");
38  addParm("Data","Data to be saved","Original Tensor", QStringList() << "Original Tensor" << "Custom Tensor" << "Visualized Axis");
39  }
40 
41  bool initialize(QWidget* parent);
42 
43  bool run()
44  {
45  if(!checkState().mesh(MESH_NON_EMPTY))
46  return false;
47  return run(currentMesh(), parm("Output File"), parm("Data"));
48  }
49 
50  bool run(Mesh* mesh, const QString& filename, const QString& type);
51  };
52 
56  class mgxBase_EXPORT LoadCellAxis : public Process {
57  public:
58  LoadCellAxis(const Process& process) : Process(process)
59  {
60  setName("Mesh/Cell Axis/Cell Axis Load");
61  setDesc("Load cell axis from a spreadsheet file.");
62  setIcon(QIcon(":/images/CellAxisOpen.png"));
63 
64  addParm("Type","Load PDG, Fibril Orientations or Curvature from a spreadsheet file.","PDG", QStringList() << "PDG" << "PCA" << "fibril" << "curvature" << "polarization");
65  addParm("Input File","Path to input file. If empty, a browser will open.","");
66  }
67 
68  bool initialize(QWidget* parent);
69 
70  bool run()
71  {
72  if(!checkState().mesh(MESH_NON_EMPTY))
73  return false;
74  return run(currentMesh(), parm("Type"), parm("Input File"));
75  }
76 
77  bool run(Mesh* mesh, const QString& type, const QString& filename);
78 
79  };
80 
86  class mgxBase_EXPORT ClearCellAxis : public Process
87  {
88  public:
89  ClearCellAxis(const Process& process) : Process(process)
90  {
91  setName("Mesh/Cell Axis/Cell Axis Clear");
92  setDesc("Remove any cell axis information from the current mesh.");
93  setIcon(QIcon(":/images/CellAxisClear.png"));
94  }
95 
96  bool run()
97  {
98  if(!checkState().mesh(MESH_NON_EMPTY))
99  return false;
100  return run(currentMesh());
101  }
102 
103  bool run(Mesh* mesh);
104 
105  };
106  typedef std::map<int, Point3d> IntP3dMap;
107  typedef std::map<Point2i, Point3d> P2iP3dMap;
114 /*
115  class mgxBase_EXPORT CreateCustomOrthogHeat : public Process
116  {
117  public:
118  CreateCustomOrthogHeat(const Process& process) : Process(process) {}
119 
120  bool run(const QStringList& parms)
121  {
122  if(!checkState().mesh(MESH_NON_EMPTY))
123  return false;
124  return run(currentMesh(), stringToBool(parms[0]), parms[1], true);
125  }
126  bool run(Mesh *m, bool projectOnSurface, QString normalize, bool display);
127 
128  QString name() const { return "Mesh/Cell Axis/Custom/Experimental/Create Orthogonal Heatmap"; }
129  QString description() const { return
130  "Create Orthogonal Heatmap"; }
131  QStringList parmNames() const { return QStringList()
132  << "Project Directions on Surface"
133  << "Normalize" ; }
134  QStringList parmDefaults() const { return QStringList()
135  << "Yes"
136  << "no" ; }
137  QIcon icon() const { return QIcon(":/images/PDG.png"); }
138 
139  ParmChoiceMap parmChoice() const {
140  ParmChoiceMap map;
141  map[0] = booleanChoice();
142  map[1] = QStringList() << "no" << "norm" << "square norm";
143  return map;
144  }
145 
146 
147  };
148 */
149 
156  class mgxBase_EXPORT CreateIntrinsicHeat : public Process
157  {
158  public:
159  CreateIntrinsicHeat(const Process& process) : Process(process)
160  {
161  setName("Mesh/Cell Axis/Custom/Create Intrinsic Heatmap");
162  setDesc("Create Intrinsic Heatmap");
163  setIcon(QIcon(":/images/PDG.png"));
164 
165  addParm("Project Directions on Surface","","Yes",booleanChoice());
166  addParm("Normalize","","no", QStringList() << "no" << "norm" << "square norm");
167  }
168 
169  bool run()
170  {
171  if(!checkState().mesh(MESH_NON_EMPTY))
172  return false;
173  return run(currentMesh(), stringToBool(parm("Project Directions on Surface")), parm("Normalize"), true);
174  }
175  bool run(Mesh *m, bool projectOnSurface, QString normalize, bool display);
176 
177  };
178 
179 
180  class mgxBase_EXPORT CreateCustomDirectionsHeat : public Process
181  {
182  public:
183  CreateCustomDirectionsHeat(const Process& process) : Process(process)
184  {
185  setName("Mesh/Cell Axis/Custom/Create Heatmap Directions");
186  setDesc("Create Custom Heatmap Directions");
187  setIcon(QIcon(":/images/PDG.png"));
188 
189  addParm("Project Directions on Surface","","Yes",booleanChoice());
190  addParm("Normalize","","no", QStringList() << "no" << "norm" << "square norm");
191  }
192 
193  bool run()
194  {
195  if(!checkState().mesh(MESH_NON_EMPTY))
196  return false;
197  return run(currentMesh(), stringToBool(parm("Project Directions on Surface")), parm("Normalize"), true);
198  }
199 
200  bool run(Mesh *m, bool projectOnSurface, QString normalize, bool display);
201 
202  };
203 
204  class mgxBase_EXPORT SmoothCustomDirections : public Process
205  {
206  public:
207  SmoothCustomDirections(const Process& process) : Process(process)
208  {
209  setName("Mesh/Cell Axis/Custom/Smooth Custom Directions");
210  setDesc("Smooth Custom Directions");
211  setIcon(QIcon(":/images/PDG.png"));
212 
213  addParm("Weight by Cell Area","Weight by Cell Area","Yes",booleanChoice());
214  addParm("Project Directions on Surface","Project Directions on cell surfaces after smoothing","Yes",booleanChoice());
215  }
216 
217  bool run()
218  {
219  if(!checkState().mesh(MESH_NON_EMPTY))
220  return false;
221  return run(currentMesh(), stringToBool(parm("Weight by Cell Area")), stringToBool(parm("Project Directions on Surface")), true);
222  }
223 
224  bool run(Mesh *m, bool weight, bool project, bool display);
225 
226  };
227 
228  class mgxBase_EXPORT CopyCustomDirections : public Process
229  {
230  public:
231  CopyCustomDirections(const Process& process) : Process(process)
232  {
233  setName("Mesh/Cell Axis/Custom/Copy Custom Directions to Other Mesh");
234  setDesc("Copy Custom Directions");
235  setIcon(QIcon(":/images/PDG.png"));
236  }
237 
238  bool run()
239  {
240  if(!checkState().mesh(MESH_NON_EMPTY))
241  return false;
242  return run(currentMesh(), otherMesh());
243  }
244 
245  bool run(Mesh *m1, Mesh *m2);
246 
247  };
248 
249  class mgxBase_EXPORT ImportCustomDirections : public Process
250  {
251  public:
252  ImportCustomDirections(const Process& process) : Process(process)
253  {
254  setName("Mesh/Cell Axis/Custom/Import Tensor from Attr Map");
255  setDesc("Copy Custom Directions");
256  setIcon(QIcon(":/images/PDG.png"));
257 
258  addParm("Prefix","Prefix","Measure Label Tensor ");
259  addParm("Name","Name","Custom Directions");
260  addParm("Mesh","Mesh","Active Mesh", QStringList() << "Active Mesh" << "Other Mesh");
261  }
262 
263  bool run()
264  {
265  if(!checkState().mesh(MESH_NON_EMPTY))
266  return false;
267  return run(currentMesh(), otherMesh(), parm("Prefix"), parm("Name"), parm("Mesh"));
268  }
269 
270  bool run(Mesh *m1, Mesh *m2, QString prefix, QString name, QString nameMesh);
271 
272  };
273 
274  class mgxBase_EXPORT ImportCustomDirectionsVector : public Process
275  {
276  public:
277  ImportCustomDirectionsVector(const Process& process) : Process(process)
278  {
279  setName("Mesh/Cell Axis/Custom/Import Vector from Attr Map");
280  setDesc("Copy Custom Directions");
281  setIcon(QIcon(":/images/PDG.png"));
282 
283  addParm("Prefix","Prefix","Measure Label Vector ");
284  addParm("Name","Name","Custom Directions");
285  addParm("Dimension","Dimension","X",QStringList() << "X" << "Y" << "Z");
286  addParm("Mesh","Mesh","Active Mesh", QStringList() << "Active Mesh" << "Other Mesh");
287  }
288 
289  bool run()
290  {
291  if(!checkState().mesh(MESH_NON_EMPTY))
292  return false;
293  return run(currentMesh(), otherMesh(), parm("Prefix"), parm("Name"), parm("Dimension"), parm("Mesh"));
294  }
295 
296  bool run(Mesh *m1, Mesh *m2, QString prefix, QString name, QString dimension, QString nameMesh);
297 
298  };
299 
305  class mgxBase_EXPORT CreateCustomDirectionsSurface : public Process
306  {
307  public:
308  CreateCustomDirectionsSurface(const Process& process) : Process(process)
309  {
310  setName("Mesh/Cell Axis 3D/Custom/Create Surface Directions");
311  setDesc("Create Custom Bezier Directions");
312  setIcon(QIcon(":/images/PDG.png"));
313 
314  addParm("Custom X","Custom X","Surface Direction",QStringList() << "None" << "Surface Direction" << "Surface Normal");
315  addParm("Custom Y","Custom Y","None",QStringList() << "None" << "Surface Direction" << "Surface Normal");
316  addParm("Custom Z","Custom Z","None",QStringList() << "None" << "Surface Direction" << "Surface Normal");
317  }
318 
319  bool run()
320  {
321  if(!checkState().mesh(MESH_NON_EMPTY))
322  return false;
323  Mesh* m = currentMesh();
324  Mesh* m2 = otherMesh();
325  return run(m, m2, parm("Custom X"), parm("Custom Y"), parm("Custom Z"), true);
326  }
327  bool run(Mesh *m, Mesh *m2, QString customX, QString customY, QString customZ, bool display);
328 
329 
330  };
331 
337  class mgxBase_EXPORT CustomDirectionsEnforceOrthogonality : public Process
338  {
339  public:
341  {
342  setName("Mesh/Cell Axis 3D/Custom/Create Orthogonal Direction");
343  setDesc("Creates a orthogonal direction based on the two specified directions and overwrites the third direction with it.\n"
344  "Optional: edit the secondary direction to be orthogonal two the primary and new third direction.");
345  setIcon(QIcon(":/images/PDG.png"));
346 
347  addParm("Primary Axis","Primary Axis","X",QStringList() << "X" << "Y" << "Z");
348  addParm("Secondary Axis","Secondary Axis","Y",QStringList() << "X" << "Y" << "Z");
349  addParm("Change Secondary Axis","Change Secondary Axis","Yes",booleanChoice());
350  }
351 
352  bool run()
353  {
354  if(!checkState().mesh(MESH_NON_EMPTY))
355  return false;
356  Mesh* m = currentMesh();
357  return run(m, parm("Primary Axis"), parm("Secondary Axis"), stringToBool(parm("Change Secondary Axis")), true);
358  }
359  bool run(Mesh *m, QString primX, QString secX, bool changeSecondary, bool display);
360 
361 
362  };
363 
369  class mgxBase_EXPORT CustomDirectionsClear : public Process
370  {
371  public:
372  CustomDirectionsClear(const Process& process) : Process(process)
373  {
374  setName("Mesh/Cell Axis 3D/Custom/Clear Custom Directions");
375  setDesc("Clear Custom Directions");
376  setIcon(QIcon(":/images/PDG.png"));
377 
378  addParm("Clear Custom X","Clear Custom X","Yes",booleanChoice());
379  addParm("Clear Custom Y","Clear Custom Y","Yes",booleanChoice());
380  addParm("Clear Custom Z","Clear Custom Z","Yes",booleanChoice());
381  }
382 
383  bool run()
384  {
385  if(!checkState().mesh(MESH_NON_EMPTY))
386  return false;
387  Mesh* m = currentMesh();
388  return run(m, stringToBool(parm("Clear Custom X")), stringToBool(parm("Clear Custom Y")), stringToBool(parm("Clear Custom Z")), true);
389  }
390  bool run(Mesh *m, bool clearX, bool clearY, bool clearZ, bool display);
391 
392 
393  };
394 
395 
396 
402  class mgxBase_EXPORT CreateCustomDirectionsBezier : public Process
403  {
404  public:
405  CreateCustomDirectionsBezier(const Process& process) : Process(process)
406  {
407  setName("Mesh/Cell Axis/Custom/Create Bezier Grid Directions");
408  setDesc("Create Custom Bezier Directions");
409  setIcon(QIcon(":/images/PDG.png"));
410 
411  addParm("Custom X","Custom X","Bezier X",QStringList() << "None" << "Bezier X" << "Bezier Y" << "Bezier Normal");
412  addParm("Custom Y","Custom Y","Bezier Y",QStringList() << "None" << "Bezier X" << "Bezier Y" << "Bezier Normal");
413 
414  addParm("Project Directions on Surface","","Yes",booleanChoice());
415 
416 
417 
418  }
419 
420  bool run()
421  {
422  if(!checkState().mesh(MESH_NON_EMPTY))
423  return false;
424  return run(currentMesh(), parm("Custom X"), parm("Custom Y"), stringToBool(parm("Project Directions on Surface")), true);
425  }
426 
427  bool run(Mesh *m, QString customX, QString customY, bool projectOnSurface, bool display);
428  };
429 
430 
436  class mgxBase_EXPORT ProjectCustomDirections : public Process
437  {
438  public:
439  ProjectCustomDirections(const Process& process) : Process(process)
440  {
441  setName("Mesh/Cell Axis/Custom/Project Directions");
442  setDesc("Project custom directions on the cell plane");
443  setIcon(QIcon(":/images/PDG.png"));
444  addParm("Make Orthogonal","Makes custom axes orthogonal","None",QStringList() << "None" << "Y from X" << "X from Y");
445 
446  }
447 
448  bool run()
449  {
450  if(!checkState().mesh(MESH_NON_EMPTY))
451  return false;
452  return run(currentMesh(),parm("Make Orthogonal"));
453  }
454 
455  bool run(Mesh *m,QString makeOrthog);
456  };
457 
458 
464  class mgxBase_EXPORT CreateCustomDirectionsBezierLine : public Process
465  {
466  public:
468  {
469  setName("Mesh/Cell Axis/Custom/Create Bezier Line Directions");
470  setDesc("Create Custom Directions from a Bezier Line\n"
471  "Longitudinal - Along the Bezier line\n"
472  "Radial - Towards the Bezier line\n"
473  "Circumferential - Around the Bezier line\n"
474  "(always from the cell center)");
475  setIcon(QIcon(":/images/PDG.png"));
476 
477  addParm("Custom X","Custom X","Radial",QStringList() << "None" << "Radial" << "Circumferential" << "Longitudinal");
478  addParm("Custom Y","Custom Y","Circumferential",QStringList() << "None" << "Radial" << "Circumferential" << "Longitudinal");
479 
480  addParm("Project Directions on Surface","","Yes",booleanChoice());
481 
482  }
483 
484  bool run()
485  {
486  if(!checkState().mesh(MESH_NON_EMPTY))
487  return false;
488  return run(currentMesh(), parm("Custom X"), parm("Custom Y"), stringToBool(parm("Project Directions on Surface")), true);
489  }
490 
491  bool run(Mesh *m, QString customX, QString customY, bool projectOnSurface, bool display);
492  };
493 
494 
500  class mgxBase_EXPORT CreateCustomDirectionsBezierLine3D : public Process
501  {
502  public:
504  {
505  setName("Mesh/Cell Axis 3D/Custom/Create Bezier Line Directions");
506  setDesc("Create Custom Directions from a Bezier Line\n"
507  "Longitudinal - Along the Bezier line\n"
508  "Radial - Towards the Bezier line\n"
509  "Circumferential - Around the Bezier line\n"
510  "(always from the cell center)");
511  setIcon(QIcon(":/images/PDG.png"));
512 
513  addParm("Custom X","Custom X","Radial",QStringList() << "None" << "Radial" << "Circumferential" << "Longitudinal");
514  addParm("Custom Y","Custom Y","Circumferential",QStringList() << "None" << "Radial" << "Circumferential" << "Longitudinal");
515  addParm("Custom Z","Custom Z","Longitudinal",QStringList() << "None" << "Radial" << "Circumferential" << "Longitudinal");
516 
517 
518  }
519 
520  bool run()
521  {
522  if(!checkState().mesh(MESH_NON_EMPTY))
523  return false;
524  return run(currentMesh(), parm("Custom X"), parm("Custom Y"), parm("Custom Z"), true);
525 
526  }
527  bool run(Mesh *m, QString customX, QString customY, QString customZ, bool display);
528  };
529 
535  class mgxBase_EXPORT CreateCustomDirectionsBezier3D : public Process
536  {
537  public:
538  CreateCustomDirectionsBezier3D(const Process& process) : Process(process)
539  {
540  setName("Mesh/Cell Axis 3D/Custom/Create Bezier Grid Directions");
541  setDesc("Create Custom Bezier Directions for volumetric cells");
542  setIcon(QIcon(":/images/PDG.png"));
543 
544  addParm("Custom X","Custom X","Bezier X",QStringList() << "None" << "Bezier X" << "Bezier Y" << "Bezier Normal");
545  addParm("Custom Y","Custom Y","Bezier Y",QStringList() << "None" << "Bezier X" << "Bezier Y" << "Bezier Normal");
546  addParm("Custom Z","Custom Z","Bezier Normal",QStringList() << "None" << "Bezier X" << "Bezier Y" << "Bezier Normal");
547 
548  }
549 
550  bool run()
551  {
552  if(!checkState().mesh(MESH_NON_EMPTY))
553  return false;
554  return run(currentMesh(), parm("Custom X"), parm("Custom Y"), parm("Custom Z"), true);
555  }
556 
557  bool run(Mesh *m, QString customX, QString customY, QString customZ, bool display);
558 
559  };
560 
561 
567  class mgxBase_EXPORT CustomDirectionsAngle : public Process
568  {
569  public:
570  CustomDirectionsAngle(const Process& process) : Process(process)
571  {
572  setName("Mesh/Cell Axis/Custom/Custom Direction Angle");
573  setDesc("Generate a heatmap of the angle (deg) between the specified active cell axis and a previously created custom direction.");
574  setIcon(QIcon(":/images/PDG.png"));
575 
576  addParm("Direction Axis","Direction Axis","Max", QStringList() << "Max" << "Min");
577  addParm("Direction Custom","Direction Custom","X", QStringList() << "X" << "Y");
578  }
579 
580  bool run()
581  {
582  if(!checkState().mesh(MESH_NON_EMPTY))
583  return false;
584  return run(currentMesh(), parm("Direction Axis"), parm("Direction Custom"));
585  }
586 
587  bool run(Mesh *m, QString dirAxis, QString dirCustom);
588 
589  };
590 
596  class mgxBase_EXPORT CustomDirectionsAngle3D : public Process
597  {
598  public:
599  CustomDirectionsAngle3D(const Process& process) : Process(process)
600  {
601  setName("Mesh/Cell Axis 3D/Custom/Custom Direction Angle 3D");
602  setDesc("Generate a heatmap of the angle (deg) between the specified active cell axis and a previously created custom direction.");
603  setIcon(QIcon(":/images/PDG.png"));
604 
605  addParm("Direction Axis","","Max", QStringList() << "Max" << "Mid" << "Min");
606  addParm("Direction Custom","","X", QStringList() << "X" << "Y" << "Z");
607  }
608 
609  bool run()
610  {
611  if(!checkState().mesh(MESH_NON_EMPTY))
612  return false;
613  return run(currentMesh(), parm("Direction Axis"), parm("Direction Custom"));
614  }
615 
616  bool run(Mesh *m, QString dirAxis, QString dirCustom);
617 
618  };
619 
620 
627  class mgxBase_EXPORT DisplayCustomOrientations : public Process
628  {
629  public:
630  DisplayCustomOrientations(const Process& process) : Process(process)
631  {
632  setName("Mesh/Cell Axis/Custom/Display Custom Orientations");
633  setDesc("Display the orientations of the custom orientations attribute map");
634  setIcon(QIcon(":/images/PrincipalOrientations.png"));
635 
636  addParm("Directions","Directions to display","XY", QStringList() << "X" << "Y" << "Z" << "XY" << "XYZ");
637  addParm("Line Color","Line Color","aliceblue", QColor::colorNames());
638  addParm("Line Width","Line Width","3.0");
639  addParm("Line Scale","Length of the vectors = Scale * orientation strength.","3.0");
640  addParm("Line Offset","Draw the vector ends a bit tilted up for proper display on surfaces.","0.1");
641  addParm("Threshold","Minimal value of orientation strength required for drawing main direction.","0.0");
642  }
643 
644  bool run()
645  {
646  if(!checkState().mesh(MESH_NON_EMPTY))
647  return false;
648 
649  return run(currentMesh(), parm("Directions"), QColor(parm("Line Color")), parm("Line Width").toFloat(),
650  parm("Line Scale").toFloat(), parm("Line Offset").toFloat(), parm("Threshold").toFloat());
651  }
652 
653  bool run(Mesh* mesh, QString directions, const QColor& ColorMax,
654  float AxisLineWidth, float ScaleAxisLength, float AxisOffset, float OrientationThreshold);
655 
656  };
657 
658  // /**
659  // * \class DisplayCustomOrientations <ProcessFibril.hpp>
660  // *
661  // * Change the representation of the fibril orientation after it has been
662  // * computed.
663  // */
664  // class mgxBase_EXPORT DisplayCustomOrientations : public Process
665  // {
666  // public:
667  // DisplayCustomOrientations(const Process& process) : Process(process)
668  // {
669  // setName("Mesh/Cell Axis/Custom/Display Custom Orientations");
670  // setDesc("Display the orientations of the custom orientations attribute map");
671  // setIcon(QIcon(":/images/PrincipalOrientations.png"));
672 
673  // addParm("Directions","Directions to display","XY", QStringList() << "X" << "Y" << "Z" << "XY" << "XYZ");
674  // addParm("Line Color","Line Color","aliceblue", QColor::colorNames());
675  // addParm("Line Width","Line Width","3.0");
676  // addParm("Line Scale","Length of the vectors = Scale * orientation strength.","3.0");
677  // addParm("Line Offset","Draw the vector ends a bit tilted up for proper display on surfaces.","0.1");
678  // }
679 
680  // bool run()
681  // {
682  // if(!checkState().mesh(MESH_NON_EMPTY))
683  // return false;
684 
685  // return run(currentMesh(), parm("Directions"), QColor(parm("Line Color")), parm("Line Width").toFloat(),
686  // parm("Line Scale").toFloat(), parm("Line Offset").toFloat());
687  // }
688 
689  // bool run(Mesh* mesh, QString directions, const QColor& ColorMax,
690  // float AxisLineWidth, float ScaleAxisLength, float AxisOffset);
691 
692  // };
693 
694 
701  class mgxBase_EXPORT DisplayCellAxisFromTensor : public Process
702  {
703  public:
704  DisplayCellAxisFromTensor(const Process& process) : Process(process)
705  {
706  setName("Mesh/Cell Axis/Display Template");
707  setDesc("Process to draw cell axis used by other processes");
708  setIcon(QIcon(":/images/PrincipalOrientations.png"));
709 
710  }
711 
712  bool run()
713  {
714  //if(!checkState().mesh(MESH_NON_EMPTY))
715  return true;
716 
717  // return run(currentMesh(), parm("Directions"), QColor(parm("Line Color")), parm("Line Width").toFloat(),
718  // parm("Line Scale").toFloat(), parm("Line Offset").toFloat(), parm("Threshold").toFloat());
719  }
720 
721  bool run(Mesh *mesh, IntSymTensorAttr &cellAxis,
722  QString mode, bool custom, const QColor& qaxisColorX, const QColor& qaxisColorY, const QColor& qaxisColorZ,const QColor& qaxisColorShrink,
723  double axisLineWidth, double axisLineScale, double axisOffset, double orientationThreshold, bool strain);
724 
725  };
726 
727 
728 
734  class mgxBase_EXPORT DisplayCustomOrientations3D : public Process
735  {
736  public:
737  DisplayCustomOrientations3D(const Process& process) : Process(process)
738  {
739 
740  setName("Mesh/Cell Axis 3D/Custom/Display Custom Orientations");
741  setDesc("Display the orientations of the custom orientations attribute map");
742  setIcon(QIcon(":/images/PrincipalOrientations.png"));
743 
744  addParm("Directions","Directions to display","XYZ", QStringList() << "X" << "Y" << "Z" << "XY" << "XZ" << "YZ" << "XYZ");
745  addParm("Line Color","Line Color","aliceblue", QColor::colorNames());
746  addParm("Line Width","Line Width","3.0");
747  addParm("Line Scale","Length of the vectors = Scale * orientation strength.","3.0");
748  addParm("Threshold","Minimal value of orientation strength required for drawing main direction.","0.0");
749  }
750 
751  bool run()
752  {
753  if(!checkState().mesh(MESH_NON_EMPTY))
754  return false;
755 
756  return run(currentMesh(), parm("Directions"), QColor(parm("Line Color")), parm("Line Width").toFloat(),
757  parm("Line Scale").toFloat(), parm("Threshold").toFloat());
758  }
759 
760  bool run(Mesh* mesh, QString directions, const QColor& ColorMax,
761  float AxisLineWidth, float ScaleAxisLength, float OrientationThreshold);
762 
763  };
764 
770  class mgxBase_EXPORT CellAxisAttrMapExport : public Process
771  {
772  public:
773  CellAxisAttrMapExport(const Process& process) : Process(process)
774  {
775  setName("Mesh/Cell Axis/Cell Axis Export To Attr Map");
776  setDesc("");
777  setIcon(QIcon(":/images/PDG.png"));
778 
779  addParm("Prefix","","Measure Label Tensor");
780  addParm("Name","","AxisAttr");
781  addParm("Key","Keys of Attr Map","Label", QStringList() << "Label" << "Parent");
782  addParm("Value","Type of value to be saved","Label Axis", QStringList() << "Label Axis" << "Parent Axis");
783  addParm("Save to","Save to which mesh","Active Mesh", QStringList() << "Active Mesh" << "Other Mesh");
784  addParm("Clean","Remove entries for non-existent cells","No",booleanChoice());
785  }
786 
787  bool run()
788  {
789  if(!checkState().mesh(MESH_ANY))
790  return false;
791  Mesh *m = currentMesh();
792  Mesh *m2;
793  if(currentMesh() == mesh(0))
794  m2 = mesh(1);
795  else
796  m2 = mesh(0);
797  return run(m,m2, parm("Prefix"), parm("Name"), parm("Key"), parm("Value"), parm("Save to"),stringToBool(parm("Clean")));
798  }
799 
800  bool run(Mesh *m, Mesh *m2, QString prefix, QString name, QString key, QString value, QString meshNumber, bool cleanMesh);
801 
802  };
803 
809  class mgxBase_EXPORT CellAxisAttrMapImport : public Process
810  {
811  public:
812  CellAxisAttrMapImport(const Process& process) : Process(process)
813  {
814 
815  setName("Mesh/Cell Axis/Cell Axis Import From Attr Map");
816  setDesc("");
817  setIcon(QIcon(":/images/PDG.png"));
818 
819  addParm("Type","","PDG", QStringList() << "PDG" << "PCA" << "fibril" << "curvature" << "polarization");
820  addParm("Prefix","Prefix","Measure Label Tensor");
821  addParm("Name","Name","AxisAttr");
822  addParm("Project on cell plane","","No",booleanChoice());
823  }
824 
825  bool run()
826  {
827  if(!checkState().mesh(MESH_NON_EMPTY))
828  return false;
829  return run(currentMesh(), parm("Type"), parm("Prefix"), parm("Name"), stringToBool(parm("Project on cell plane")));
830  }
831 
832  bool run(Mesh *m, QString type, QString prefix, QString name, bool reproject);
833 
834  };
835 
836  // /**
837  // * \class CellAxisPDGAngle <MeshProcessCellAxis.hpp>
838  // *
839  // *
840  // */
841  // class mgxBase_EXPORT CellAxisPDGAngle : public Process
842  // {
843  // public:
844  // CellAxisPDGAngle(const Process& process) : Process(process)
845  // {
846 
847  // setName("Mesh/Cell Axis/ToBeDeleted/PDG Angle");
848  // setDesc("");
849  // setIcon(QIcon(":/images/PDG.png"));
850 
851  // addParm("T1 mesh","","");
852  // addParm("T2 mesh","","");
853  // addParm("T3 mesh","","");
854  // addParm("T1-T2 parents","","");
855  // addParm("T1-T3 parents","","");
856  // addParm("Isotropy threshold","","1.2");
857  // }
858 
859  // bool initialize(QWidget *parent);
860 
861  // bool run();
862 
863  // bool run(QString meshNameT1, QString meshNameT2, QString meshNameT3,QString T1T2,QString T1T3,QString isoThresh);
864 
865  // };
866 
867 
868  class mgxBase_EXPORT CellAxisAngles : public Process
869  {
870  QString filename;
871 
872  public:
873  CellAxisAngles(const Process& process) : Process(process)
874  {
875  setName("Mesh/Cell Axis/Compute Angles");
876  setDesc("Calculate angles between different cell axis");
877  setIcon(QIcon(":/images/MeasureAngles.png"));
878 
879  addParm("Cell Axis Attr 1","Cell Axis Attr 1","Shape2D",
880  QStringList() << "Curvature" << "CustomDirections" << "DeformationGradient" << "FibrilOrientations" << "PDGs" << "Polarity" << "Shape2D");
881  addParm("Direction 1","Direction","Max/X",QStringList() << "Max/X" << "Min/Y");
882  addParm("Isotropy Threshold 1","Ignore cells when their cell axis are close to isotropic, i.e. when their anisotropy is below the threshold","0");
883  addParm("Cell Axis Attr 2","Cell Axis Attr 2","FibrilOrientations",
884  QStringList() << "Curvature" << "CustomDirections" << "DeformationGradient" << "FibrilOrientations" << "PDGs" << "Polarity" << "Shape2D");
885  addParm("Direction 2","Direction","Max/X",QStringList() << "Max/X" << "Min/Y");
886  addParm("Isotropy Threshold 2","Ignore cells when their cell axis are close to isotropic, i.e. when their anisotropy is below the threshold","0");
887 
888  addParm("Use Measure Prefix","Use Measure Prefix Measure Label Tensor","Yes", booleanChoice());
889  addParm("Display Axis","Display Axis","Yes", booleanChoice());
890  addParm("Color 1","Color 1","aqua", QColor::colorNames());
891  addParm("Color 2","Color 2","red", QColor::colorNames());
892  addParm("Line Width","Line width","2.0");
893  addParm("Line Scale","Line Scale","1.0");
894  addParm("Line Offset","Draw the vector ends a bit tilted up for proper display on surfaces.","0.1");
895  }
896 
897  bool run()
898  {
899  if(!checkState().mesh(MESH_NON_EMPTY))
900  return false;
901  return run(currentMesh(), stringToBool(parm("Use Measure Prefix")),
902  parm("Cell Axis Attr 1"), parm("Direction 1"), parm("Isotropy Threshold 1").toDouble(),
903  parm("Cell Axis Attr 2"), parm("Direction 2"), parm("Isotropy Threshold 2").toDouble(), stringToBool(parm("Display Axis")),
904  QColor(parm("Color 1")),QColor(parm("Color 2")),parm("Line Width").toDouble(),parm("Line Scale").toDouble(),parm("Line Offset").toDouble());
905  }
906 
907  // Standard call interface for all processes
908  bool run(Mesh* m, bool usePrefix, QString attr1, QString dir1, double isoT1, QString attr2, QString dir2, double isoT2,
909  bool displayAxis,const QColor& color1,const QColor& color2,double lineWidth, double lineScale, double lineOffset);
910 
911  };
912 
913 
914  class mgxBase_EXPORT CellAxisAngles3D : public Process
915  {
916  QString filename;
917 
918  public:
919  CellAxisAngles3D(const Process& process) : Process(process)
920  {
921  setName("Mesh/Cell Axis 3D/Compute Angles");
922  setDesc("Calculate angles between different cell axis");
923  setIcon(QIcon(":/images/MeasureAngles.png"));
924 
925  addParm("Cell Axis Attr 1","Cell Axis Attr 1","Polarity3D",
926  QStringList() << "CustomDirections" << "DeformationGradient3D" << "Polarity3D" << "Shape3D");
927  addParm("Direction 1","Direction","Max",QStringList() << "Max" << "Mid" << "Min");
928  addParm("Isotropy Threshold 1","Ignore cells when their cell axis are close to isotropic, i.e. when their anisotropy is below the threshold","1.");
929  addParm("Cell Axis Attr 2","Cell Axis Attr 2","FibrilOrientations",
930  QStringList() << "CustomDirections" << "DeformationGradient3D" << "Polarity3D" << "Shape3D");
931  addParm("Direction 2","Direction","Max",QStringList() << "Max" << "Mid" << "Min");
932  addParm("Isotropy Threshold 2","Ignore cells when their cell axis are close to isotropic, i.e. when their anisotropy is below the threshold","1.");
933 
934  addParm("Use Measure Prefix","Use Measure Prefix Measure Label Tensor","Yes", booleanChoice());
935  addParm("Display Axis","Display Axis","Yes", booleanChoice());
936  }
937 
938  bool run()
939  {
940  if(!checkState().mesh(MESH_NON_EMPTY))
941  return false;
942  return run(currentMesh(), stringToBool(parm("Use Measure Prefix")),
943  parm("Cell Axis Attr 1"), parm("Direction 1"), parm("Isotropy Threshold 1").toDouble(),
944  parm("Cell Axis Attr 2"), parm("Direction 2"), parm("Isotropy Threshold 2").toDouble(), stringToBool(parm("Display Axis")));
945  }
946 
947  // Standard call interface for all processes
948  bool run(Mesh* m, bool usePrefix, QString attr1, QString dir1, double isoT1, QString attr2, QString dir2, double isoT2, bool displayAxis);
949 
950  };
951 
952 
953 
954  class mgxBase_EXPORT CellTypeRecognitionAllMeasures : public Process
955  {
956  public:
958  {
959  setName("Mesh/Cell Type Classification/Measure Map 2D Computation");
960  setDesc("Calculates ALL 2D measure maps. (Might take a bit depending on the mesh).");
961  setIcon(QIcon(":/images/CellTypeRecognitionSpecification.jpeg"));
962  }
963 
964  bool run();
965 
966  };
967 
969 }
970 #endif
mgx::ProjectCustomDirections
Definition: MeshProcessCellAxis.hpp:436
mgx::CellAxisAttrMapImport
Definition: MeshProcessCellAxis.hpp:809
mgx::CustomDirectionsClear
Definition: MeshProcessCellAxis.hpp:369
mgx::CellAxisAngles3D::CellAxisAngles3D
CellAxisAngles3D(const Process &process)
Definition: MeshProcessCellAxis.hpp:919
mgx::CreateCustomDirectionsHeat::CreateCustomDirectionsHeat
CreateCustomDirectionsHeat(const Process &process)
Definition: MeshProcessCellAxis.hpp:183
mgx::ImportCustomDirectionsVector
Definition: MeshProcessCellAxis.hpp:274
mgx::CreateCustomDirectionsBezierLine3D::CreateCustomDirectionsBezierLine3D
CreateCustomDirectionsBezierLine3D(const Process &process)
Definition: MeshProcessCellAxis.hpp:503
Process.hpp
mgx::ProjectCustomDirections::ProjectCustomDirections
ProjectCustomDirections(const Process &process)
Definition: MeshProcessCellAxis.hpp:439
mgx::DisplayCellAxisFromTensor
Definition: MeshProcessCellAxis.hpp:701
mgx::CustomDirectionsAngle3D::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:609
mgx::CreateCustomDirectionsBezier3D::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:550
mgx::LoadCellAxis::LoadCellAxis
LoadCellAxis(const Process &process)
Definition: MeshProcessCellAxis.hpp:58
mgx::SaveCellAxis::SaveCellAxis
SaveCellAxis(const Process &process)
Definition: MeshProcessCellAxis.hpp:31
mgx::CellAxisAngles3D::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:938
mgx::DisplayCellAxisFromTensor::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:712
mgx::CopyCustomDirections::CopyCustomDirections
CopyCustomDirections(const Process &process)
Definition: MeshProcessCellAxis.hpp:231
mgx::ImportCustomDirections::ImportCustomDirections
ImportCustomDirections(const Process &process)
Definition: MeshProcessCellAxis.hpp:252
mgx::DisplayCustomOrientations
Definition: MeshProcessCellAxis.hpp:627
mgx::CellAxisAttrMapImport::CellAxisAttrMapImport
CellAxisAttrMapImport(const Process &process)
Definition: MeshProcessCellAxis.hpp:812
mgx::CopyCustomDirections::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:238
mgx::CreateCustomDirectionsBezierLine::CreateCustomDirectionsBezierLine
CreateCustomDirectionsBezierLine(const Process &process)
Definition: MeshProcessCellAxis.hpp:467
mgx::CreateCustomDirectionsSurface::CreateCustomDirectionsSurface
CreateCustomDirectionsSurface(const Process &process)
Definition: MeshProcessCellAxis.hpp:308
mgx::ClearCellAxis
Definition: MeshProcessCellAxis.hpp:86
mgx::CreateIntrinsicHeat::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:169
mgx::CustomDirectionsEnforceOrthogonality::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:352
mgx::CreateIntrinsicHeat::CreateIntrinsicHeat
CreateIntrinsicHeat(const Process &process)
Definition: MeshProcessCellAxis.hpp:159
mgx::CreateCustomDirectionsBezierLine::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:484
mgx::IntP3dMap
std::map< int, Point3d > IntP3dMap
Definition: MeshProcessCellAxis.hpp:106
mgx::CellTypeRecognitionAllMeasures
Definition: MeshProcessCellAxis.hpp:954
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::CreateCustomDirectionsBezierLine3D::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:520
mgx::CreateCustomDirectionsBezier::CreateCustomDirectionsBezier
CreateCustomDirectionsBezier(const Process &process)
Definition: MeshProcessCellAxis.hpp:405
mgx::ImportCustomDirectionsVector::ImportCustomDirectionsVector
ImportCustomDirectionsVector(const Process &process)
Definition: MeshProcessCellAxis.hpp:277
mgx::SaveCellAxis
Definition: MeshProcessCellAxis.hpp:28
mgx::CopyCustomDirections
Definition: MeshProcessCellAxis.hpp:228
mgx::CustomDirectionsClear::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:383
mgx::CreateCustomDirectionsBezier::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:420
mgx::ImportCustomDirectionsVector::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:289
mgx::CustomDirectionsAngle::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:580
mgx::DisplayCellAxisFromTensor::DisplayCellAxisFromTensor
DisplayCellAxisFromTensor(const Process &process)
Definition: MeshProcessCellAxis.hpp:704
mgx::CustomDirectionsClear::CustomDirectionsClear
CustomDirectionsClear(const Process &process)
Definition: MeshProcessCellAxis.hpp:372
mgx::ImportCustomDirections::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:263
mgx::CellAxisAngles::CellAxisAngles
CellAxisAngles(const Process &process)
Definition: MeshProcessCellAxis.hpp:873
mgx::Process
Definition: Process.hpp:219
mgx::CellAxisAttrMapExport::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:787
mgx::CustomDirectionsAngle3D
Definition: MeshProcessCellAxis.hpp:596
mgx::CreateIntrinsicHeat
Definition: MeshProcessCellAxis.hpp:156
mgx::CreateCustomDirectionsSurface::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:319
mgx::CellAxisAttrMapExport
Definition: MeshProcessCellAxis.hpp:770
mgx::CreateCustomDirectionsBezierLine
Definition: MeshProcessCellAxis.hpp:464
mgx::CreateCustomDirectionsBezier3D
Definition: MeshProcessCellAxis.hpp:535
mgx::stringToBool
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
mgx::P2iP3dMap
std::map< Point2i, Point3d > P2iP3dMap
Definition: MeshProcessCellAxis.hpp:107
mgx::DisplayCustomOrientations3D
Definition: MeshProcessCellAxis.hpp:734
mgx::CreateCustomDirectionsBezier
Definition: MeshProcessCellAxis.hpp:402
mgx::LoadCellAxis
Definition: MeshProcessCellAxis.hpp:56
mgx::CellTypeRecognitionAllMeasures::CellTypeRecognitionAllMeasures
CellTypeRecognitionAllMeasures(const Process &process)
Definition: MeshProcessCellAxis.hpp:957
mgx::DisplayCustomOrientations3D::DisplayCustomOrientations3D
DisplayCustomOrientations3D(const Process &process)
Definition: MeshProcessCellAxis.hpp:737
mgx::CellAxisAngles3D
Definition: MeshProcessCellAxis.hpp:914
mgx::DisplayCustomOrientations::DisplayCustomOrientations
DisplayCustomOrientations(const Process &process)
Definition: MeshProcessCellAxis.hpp:630
mgx::SaveCellAxis::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:43
mgx::ProjectCustomDirections::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:448
mgx::CustomDirectionsEnforceOrthogonality::CustomDirectionsEnforceOrthogonality
CustomDirectionsEnforceOrthogonality(const Process &process)
Definition: MeshProcessCellAxis.hpp:340
mgx::Mesh
Definition: Mesh.hpp:54
mgx::CreateCustomDirectionsHeat
Definition: MeshProcessCellAxis.hpp:180
mgx::CellAxisAngles::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:897
mgx::CellAxisAttrMapExport::CellAxisAttrMapExport
CellAxisAttrMapExport(const Process &process)
Definition: MeshProcessCellAxis.hpp:773
mgx::CustomDirectionsEnforceOrthogonality
Definition: MeshProcessCellAxis.hpp:337
mgx::CellAxisAngles
Definition: MeshProcessCellAxis.hpp:868
mgx::LoadCellAxis::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:70
mgx::CustomDirectionsAngle
Definition: MeshProcessCellAxis.hpp:567
mgx::SmoothCustomDirections::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:217
mgx::DisplayCustomOrientations3D::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:751
mgx::CustomDirectionsAngle::CustomDirectionsAngle
CustomDirectionsAngle(const Process &process)
Definition: MeshProcessCellAxis.hpp:570
mgx::CreateCustomDirectionsHeat::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:193
mgx::ClearCellAxis::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:96
MeshProcessCellMesh.hpp
mgx::CreateCustomDirectionsBezier3D::CreateCustomDirectionsBezier3D
CreateCustomDirectionsBezier3D(const Process &process)
Definition: MeshProcessCellAxis.hpp:538
mgx::CreateCustomDirectionsSurface
Definition: MeshProcessCellAxis.hpp:305
mgx::CreateCustomDirectionsBezierLine3D
Definition: MeshProcessCellAxis.hpp:500
mgx::CellAxisAttrMapImport::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:825
mgx::ImportCustomDirections
Definition: MeshProcessCellAxis.hpp:249
mgx::SmoothCustomDirections::SmoothCustomDirections
SmoothCustomDirections(const Process &process)
Definition: MeshProcessCellAxis.hpp:207
mgx::AttrMap
Attribute map wraps std::map.
Definition: Attributes.hpp:686
mgx::DisplayCustomOrientations::run
bool run()
Runs the process.
Definition: MeshProcessCellAxis.hpp:644
mgx::SmoothCustomDirections
Definition: MeshProcessCellAxis.hpp:204
mgx::ClearCellAxis::ClearCellAxis
ClearCellAxis(const Process &process)
Definition: MeshProcessCellAxis.hpp:89
mgx::CustomDirectionsAngle3D::CustomDirectionsAngle3D
CustomDirectionsAngle3D(const Process &process)
Definition: MeshProcessCellAxis.hpp:599