MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MeshProcessCreation.hpp
1 #ifndef MESH_PROCESS_CREATION_HPP
2 #define MESH_PROCESS_CREATION_HPP
3 
4 #include <Process.hpp>
5 
6 #include <Polygonizer.hpp>
7 
8 namespace mgx {
9 namespace process {
12 
18 class mgxBase_EXPORT MarchingCubeSurface : public MeshProcess, public util::ImplicitFunction {
19 public:
20  MarchingCubeSurface(const MeshProcess& process)
21  : Process(process)
22  , MeshProcess(process)
23  , progress("Marching Cubes Surface", 0)
24  {
25  }
26 
27  bool operator()(const QStringList& parms)
28  {
29  if(!checkState().store(STORE_NON_EMPTY).mesh())
30  return false;
31 
32  _stack = currentStack();
33  _store = _stack->currentStore();
34  Mesh* mesh = currentMesh();
35 
36  bool result = (*this)(mesh, _store, parms[0].toFloat(), parms[1].toInt());
37  if(result)
38  mesh->showSignal();
39  if(result and not mesh->isSurfaceVisible() and not mesh->isMeshVisible())
40  mesh->showSurface();
41  return result;
42  }
43 
44  bool operator()(Mesh* mesh, const Store* store, float cubeSize, int threshold);
45 
46  QString folder() const {
47  return "Creation";
48  }
49  QString name() const {
50  return "Marching Cubes Surface";
51  }
53  {
54  return "Extract surface mesh with marching cubes. A threshold to 0 will interpret the image as binary.";
55  }
57  return QStringList() << QString("Cube size (%1)").arg(UM) << "Threshold";
58  }
60  {
61  return QStringList() << "Size for the marching cubes."
62  << "Minimal signal used for surface extraction.";
63  }
65  {
66  return QStringList() << "5.0"
67  << "5000";
68  }
69  QIcon icon() const {
70  return QIcon(":/images/MarchCubes.png");
71  }
72 
73  bool eval(Point3f p);
74 
75 private:
76  int _threshold;
77  const Stack* _stack;
78  const Store* _store;
79  Progress progress;
80 };
81 
88 class mgxBase_EXPORT MarchingCube3D : public MeshProcess, public util::ImplicitFunction {
89 public:
90  MarchingCube3D(const MeshProcess& process)
91  : Process(process)
92  , MeshProcess(process)
93  , progress("Marching Cubes 3D", 0)
94  {
95  }
96 
97  bool operator()(const QStringList& parms)
98  {
99  if(!checkState().store(STORE_LABEL).mesh())
100  return false;
101 
102  _stack = currentStack();
103  _store = _stack->currentStore();
104  Mesh* mesh = currentMesh();
105 
106  bool result = (*this)(mesh, _store, parms[0].toFloat(), parms[1].toInt(), parms[2].toInt(), parms[3].toInt());
107  if(result)
108  mesh->showLabel();
109  if(result and not mesh->isSurfaceVisible() and not currentMesh()->isMeshVisible())
110  currentMesh()->showSurface();
111  return result;
112  }
113 
114  bool operator()(Mesh* mesh, const Store* store, float cubeSize, int minVoxels, int smooth, int singleLabel);
115 
116  QString folder() const {
117  return "Creation";
118  }
119  QString name() const {
120  return "Marching Cubes 3D";
121  }
123  return "Extract 3D meshes with marching cubes";
124  }
126  {
127  return QStringList() << QString("Cube size (%1)").arg(UM) << "Min Voxels"
128  << "Smooth Passes"
129  << "Label";
130  }
132  {
133  return QStringList() << "Size for the marching cubes."
134  << "Minimal number of voxels for extracting surface."
135  << "Smooth Passes."
136  << "Extract surface only for this label.";
137  }
139  {
140  return QStringList() << "5.0"
141  << "0"
142  << "3"
143  << "0";
144  }
145  QIcon icon() const {
146  return QIcon(":/images/MarchCubes3D.png");
147  }
148 
149  bool eval(Point3f p);
150 
151 private:
152  int _label;
153  const Stack* _stack;
154  const Store* _store;
155  Progress progress;
156 };
157 
164 class mgxBase_EXPORT CuttingSurfMesh : public MeshProcess {
165 public:
166  CuttingSurfMesh(const MeshProcess& process)
167  : Process(process)
168  , MeshProcess(process)
169  {
170  }
171 
172  bool operator()(const QStringList& )
173  {
174  if(!checkState().mesh())
175  return false;
176  return (*this)(currentMesh());
177  }
178 
179  bool operator()(Mesh* mesh);
180 
181  QString folder() const {
182  return "Creation";
183  }
184  QString name() const {
185  return "Mesh Cutting Surface";
186  }
188  return "Make mesh from cutting surface";
189  }
191  return QStringList();
192  }
194  return QStringList();
195  }
196  QIcon icon() const {
197  return QIcon(":/images/MakePlane.png");
198  }
199 };
201 } // namespace process
202 } // namespace mgx
203 
204 #endif
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCreation.hpp:27
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCreation.hpp:196
Definition: Polygonizer.hpp:26
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCreation.hpp:190
arg(const QString &a, int fieldWidth=0, const QChar &fillChar=QLatin1Char( ' ')
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCreation.hpp:56
QString name() const
Returns the name of the process.
Definition: MeshProcessCreation.hpp:49
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCreation.hpp:193
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCreation.hpp:116
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCreation.hpp:131
The Store class holds the actual 3D data and properties specific to it.
Definition: Store.hpp:25
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
Definition: MeshProcessCreation.hpp:88
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCreation.hpp:138
Create a surface matching the current cutting surface, whether it's a plane or a Bezier surface...
Definition: MeshProcessCreation.hpp:164
QStringList parmNames() const
List of named parameters.
Definition: MeshProcessCreation.hpp:125
Definition: Progress.hpp:89
bool operator()(const QStringList &)
Implementation of the process with generic arguments.
Definition: MeshProcessCreation.hpp:172
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: MeshProcessCreation.hpp:97
Find the surface of a volume defined by an iso-surface on the image intensity using a variation on th...
Definition: MeshProcessCreation.hpp:18
File containing the definition of a Process.
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:25
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: MeshProcessCreation.hpp:145
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: MeshProcessCreation.hpp:187
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCreation.hpp:122
QString name() const
Returns the name of the process.
Definition: MeshProcessCreation.hpp:119
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCreation.hpp:181
QString description() const
Returns a description of the process for the GUI.
Definition: MeshProcessCreation.hpp:52
QString folder() const
Folder in which to place the process.
Definition: MeshProcessCreation.hpp:46
QStringList parmDefaults() const
List of default parms.
Definition: MeshProcessCreation.hpp:64
QString name() const
Returns the name of the process.
Definition: MeshProcessCreation.hpp:184
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: MeshProcessCreation.hpp:69
QStringList parmDescs() const
List of parameters descriptions.
Definition: MeshProcessCreation.hpp:59