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