MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalProcess.hpp
1 #ifndef GLOBALPROCESS_HPP
2 #define GLOBALPROCESS_HPP
3 
4 #include <Process.hpp>
5 
6 namespace mgx {
7 namespace process {
8 
11 
16 class mgxBase_EXPORT SetCurrentStack : public GlobalProcess {
17 public:
18  SetCurrentStack(const GlobalProcess& process)
19  : Process(process)
20  , GlobalProcess(process)
21  {
22  }
23 
24  bool operator()(const QStringList& parms)
25  {
26  bool is_main = stringToMainStore(parms[0]);
27  int id = parms[1].toInt();
28  if(!checkState().store((is_main ? STORE_MAIN : STORE_WORK), id))
29  return false;
30  return (*this)(is_main, id);
31  }
32 
33  bool operator()(bool is_main, int id);
34 
35  QString name() const {
36  return "SetCurrentStack";
37  }
38  QString folder() const {
39  return "System";
40  }
41  QString description() const {
42  return "Change the current stack and mesh. Needed for scripts.";
43  }
45  {
46  return QStringList() << "Store"
47  << "Stack id";
48  }
50  {
51  return QStringList() << "Store"
52  << "Stack id";
53  }
55  {
56  ParmChoiceMap map;
57  map[0] = storeChoice();
58  return map;
59  }
61  {
62  return QStringList() << "Main"
63  << "0";
64  }
65  QIcon icon() const {
66  return QIcon(":/images/Relabel.png");
67  }
68 };
69 
84 class mgxBase_EXPORT SaveGlobalTransform : public QObject, public GlobalProcess {
85  Q_OBJECT
86 
87 public:
88  SaveGlobalTransform(const GlobalProcess& process)
89  : Process(process)
90  , QObject()
91  , GlobalProcess(process)
92  {
93  }
94 
95  bool initialize(QStringList& parms, QWidget* parent);
96 
97  bool operator()(const QStringList& parms) {
98  return (*this)(parms[0]);
99  }
100 
101  bool operator()(const QString& filename);
102 
103  QString folder() const {
104  return "Transform";
105  }
106  QString name() const {
107  return "Save Global Transform";
108  }
110  {
111  return "Save the global alignment (transform) matrix from one stack to the other into a file";
112  }
114  return QStringList() << "Filename";
115  }
117  return QStringList() << "Filename";
118  }
120  return QStringList() << "";
121  }
122  QIcon icon() const {
123  return QIcon(":/images/save.png");
124  }
125 };
126 
137 class mgxBase_EXPORT JoinRegionsSegment : public GlobalProcess {
138 public:
139  JoinRegionsSegment(const GlobalProcess& process)
140  : Process(process)
141  , GlobalProcess(process)
142  {
143  }
144 
145  bool operator()(const QStringList& parms)
146  {
147  if(!checkState().store(STORE_WORK | STORE_LABEL).mesh(MESH_NON_EMPTY))
148  return false;
149  Store* work = currentStack()->work();
150  Mesh* mesh = currentMesh();
151 
152  bool ok;
153  float cubeSize = parms[0].toFloat(&ok);
154  if(not ok)
155  return setErrorMessage("Error, the parameter 'Cube Size' must be a number.");
156 
157  bool res = (*this)(work, mesh, cubeSize);
158  if(res)
159  work->show();
160  return res;
161  }
162 
163  bool operator()(Store* work, Mesh* mesh, float cubeSize);
164 
165  QString name() const {
166  return "JoinRegions Segmentation";
167  }
169  {
170  return "Join Regions after 3D segmentation.\n"
171  "Cells selected in the 3D cell mesh extracted from the stack will be merged and re-extracted.";
172  }
173  QString folder() const {
174  return "Segmentation";
175  }
177  return QStringList() << "Cube Size";
178  }
180  return QStringList() << "Cube Size for the Marching Cube process.";
181  }
183  return QStringList() << "0";
184  }
185  QIcon icon() const {
186  return QIcon(":/images/JoinRegions.png");
187  }
188 };
190 } // namespace process
191 } // namespace mgx
192 
193 #endif
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: GlobalProcess.hpp:122
QStringList parmNames() const
List of named parameters.
Definition: GlobalProcess.hpp:176
ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: GlobalProcess.hpp:54
QStringList parmDefaults() const
List of default parms.
Definition: GlobalProcess.hpp:182
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: GlobalProcess.hpp:145
QStringList parmNames() const
List of named parameters.
Definition: GlobalProcess.hpp:113
QString description() const
Returns a description of the process for the GUI.
Definition: GlobalProcess.hpp:109
QString description() const
Returns a description of the process for the GUI.
Definition: GlobalProcess.hpp:168
QString folder() const
Folder in which to place the process.
Definition: GlobalProcess.hpp:38
QString folder() const
Folder in which to place the process.
Definition: GlobalProcess.hpp:173
QString name() const
Returns the name of the process.
Definition: GlobalProcess.hpp:106
QStringList parmNames() const
List of named parameters.
Definition: GlobalProcess.hpp:44
QStringList parmDescs() const
List of parameters descriptions.
Definition: GlobalProcess.hpp:179
The Store class holds the actual 3D data and properties specific to it.
Definition: Store.hpp:25
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: GlobalProcess.hpp:97
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:167
QString folder() const
Folder in which to place the process.
Definition: GlobalProcess.hpp:103
QStringList parmDefaults() const
List of default parms.
Definition: GlobalProcess.hpp:119
QStringList parmDescs() const
List of parameters descriptions.
Definition: GlobalProcess.hpp:49
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: GlobalProcess.hpp:24
File containing the definition of a Process.
This is the main process class, the one all process inherit from.
Definition: Process.hpp:248
Global processes have full mutable access to all properties of the process.
Definition: Process.hpp:894
QString description() const
Returns a description of the process for the GUI.
Definition: GlobalProcess.hpp:41
QString name() const
Returns the name of the process.
Definition: GlobalProcess.hpp:165
QStringList parmDescs() const
List of parameters descriptions.
Definition: GlobalProcess.hpp:116
Save the transformation from stack 1 to stack 2 in a file.
Definition: GlobalProcess.hpp:84
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: GlobalProcess.hpp:185
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: GlobalProcess.hpp:65
QString name() const
Returns the name of the process.
Definition: GlobalProcess.hpp:35
Join regions, using both the segmented stack and the extracted 3D cell mesh.
Definition: GlobalProcess.hpp:137
mgx_EXPORT bool stringToMainStore(const QString &string)
Returns true if string correspond to the main store, false otherwise.
Set the current stack and store.
Definition: GlobalProcess.hpp:16
QStringList parmDefaults() const
List of default parms.
Definition: GlobalProcess.hpp:60