MorphoGraphX
MeshProcessCellMesh.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_PROCESS_CELL_MESH_HPP
12 #define MESH_PROCESS_CELL_MESH_HPP
13 
14 #include <Process.hpp>
15 
16 #include <MeshProcessSegmentation.hpp>
17 
18 namespace mgx {
19 namespace process {
22 
32 class mgxBase_EXPORT FixMeshCorners : public MeshProcess {
33 public:
35  : Process(process)
36  , MeshProcess(process)
37  {
38  }
39 
40  bool operator()(const QStringList& parms)
41  {
42  if(!checkState().mesh(MESH_NON_EMPTY))
43  return false;
44  if(parms[2].toInt() < 1) {
45  setErrorMessage("Number of runs must be at least one.");
46  return false;
47  }
48  return (*this)(currentMesh(), stringToBool(parms[0]), stringToBool(parms[1]), parms[2].toInt());
49  }
50 
51  bool operator()(Mesh* mesh, bool autoSegment, bool selectBadVertices, int maxRun);
52 
53  QString folder() const {
54  return "Cell Mesh";
55  }
56  QString name() const {
57  return "Fix Corners";
58  }
59  QString description() const {
60  return "Fix labelling of cell corners.";
61  }
63  {
64  return QStringList() << "Auto segmentation?"
65  << "Select bad vertices"
66  << "Max iterations";
67  }
69  {
70  return QStringList() << "Re-run watershed automatically at each turn."
71  << "Select remaining bad vertices at the end.\n"
72  "Helps in deleting bad vertices that cannot be segmented properly."
73  << "Maximal number of turns.";
74  }
76  {
77  return QStringList() << "Yes"
78  << "Yes"
79  << "5";
80  }
82  {
83  ParmChoiceMap map;
84  map[0] = booleanChoice();
85  map[1] = booleanChoice();
86  return map;
87  }
88  QIcon icon() const {
89  return QIcon(":/images/FixCorners.png");
90  }
91 };
92 
99 class mgxBase_EXPORT MakeCellMesh : public MeshProcess {
100 public:
102  : Process(process)
103  , MeshProcess(process)
104  {
105  }
106 
107  bool operator()(const QStringList& parms)
108  {
109  if(!checkState().mesh(MESH_NON_EMPTY) or checkState().mesh(MESH_CELLS))
110  return false;
111  return (*this)(currentMesh(), parms[1].toFloat(), currentMesh()->graph(), stringToBool(parms[0]));
112  }
113 
114  bool operator()(Mesh* mesh, float minWall, vvgraph& S, bool eraseMarginCells);
115 
116  QString folder() const {
117  return "Cell Mesh";
118  }
119  QString name() const {
120  return "Make Cells";
121  }
123  {
124  return "Convert the segmented mesh into a 2D cellular mesh.\n"
125  "The simplified mesh contains only vertices for cell centers and cell outlines";
126  }
128  {
129  return QStringList() << "Erase Margin Cells" << QString("Min Wall Length (%1)").arg(UM);
130  }
132  {
133  return QStringList() << "Delete cells that touch the edge of the mesh."
134  << "Min length in between vertices within cell outlines.";
135  }
137  {
138  return QStringList() << "No"
139  << "1";
140  }
142  {
143  ParmChoiceMap map;
144  map[0] = booleanChoice();
145  return map;
146  }
147  QIcon icon() const {
148  return QIcon(":/images/MakeCells.png");
149  }
150 };
152 } // namespace process
153 } // namespace mgx
154 #endif
Fix labelling of cell corners.
Definition: MeshProcessCellMesh.hpp:32
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCellMesh.hpp:59
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCellMesh.hpp:75
QString name() const
Returns the name of the process.
Definition: MeshProcessCellMesh.hpp:56
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCellMesh.hpp:88
Convert a segmented mesh into a 2D cellular mesh.
Definition: MeshProcessCellMesh.hpp:99
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:81
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCellMesh.hpp:40
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCellMesh.hpp:136
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCellMesh.hpp:107
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCellMesh.hpp:116
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:177
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCellMesh.hpp:127
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCellMesh.hpp:131
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: MeshProcessCellMesh.hpp:141
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCellMesh.hpp:68
File containing the definition of a Process.
This is the main process class, the one all process inherit from.
Definition: Process.hpp:258
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.
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCellMesh.hpp:62
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCellMesh.hpp:122
QString name() const
Returns the name of the process.
Definition: MeshProcessCellMesh.hpp:119
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCellMesh.hpp:53
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:865
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCellMesh.hpp:147