MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshProcessPDG.hpp
1 #ifndef MESH_PROCESSS_PDG_HPP
2 #define MESH_PROCESSS_PDG_HPP
3 
4 #include <Process.hpp>
5 
6 #include <MeshProcessCellMesh.hpp>
7 
8 namespace mgx {
9 namespace process {
12 
16 public:
17  CorrespondanceJunctions(const MeshProcess& process)
18  : Process(process)
19  , MeshProcess(process)
20  {
21  }
22 
23  bool operator()(const QStringList& parms)
24  {
26  return false;
27  Mesh* mesh1, *mesh2;
28  if(currentMesh() == mesh(0)) {
29  mesh1 = mesh(0);
30  mesh2 = mesh(1);
31  } else if(currentMesh() == mesh(1)) {
32  mesh2 = mesh(0);
33  mesh1 = mesh(1);
34  } else
35  return false;
36 
37  bool res = (*this)(mesh1, mesh2, stringToBool(parms[0]), stringToBool(parms[1]));
38  return res;
39  }
40 
41  bool operator()(Mesh* mesh1, Mesh* mesh2, bool eraseMarginCells, bool ShowVVCorrespondance);
42 
43  QString folder() const {
44  return "Cell Axis/PDG";
45  }
46  QString name() const {
47  return "Check Correspondence";
48  }
50  {
51  return "Find matching cell junctions between 2 meshes based on parent labeling.\n"
52  "Both meshes are simplified with Make Cells to keep only the cell junctions and centers.\n"
53  "SAVE your meshes before running!";
54  }
56  {
57  return QStringList() << "Erase margin cells"
58  << "Show correspondence";
59  }
61  {
62  return QStringList() << "Take away the cells touching the mesh outer edge while converting to a cellular mesh."
63  << "Draw connecting lines between corresponding junctions.";
64  }
66  {
67  return QStringList() << "Yes"
68  << "No";
69  }
71  {
72  ParmChoiceMap map;
73  map[0] = map[1] = booleanChoice();
74  return map;
75  }
76  QIcon icon() const {
77  return QIcon(":/images/CorrespondanceJunctions.png");
78  }
79 };
80 
84 class mgxBase_EXPORT GrowthDirections : public MeshProcess {
85 public:
86  GrowthDirections(const MeshProcess& process)
87  : Process(process)
88  , MeshProcess(process)
89  {
90  }
91  bool operator()(const QStringList& )
92  {
93  if(!checkState().mesh(MESH_NON_EMPTY, 0).mesh(MESH_NON_EMPTY, 1))
94  return false;
95 
96  Mesh* mesh1, *mesh2;
97  if(currentMesh() == mesh(0)) {
98  mesh1 = mesh(0);
99  mesh2 = mesh(1);
100  } else if(currentMesh() == mesh(1)) {
101  mesh2 = mesh(0);
102  mesh1 = mesh(1);
103  } else
104  return false;
105 
106  bool res = (*this)(mesh1, mesh2);
107  return res;
108  }
109 
110  bool operator()(Mesh* mesh1, Mesh* mesh2);
111 
112  QString folder() const {
113  return "Cell Axis/PDG";
114  }
115  QString name() const {
116  return "Compute Growth Directions";
117  }
119  {
120  return "Compute PDGs based on correspondence between junctions.\n"
121  "Adapted from Goodall and Green, 'Quantitative Analysis of Surface Growth.'"
122  "Botanical Gazette (1986) \n"
123  "and Dumais and Kwiatkowska, 'Analysis of surface growth in shoot apices.'"
124  "Plant Journal (2002)";
125  }
127  return QStringList();
128  }
130  return QStringList();
131  }
132  QIcon icon() const {
133  return QIcon(":/images/PDG.png");
134  }
135 };
136 
140 class mgxBase_EXPORT DisplayPDGs : public MeshProcess {
141 public:
142  DisplayPDGs(const MeshProcess& process)
143  : Process(process)
144  , MeshProcess(process)
145  {
146  }
147 
148  bool operator()(const QStringList& parms)
149  {
150  if(!checkState().mesh(MESH_NON_EMPTY))
151  return false;
152 
153  return (*this)(currentMesh(), parms[0], parms[1], QColor(parms[2]), QColor(parms[3]), parms[4].toFloat(),
154  parms[5].toFloat(), parms[6].toFloat(), parms[7].toFloat());
155  }
156 
157  bool operator()(Mesh* mesh, const QString DisplayHeatMap, const QString DisplayPDGs, const QColor& ColorExpansion,
158  const QColor& ColorShrinkage, float AxisLineWidth, float ScaleAxisLength, float AxisOffset,
159  float AnisotropyThreshold);
160 
161  QString folder() const {
162  return "Cell Axis/PDG";
163  }
164  QString name() const {
165  return "Display Growth Directions";
166  }
168  return "Display the principle growth directions";
169  }
171  {
172  return QStringList() << "Heatmap"
173  << "Show Axis"
174  << "Color +"
175  << "Color -"
176  << "Line Width"
177  << "Line Scale"
178  << "Line Offset"
179  << "Threshold";
180  }
182  {
183  return QStringList() << "Display stretch ratio values in max or min direction as a color map.\n"
184  "stretch ratio = (length after/length before). No deformation means stretch ratio = 1."
185  << "Draw directions as vectors, scaled by strain.\n"
186  "strain = (stretch ratio - 1). No deformation means strain = 0. "
187  << "Color used for expansion (strain > 0)"
188  << "Color used for shrinkage (strain < 0)"
189  << "Line Width"
190  << "Length of the vectors = Scale * Strain."
191  << "Draw the vector ends a bit tilted up for proper display on surfaces."
192  << "Minimal value of anisotropy (= stretchMax/StretchMin) required for drawing PDGs.\n"
193  "Use a value above 1.";
194  }
195 
197  {
198  return QStringList() << "StretchMax"
199  << "both"
200  << "white"
201  << "red"
202  << "2.0"
203  << "10.0"
204  << "0.1"
205  << "0.0";
206  }
208  {
209  ParmChoiceMap map;
210  map[0] = QStringList() << "none"
211  << "StretchMax"
212  << "StretchMin"
213  << "Aniso=StretchMax/StretchMin"
214  << "StretchMinXStretchMax";
215  map[1] = QStringList() << "both"
216  << "StrainMax"
217  << "StrainMin"
218  << "none";
219  map[2] = QColor::colorNames();
220  map[3] = QColor::colorNames();
221  return map;
222  }
223  QIcon icon() const {
224  return QIcon(":/images/PDG.png");
225  }
226 };
228 } // namespace process
229 } // namespace mgx
230 #endif
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessPDG.hpp:55
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessPDG.hpp:76
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessPDG.hpp:126
Definition: MeshProcessPDG.hpp:84
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessPDG.hpp:91
Process()
Default constructor.
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessPDG.hpp:65
QString folder() const
Folder in which to place the process.
Definition: MeshProcessPDG.hpp:161
QString folder() const
Folder in which to place the process.
Definition: MeshProcessPDG.hpp:112
QString name() const
Returns the name of the process.
Definition: MeshProcessPDG.hpp:115
CheckState checkState()
Call this function and convert the result to a boolean.
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessPDG.hpp:167
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessPDG.hpp:148
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessPDG.hpp:132
colorNames()
Definition: MeshProcessPDG.hpp:140
File containing the definition of a Process.
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessPDG.hpp:207
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessPDG.hpp:170
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessPDG.hpp:118
Mesh * mesh(int i)
Returns the ith mesh.
This is the main process class, the one all process inherit from.
Definition: Process.hpp:248
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessPDG.hpp:49
Definition: MeshProcessPDG.hpp:15
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessPDG.hpp:223
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessPDG.hpp:70
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessPDG.hpp:196
Non-empty mesh.
Definition: Process.hpp:664
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessPDG.hpp:129
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessPDG.hpp:60
QStringList booleanChoice() const
Helper function that provides a list of choices for a boolean argument.
Definition: Process.hpp:599
Mesh * currentMesh()
Returns the current mesh (i.e.
QString name() const
Returns the name of the process.
Definition: MeshProcessPDG.hpp:46
QString folder() const
Folder in which to place the process.
Definition: MeshProcessPDG.hpp:43
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:855
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessPDG.hpp:181
QString name() const
Returns the name of the process.
Definition: MeshProcessPDG.hpp:164
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessPDG.hpp:23