MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshProcessCellMesh.hpp
1 #ifndef MESH_PROCESS_CELL_MESH_HPP
2 #define MESH_PROCESS_CELL_MESH_HPP
3 
4 #include <Process.hpp>
5 
6 #include <MeshProcessSegmentation.hpp>
7 
8 namespace mgx {
9 namespace process {
12 
22 class mgxBase_EXPORT FixMeshCorners : public MeshProcess {
23 public:
24  FixMeshCorners(const MeshProcess& process)
25  : Process(process)
26  , MeshProcess(process)
27  {
28  }
29 
30  bool operator()(const QStringList& parms)
31  {
32  if(!checkState().mesh(MESH_NON_EMPTY))
33  return false;
34  if(parms[2].toInt() < 1) {
35  setErrorMessage("Number of runs must be at least one.");
36  return false;
37  }
38  return (*this)(currentMesh(), stringToBool(parms[0]), stringToBool(parms[1]), parms[2].toInt());
39  }
40 
41  bool operator()(Mesh* mesh, bool autoSegment, bool selectBadVertices, int maxRun);
42 
43  QString folder() const {
44  return "Cell Mesh";
45  }
46  QString name() const {
47  return "Fix Corners";
48  }
49  QString description() const {
50  return "Fix labelling of cell corners.";
51  }
53  {
54  return QStringList() << "Auto segmentation?"
55  << "Select bad vertices"
56  << "Max iterations";
57  }
59  {
60  return QStringList() << "Re-run watershed automatically at each turn."
61  << "Select remaining bad vertices at the end.\n"
62  "Helps in deleting bad vertices that cannot be segmented properly."
63  << "Maximal number of turns.";
64  }
66  {
67  return QStringList() << "Yes"
68  << "Yes"
69  << "5";
70  }
72  {
73  ParmChoiceMap map;
74  map[0] = booleanChoice();
75  map[1] = booleanChoice();
76  return map;
77  }
78  QIcon icon() const {
79  return QIcon(":/images/FixCorners.png");
80  }
81 };
82 
89 class mgxBase_EXPORT MakeCellMesh : public MeshProcess {
90 public:
91  MakeCellMesh(const MeshProcess& process)
92  : Process(process)
93  , MeshProcess(process)
94  {
95  }
96 
97  bool operator()(const QStringList& parms)
98  {
99  if(!checkState().mesh(MESH_NON_EMPTY) or checkState().mesh(MESH_CELLS))
100  return false;
101  return (*this)(currentMesh(), parms[1].toFloat(), currentMesh()->graph(), stringToBool(parms[0]));
102  }
103 
104  bool operator()(Mesh* mesh, float minWall, vvgraph& S, bool eraseMarginCells);
105 
106  QString folder() const {
107  return "Cell Mesh";
108  }
109  QString name() const {
110  return "Make Cells";
111  }
113  {
114  return "Convert the segmented mesh into a 2D cellular mesh.\n"
115  "The simplified mesh contains only vertices for cell centers and cell outlines";
116  }
118  {
119  return QStringList() << "Erase Margin Cells" << QString("Min Wall Length (%1)").arg(UM);
120  }
122  {
123  return QStringList() << "Delete cells that touch the edge of the mesh."
124  << "Min length in between vertices within cell outlines.";
125  }
127  {
128  return QStringList() << "No"
129  << "1";
130  }
132  {
133  ParmChoiceMap map;
134  map[0] = booleanChoice();
135  return map;
136  }
137  QIcon icon() const {
138  return QIcon(":/images/MakeCells.png");
139  }
140 };
142 } // namespace process
143 } // namespace mgx
144 #endif
Fix labelling of cell corners.
Definition: MeshProcessCellMesh.hpp:22
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCellMesh.hpp:49
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCellMesh.hpp:65
QString name() const
Returns the name of the process.
Definition: MeshProcessCellMesh.hpp:46
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCellMesh.hpp:78
Convert a segmented mesh into a 2D cellular mesh.
Definition: MeshProcessCellMesh.hpp:89
arg(const QString &a, int fieldWidth=0, const QChar &fillChar=QLatin1Char( ' ')
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessCellMesh.hpp:71
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCellMesh.hpp:30
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCellMesh.hpp:126
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCellMesh.hpp:97
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCellMesh.hpp:106
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: MeshProcessCellMesh.hpp:117
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCellMesh.hpp:121
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessCellMesh.hpp:131
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCellMesh.hpp:58
File containing the definition of a Process.
This is the main process class, the one all process inherit from.
Definition: Process.hpp:248
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCellMesh.hpp:52
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCellMesh.hpp:112
QString name() const
Returns the name of the process.
Definition: MeshProcessCellMesh.hpp:109
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCellMesh.hpp:43
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:855
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCellMesh.hpp:137