MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshProcessCurv.hpp
1 #ifndef TISSUECURVATURE_HPP
2 #define TISSUECURVATURE_HPP
3 
4 #include <Process.hpp>
5 
6 #include <MeshProcessCellMesh.hpp>
7 
8 namespace mgx {
9 namespace process {
12 
18 class TissueCurvature : public MeshProcess {
19 public:
20  TissueCurvature(const MeshProcess& process)
21  : Process(process)
22  , MeshProcess(process)
23  {
24  }
25 
26  bool operator()(const QStringList& parms)
27  {
29  return false;
30  bool ok;
31  float neighborhood = parms[0].toFloat(&ok);
32  if(not ok)
33  return setErrorMessage("Error, parameter 'Radius' must be a number");
34  return operator()(currentMesh(), neighborhood, stringToBool(parms[1]));
35  }
36 
37  bool operator()(Mesh* mesh, float neighborhood, bool checkLabel);
38 
39  QString folder() const {
40  return "Cell Axis/Curvature";
41  }
42  QString name() const {
43  return "Compute Tissue Curvature";
44  }
46  {
47  return "Compute curvature based on simplified mesh (from Make Cells) for a neighborhood of given radius.";
48  }
50  return QStringList() << QString("Radius (%1)").arg(UM) << "Selected cell";
51  }
53  return QStringList() << QString("Radius (%1)").arg(UM) << "Selected cell";
54  }
56  {
57  return QStringList() << "10.0"
58  << "No";
59  }
61  {
62  ParmChoiceMap map;
63  map[1] = booleanChoice();
64  return map;
65  }
66  QIcon icon() const {
67  return QIcon(":/images/Curvature.png");
68  }
69 };
70 
78 public:
79  DisplayTissueCurvature(const MeshProcess& process)
80  : Process(process)
81  , MeshProcess(process)
82  {
83  }
84 
85  bool operator()(const QStringList& parms)
86  {
88  return false;
89 
90  bool ok;
91  float heatmapPercentile = parms[2].toFloat(&ok);
92  if(not ok)
93  return setErrorMessage("Error, argument 'Heatmap percentile' must be a number");
94  float axisLineWidth = parms[6].toFloat(&ok);
95  if(not ok)
96  return setErrorMessage("Error, argument 'Line Width' must be a number");
97  float axisLineScale = parms[7].toFloat(&ok);
98  if(not ok)
99  return setErrorMessage("Error, argument 'Line Scale' must be a number");
100  float axisOffset = parms[8].toFloat(&ok);
101  if(not ok)
102  return setErrorMessage("Error, argument 'Line Offset' must be a number");
103  float threshold = parms[9].toFloat(&ok);
104  if(not ok)
105  return setErrorMessage("Error, argument 'Threshold' must be a number");
106 
107  return (*this)(currentMesh(), parms[0], stringToBool(parms[1]), heatmapPercentile, parms[3], QColor(parms[4]),
108  QColor(parms[5]), axisLineWidth, axisLineScale, axisOffset, threshold);
109  }
110 
111  bool operator()(Mesh* mesh, QString DisplayHeatMap, bool compareZero, float heatmapPercentile, QString DisplayCurv,
112  const QColor& ColorExpansion, const QColor& ColorShrinkage, float AxisLineWidth,
113  float AxisLineScale, float AxisOffset, float CurvThreshold);
114 
115  QString folder() const {
116  return "Cell Axis/Curvature";
117  }
118  QString name() const {
119  return "Display Tissue Curvature";
120  }
122  return "Display curvature based on cellular mesh";
123  }
125  {
126  return QStringList() << "Heatmap"
127  << "Compare to 0"
128  << "Heatmap percentile"
129  << "Show Axis"
130  << "Color +"
131  << "Color -"
132  << "Line Width"
133  << "Line Scale"
134  << "Line Offset"
135  << "Threshold";
136  }
137 
139  {
140  return QStringList() << "Display curvature values in max or min direction as a color map.\n"
141  "Average: (CurvMax + CurvMin)/2, SignedAverageAbs: sign(CurvMax or CurvMin) x "
142  "(abs(CurvMax) + abs(CurvMin))/2, \n"
143  "Gaussian:(CurvMax x CurvMin), RootSumSquare: sqrt(CurvMax^2 + CurvMin^2), Anisotropy: "
144  "(CurvMax / CurvMin)."
145  << "Center the color map on zero, if negtive values exist."
146  << "Percentile of values used for color map upper-lower bounds."
147  << "Draw main curvature directions as vectors, scaled by 1/(curvature radius)."
148  << "Color used for convex (curvature > 0)"
149  << "Color used for concave (curvature < 0)"
150  << "Line width"
151  << "Length of the vectors = Scale * 1/(curvature radius)."
152  << "Draw the vector ends a bit tilted up for proper display on surfaces."
153  << "Minimal value of curvature required for drawing the directions.";
154  }
156  {
157  return QStringList() << "SignedAverageAbs"
158  << "Yes"
159  << "85.0"
160  << "Both"
161  << "white"
162  << "red"
163  << "2.0"
164  << "100.0"
165  << "0.1"
166  << "0.0";
167  }
169  {
170  ParmChoiceMap map;
171  map[0] = QStringList() << "none"
172  << "CurvMax"
173  << "CurvMin"
174  << "Average"
175  << "SignedAverageAbs"
176  << "Gaussian"
177  << "RootSumSquare"
178  << "Anisotropy";
179  map[1] = booleanChoice();
180  map[3] = QStringList() << "Both"
181  << "CurvMax"
182  << "CurvMin"
183  << "none";
184  map[4] = QColor::colorNames();
185  map[5] = QColor::colorNames();
186  return map;
187  }
188  QIcon icon() const {
189  return QIcon(":/images/Curvature.png");
190  }
191 };
193 } // namespace process
194 } // namespace mgx
195 
196 #endif
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCurv.hpp:39
QString name() const
Returns the name of the process.
Definition: MeshProcessCurv.hpp:42
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessCurv.hpp:60
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCurv.hpp:26
Once the curvature tensor has been computed, this process allows to change how it is displayed...
Definition: MeshProcessCurv.hpp:77
arg(const QString &a, int fieldWidth=0, const QChar &fillChar=QLatin1Char( ' ')
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCurv.hpp:138
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCurv.hpp:45
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCurv.hpp:66
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCurv.hpp:55
Process()
Default constructor.
QString name() const
Returns the name of the process.
Definition: MeshProcessCurv.hpp:118
CheckState checkState()
Call this function and convert the result to a boolean.
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCurv.hpp:124
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCurv.hpp:115
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessCurv.hpp:168
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCurv.hpp:52
colorNames()
bool setErrorMessage(const QString &str)
Set an error message that will be displayed if the process returns false.
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCurv.hpp:85
File containing the definition of a Process.
Mesh * mesh(int i)
Returns the ith mesh.
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCurv.hpp:49
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCurv.hpp:188
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
Non-empty mesh.
Definition: Process.hpp:664
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 description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCurv.hpp:121
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:855
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCurv.hpp:155
Compute the curvature tensor for each cell of a cell mesh.
Definition: MeshProcessCurv.hpp:18