MorphoGraphX  2.0-1-227
GlobalProcess.hpp
Go to the documentation of this file.
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 GLOBALPROCESS_HPP
12 #define GLOBALPROCESS_HPP
13 
14 #include <Process.hpp>
15 
16 namespace mgx
17 {
20 
25  class mgxBase_EXPORT SetCurrentStack : public Process
26  {
27  public:
28  SetCurrentStack(const Process& process) : Process(process)
29  {
30  setName("Stack/System/Set Current Stack");
31  setDesc("Change the current stack and mesh. Needed for scripts.");
32  setIcon(QIcon(":/images/Relabel.png"));
33 
34  addParm("Store","Current store, or 'Both'","Main", QStringList() << "Main" << "Work" << "Both" << "None");
35  addParm("Stack id","Stack id","0");
36  }
37 
38  bool run()
39  {
40  bool is_main = stringToMainStore(parm("Store"));
41  int id = parm("Stack id").toInt();
42  return run(parm("Store"), id);
43  }
44 
45  bool run(const QString &store, int id);
46  };
47 
62  class mgxBase_EXPORT SaveGlobalTransform : public Process {
63  Q_OBJECT
64 
65  public:
66  SaveGlobalTransform(const Process& process) : Process(process)
67  {
68 
69  setName("Misc/Transform/Save Global Transform");
70  setDesc("Save the global alignment (transform) matrix from one stack to the other into a file");
71 
72  setIcon(QIcon(":/images/save.png"));
73  addParm("Filename","Filename","");
74  }
75 
76  bool initialize(QWidget* parent);
77 
78  bool run() { return run(parm("Filename")); }
79 
80  bool run(const QString& filename);
81  };
82 
93  class mgxBase_EXPORT JoinRegionsSegment : public Process {
94  public:
95  JoinRegionsSegment(const Process& process) : Process(process)
96  {
97  setName("Stack/Segmentation/Join Regions");
98  setDesc("Join Regions after 3D segmentation.Cells selected in the 3D cell mesh extracted from the stack will be merged and re-extracted.");
99  setIcon(QIcon(":/images/JoinRegions.png"));
100 
101  addParm("Cube Size","Cube Size for the Marching Cube process.","0");
102  }
103 
104  bool run()
105  {
106  if(!checkState().store(STORE_WORK | STORE_LABEL).mesh(MESH_NON_EMPTY))
107  return false;
108  Store* work = currentStack()->work();
109  Mesh* mesh = currentMesh();
110 
111  bool ok;
112  float cubeSize = parm("Cube Size").toFloat(&ok);
113  if(not ok)
114  return setErrorMessage("Error, the parameter 'Cube Size' must be a number.");
115 
116  bool res = run(work, mesh, cubeSize);
117  if(res)
118  work->show();
119  return res;
120  }
121 
122  bool run(Store* work, Mesh* mesh, float cubeSize);
123  };
125 }
126 
127 #endif
Process.hpp
mgx::SetCurrentStack
Definition: GlobalProcess.hpp:25
mgx::SetCurrentStack::SetCurrentStack
SetCurrentStack(const Process &process)
Definition: GlobalProcess.hpp:28
mgx::SaveGlobalTransform::run
bool run()
Runs the process.
Definition: GlobalProcess.hpp:78
mgx::JoinRegionsSegment
Definition: GlobalProcess.hpp:93
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::Process
Definition: Process.hpp:219
mgx::stringToMainStore
mgx_EXPORT bool stringToMainStore(const QString &string)
Returns true if string correspond to the main store, false otherwise.
mgx::Store::show
void show()
Ask the user interface to show this store.
Definition: Store.hpp:162
mgx::SaveGlobalTransform::SaveGlobalTransform
SaveGlobalTransform(const Process &process)
Definition: GlobalProcess.hpp:66
mgx::Mesh
Definition: Mesh.hpp:54
mgx::SetCurrentStack::run
bool run()
Runs the process.
Definition: GlobalProcess.hpp:38
mgx::JoinRegionsSegment::JoinRegionsSegment
JoinRegionsSegment(const Process &process)
Definition: GlobalProcess.hpp:95
mgx::SaveGlobalTransform
Definition: GlobalProcess.hpp:62
mgx::JoinRegionsSegment::run
bool run()
Runs the process.
Definition: GlobalProcess.hpp:104
mgx::Store
Definition: Store.hpp:33