MorphoGraphX  2.0-1-227
MeshProcessSignalOrientation.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2020 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 WALL_SIGNAL_ORIENTATION_HPP
12 #define WALL_SIGNAL_ORIENTATION_HPP
13 
14 #include <Process.hpp>
15 
16 namespace mgx
17 {
18  class mgxBase_EXPORT SignalOrientation : public Process
19  {
20  public:
21  SignalOrientation(const Process& process) : Process(process)
22  {
23  setName("Mesh/Cell Axis/Polarization/Compute Signal Orientation");
24  setDesc("Compute principal orientation of signal gradient between cell border and center.");
25  setIcon(QIcon(":/images/PDG.png"));
26 
27  addParm("Border Size","Width of cell border that is not taken into account for the computation.","0.5");
28  addParm("Minimum inner area ratio","Minimum ratio of inner area (whole cell - border) vs. total area needed for computation.","0.25");
29  }
30 
31  bool run()
32  {
33  if (!checkState().mesh(MESH_NON_EMPTY|MESH_SIGNAL))
34  return false;
35  Mesh* mesh = currentMesh();
36  return run(mesh, parm("Border Size").toFloat(), parm("Minimum inner area ratio").toFloat());
37  }
38 
39  bool run(Mesh* mesh, float border, float minAreaRatio);
40  };
41 
42  class mgxBase_EXPORT DisplaySignalOrientation: public Process
43  {
44  public:
45  DisplaySignalOrientation(const Process& process) : Process(process)
46  {
47  setName("Mesh/Cell Axis/Polarization/Display Signal Orientation");
48  setDesc("Display the orientation of gradients of signal between cell center vs border.");
49  setIcon(QIcon(":/images/PDG.png"));
50 
51  addParm("Heatmap","Display strength of orientation as a colormap.\n"
52  "Ratio = Max_gradient/Min_gradient -1Difference = Max_gradient - Min_gradient","None",
53  QStringList() << "None" << "Ratio" << "Difference" << "BezierX" << "BezierY");
54  addParm("Axis","Display principal directions of signal gradient. \n"
55  "Ratio -> display only Max orientation, scaled by (Max/Min-1). \n"
56  "Difference -> display only Max orientation, scaled by (Max-Min). \n"
57  ,"Difference", QStringList() << "None" << "Both" << "Ratio" << "Difference" << "BezierX" << "BezierY");
58  addParm("Line Color Max","Color Max direction.","red", QColor::colorNames());
59  addParm("Line Color Min","Color Min direction.","green", QColor::colorNames());
60  addParm("Line Width","Line Width","5.0");
61  addParm("Line Scale","Length of the vectors = Scale * orientation strength.","0.01");
62  addParm("Line Offset","Draw the vector ends a bit tilted up for proper display on surfaces.","0.1");
63  addParm("Threshold","Minimal value of orientation strength required for drawing main direction. \n"
64  "Either use Ratio or Difference, depending on the display Axis option.","0.0");
65  }
66 
67  bool run()
68  {
69  if(!checkState().mesh(MESH_NON_EMPTY))
70  return false;
71 
72  return run(currentMesh(),parm("Heatmap"), parm("Axis"), QColor(parm("Line Color Max")),
73  QColor(parm("Line Color Min")), parm("Line Width").toFloat(),
74  parm("Line Scale").toFloat(), parm("Line Offset").toFloat(), parm("Threshold").toFloat());
75  }
76 
77  bool run(Mesh *mesh, const QString displayHeatMap, const QString displayAxis, const QColor& qaxisColor1,
78  const QColor& qaxisColor2, float axisLineWidth, float axisLineScale, float axisOffset, float orientationThreshold);
79 
80  };
81 
82 class mgxBase_EXPORT SignalOrientation3D : public Process
83  {
84  public:
85  SignalOrientation3D(const Process& process) : Process(process)
86  {
87  setName("Mesh/Cell Axis 3D/Polarization/Compute Signal Orientation");
88  setDesc("Compute principal orientation of signal gradient between cell border and center. 3D version for volumetric meshes");
89  setIcon(QIcon(":/images/PDG.png"));
90 
91  }
92 
93  bool run()
94  {
95  if (!checkState().mesh(MESH_NON_EMPTY|MESH_SIGNAL)) return false;
96  Mesh* mesh = currentMesh();
97  return run(mesh);
98  }
99 
100  bool run(Mesh* mesh);
101  };
102 
103 
104  class mgxBase_EXPORT DisplaySignalOrientation3D: public Process
105  {
106  public:
107  DisplaySignalOrientation3D(const Process& process) : Process(process)
108  {
109  setName("Mesh/Cell Axis 3D/Polarization/Display Signal Orientation");
110  setDesc("Display the orientation of gradients of signal between cell center vs border. 3D version for volumetric meshes");
111  setIcon(QIcon(":/images/PDG.png"));
112 
113  addParm("Heatmap","Display strength of orientation as a colormap.\n"
114  "Ratio = Max_gradient/Min_gradient -1Difference = Max_gradient - Min_gradient","None",
115  QStringList() << "None" << "Ratio" << "Difference" << "BezierX" << "BezierY");
116  addParm("Axis","Display principal directions of signal gradient. \n"
117  "Ratio -> display only Max orientation, scaled by (Max/Min-1). \n"
118  "Difference -> display only Max orientation, scaled by (Max-Min). \n"
119  ,"Difference", QStringList() << "None" << "All" << "Both" << "Ratio" << "Difference" << "BezierX" << "BezierY");
120  addParm("Line Color Max","Color Max direction.","red", QColor::colorNames());
121  addParm("Line Color Mid","Color Min direction.","blueviolet", QColor::colorNames());
122  addParm("Line Color Min","Color Min direction.","lightgreen", QColor::colorNames());
123  addParm("Line Width","Line Width","5.0");
124  addParm("Line Scale","Length of the vectors = Scale * orientation strength.","0.01");
125  addParm("Threshold","Minimal value of orientation strength required for drawing main direction. \n"
126  "Either use Ratio or Difference, depending on the display Axis option.","0.0");
127  }
128 
129  bool run()
130  {
131  if(!checkState().mesh(MESH_NON_EMPTY))
132  return false;
133 
134  return run(currentMesh(),parm("Heatmap"), parm("Axis"), QColor(parm("Line Color Max")), QColor(parm("Line Color Mid")),
135  QColor(parm("Line Color Min")), parm("Line Width").toFloat(), parm("Line Scale").toFloat(), parm("Threshold").toFloat());
136  }
137 
138  bool run(Mesh *mesh, const QString displayHeatMap, const QString displayAxis, const QColor& qaxisColor1, const QColor& qaxisColor2,
139  const QColor& qaxisColor3, float axisLineWidth, float axisLineScale, float orientationThreshold);
140  };
141 }
142 #endif
mgx::SignalOrientation::run
bool run()
Runs the process.
Definition: MeshProcessSignalOrientation.hpp:31
mgx::DisplaySignalOrientation
Definition: MeshProcessSignalOrientation.hpp:42
mgx::SignalOrientation3D
Definition: MeshProcessSignalOrientation.hpp:82
Process.hpp
mgx::DisplaySignalOrientation::DisplaySignalOrientation
DisplaySignalOrientation(const Process &process)
Definition: MeshProcessSignalOrientation.hpp:45
mgx::DisplaySignalOrientation3D
Definition: MeshProcessSignalOrientation.hpp:104
mgx::DisplaySignalOrientation::run
bool run()
Runs the process.
Definition: MeshProcessSignalOrientation.hpp:67
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::Process
Definition: Process.hpp:219
mgx::SignalOrientation3D::SignalOrientation3D
SignalOrientation3D(const Process &process)
Definition: MeshProcessSignalOrientation.hpp:85
mgx::SignalOrientation3D::run
bool run()
Runs the process.
Definition: MeshProcessSignalOrientation.hpp:93
mgx::Mesh
Definition: Mesh.hpp:54
mgx::SignalOrientation
Definition: MeshProcessSignalOrientation.hpp:18
mgx::DisplaySignalOrientation3D::DisplaySignalOrientation3D
DisplaySignalOrientation3D(const Process &process)
Definition: MeshProcessSignalOrientation.hpp:107
mgx::DisplaySignalOrientation3D::run
bool run()
Runs the process.
Definition: MeshProcessSignalOrientation.hpp:129
mgx::SignalOrientation::SignalOrientation
SignalOrientation(const Process &process)
Definition: MeshProcessSignalOrientation.hpp:21