MorphoGraphX  2.0-1-227
MeshProcessExport.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2016 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 MESHPROCESSEXPORT_HPP
12 #define MESHPROCESSEXPORT_HPP
13 #include <Process.hpp>
14 
15 #include <QFileDialog>
16 #include <GraphUtils.hpp>
17 #include <QTreeWidget>
18 
19 #include <MeshProcessPDG.hpp> //jInfo
20 
21 class Ui_PlyCellGraphDlg;
22 
23 namespace mgx
24 {
25 
26 
27  struct PlyCellData{
28 
29  QString name, type;
30 
31  std::map<int, int> intData;
32  std::map<int, float> floatData;
33  std::map<int, Point3f> pointData;
34  std::map<int, SymmetricTensor> tensorData;
35 
36  };
37 
38  struct PlyWallData{
39 
40  QString name, type;
41  std::map<std::pair<int, int>, int> intData;
42  std::map<std::pair<int, int>, float> floatData;
43  std::map<std::pair<int, int>, Point3f> pointData;
44  std::map<std::pair<int, int>, SymmetricTensor> tensorData;
45 
46 
47  };
48 
49 
50  void createPlyDataFromAttr(Mesh* m, QStringList attrMapsToBeSaved, std::vector<PlyCellData>& cellVec, std::vector<PlyWallData>& wallVec);
51  void fillTreeWidgetWithAttrMaps(Mesh* m, QTreeWidget* tree, QStringList *selected = 0);
52 
53  class mgxBase_EXPORT SavePlyFile : public Process
54  {
55  Q_OBJECT
56  public:
57  QStringList attrMapsToBeSaved;
58 
59  Ui_PlyCellGraphDlg* ui;
60 
61  SavePlyFile(const Process& process) : Process(process)
62  {
63  setName("Mesh/Export/Cell Graph Ply File Save");
64  setDesc("Saves a standard PLY file and a cell graph PLY file with specified attributes. If Marion's file is selected than it will create a file with a fixed set of attributes.");
65  setIcon(QIcon(":/images/MakeHeatMap.png"));
66 
67  addParm("Filename","Filename","");
68  addParm("Mesh Type","Mesh Type","2D", QStringList() << "2D" << "3D");
69  }
70  bool processParms();
71 
72  bool initialize(QWidget* parent);
73 
74  bool run()
75  {
76  if(!checkState().mesh(MESH_ANY))
77  return false;
78  Mesh *mesh = currentMesh();
79  return run(mesh, parm("Filename"), parm("Mesh Type"));
80  }
81 
82  bool run(Mesh* mesh, QString filename, QString meshType);
83 
84  public slots:
85 
86  void selectAll();
87  void unselectAll();
88  };
89 
90  class mgxBase_EXPORT LoadPlyFileCellGraph : public Process
91  {
92  public:
93  LoadPlyFileCellGraph(const Process& process) : Process(process)
94  {
95  setName("Mesh/Export/Cell Graph Ply File Load");
96  setDesc("Loads Cell Graph data from a file and creates Attribute Maps from the data.");
97  setIcon(QIcon(":/images/MakeHeatMap.png"));
98 
99  addParm("Filename","Filename","");
100  }
101 
102  bool processParms();
103 
104  bool initialize(QWidget* parent);
105 
106  bool run()
107  {
108  if(!checkState().mesh(MESH_ANY))
109  return false;
110  Mesh *mesh = currentMesh();
111  return run(mesh, parm("Filename"));
112  }
113 
114  bool run(Mesh* mesh, const QString& filename);
115 
116  };
117 
118  class mgxBase_EXPORT SaveCellContourFile : public Process
119  {
120  public:
121  SaveCellContourFile(const Process& process) : Process(process)
122  {
123  setName("Mesh/Export/Cell Contour File Save");
124  setDesc("Saves a cell contour file to be used in Babak's leaf interogator software");
125  setIcon(QIcon(":/images/MakeHeatMap.png"));
126 
127  addParm("Filename","Filename","");
128  }
129 
130  bool processParms();
131 
132  bool initialize(QWidget* parent);
133 
134  bool run()
135  {
136  if(!checkState().mesh(MESH_ANY))
137  return false;
138  Mesh *mesh = currentMesh();
139  return run(mesh, parm("Filename"));
140  }
141 
142  bool run(Mesh* mesh, const QString& filename);
143 
144  };
145 
146 
152  class mgxBase_EXPORT ExportInternalAngles : public Process {
153  public:
154  ExportInternalAngles(const Process& proc) : Process(proc)
155  {
156  setName("Mesh/Export/Export Internal Angles");
157  setDesc("TBD");
158  setIcon(QIcon(":/images/open.png"));
159 
160  addParm("Filename","Filename","");
161  addParm("Junction Merging Threshold","Junction Merging Threshold","0.1");
162 
163  }
164 
165  bool run()
166  {
167  Mesh* m = currentMesh();
168  return run(m, parm("Filename"), parm("Junction Merging Threshold").toDouble());
169  }
170  bool run(Mesh* m, QString filename, double threshold);
171 
172  bool initialize(QWidget* parent);
173  };
174 
180  class mgxBase_EXPORT ExportJunctionAngles : public Process {
181  public:
182  ExportJunctionAngles(const Process& proc) : Process(proc)
183  {
184  setName("Mesh/Export/Export Junction Angles");
185  setDesc("Compute wall angles at the cell junctions and export them to a file.");
186  setIcon(QIcon(":/images/open.png"));
187 
188  addParm("Filename","Filename","");
189  addParm("Inclusion Radius","Inclusion Radius","1.0");
190  addParm("Method","Method","Furthest", QStringList() << "Closest" << "Average" << "Furthest");
191 
192  }
193 
194  bool run()
195  {
196  Mesh* m = currentMesh();
197  Mesh* m2 = otherMesh();
198  return run(m, m2, parm("Filename"), parm("Inclusion Radius").toDouble(), parm("Method"));
199  }
200  bool run(Mesh* m, Mesh* m2, QString filename, double thresholdDis, QString method);
201 
202  bool initialize(QWidget* parent);
203  };
204 
210  class mgxBase_EXPORT ExportJunctionAnglesNew : public Process {
211  public:
213  {
214  setName("Mesh/Export/Export Junction Angles New");
215  setDesc("Compute wall angles at the cell junctions and export them to a file.");
216  setIcon(QIcon(":/images/open.png"));
217 
218  addParm("Filename","Filename","");
219  addParm("Inclusion Radius","Inclusion Radius","1.0");
220  addParm("Method","Method","Furthest", QStringList() << "Closest" << "Average" << "Furthest");
221  addParm("Change Map","Change Map","No",booleanChoice());
222 
223  }
224 
225  bool run()
226  {
227  Mesh* m = currentMesh();
228  Mesh* m2 = otherMesh();
229  return run(m, m2, parm("Filename"), parm("Inclusion Radius").toDouble(), parm("Method"), stringToBool(parm("Change Map")));
230  }
231  bool run(Mesh* m, Mesh* m2, QString filename, double thresholdDis, QString method, bool changeMap);
232 
233  bool initialize(QWidget* parent);
234  };
235 
236 }
237 
238 #endif
mgx::ExportJunctionAnglesNew::run
bool run()
Runs the process.
Definition: MeshProcessExport.hpp:225
mgx::PlyCellData::name
QString name
Definition: MeshProcessExport.hpp:29
mgx::PlyCellData::tensorData
std::map< int, SymmetricTensor > tensorData
Definition: MeshProcessExport.hpp:34
mgx::PlyCellData::pointData
std::map< int, Point3f > pointData
Definition: MeshProcessExport.hpp:33
mgx::SavePlyFile
Definition: MeshProcessExport.hpp:53
Process.hpp
mgx::PlyCellData::intData
std::map< int, int > intData
Definition: MeshProcessExport.hpp:31
mgx::ExportJunctionAnglesNew
Definition: MeshProcessExport.hpp:210
mgx::SavePlyFile::run
bool run()
Runs the process.
Definition: MeshProcessExport.hpp:74
mgx::PlyWallData::floatData
std::map< std::pair< int, int >, float > floatData
Definition: MeshProcessExport.hpp:42
GraphUtils.hpp
mgx::SymmetricTensor
Definition: SymmetricTensor.hpp:59
mgx::PlyCellData::floatData
std::map< int, float > floatData
Definition: MeshProcessExport.hpp:32
mgx::createPlyDataFromAttr
void createPlyDataFromAttr(Mesh *m, QStringList attrMapsToBeSaved, std::vector< PlyCellData > &cellVec, std::vector< PlyWallData > &wallVec)
mgx::PlyCellData
Definition: MeshProcessExport.hpp:27
mgx::ExportInternalAngles::ExportInternalAngles
ExportInternalAngles(const Process &proc)
Definition: MeshProcessExport.hpp:154
mgx::ExportInternalAngles::run
bool run()
Runs the process.
Definition: MeshProcessExport.hpp:165
mgx::ExportJunctionAngles::ExportJunctionAngles
ExportJunctionAngles(const Process &proc)
Definition: MeshProcessExport.hpp:182
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::ExportJunctionAngles::run
bool run()
Runs the process.
Definition: MeshProcessExport.hpp:194
mgx::SavePlyFile::ui
Ui_PlyCellGraphDlg * ui
Definition: MeshProcessExport.hpp:59
mgx::PlyCellData::type
QString type
Definition: MeshProcessExport.hpp:29
mgx::Process
Definition: Process.hpp:219
mgx::PlyWallData::tensorData
std::map< std::pair< int, int >, SymmetricTensor > tensorData
Definition: MeshProcessExport.hpp:44
mgx::stringToBool
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
mgx::PlyWallData::intData
std::map< std::pair< int, int >, int > intData
Definition: MeshProcessExport.hpp:41
mgx::SaveCellContourFile::run
bool run()
Runs the process.
Definition: MeshProcessExport.hpp:134
mgx::fillTreeWidgetWithAttrMaps
void fillTreeWidgetWithAttrMaps(Mesh *m, QTreeWidget *tree, QStringList *selected=0)
mgx::SavePlyFile::attrMapsToBeSaved
QStringList attrMapsToBeSaved
Definition: MeshProcessExport.hpp:57
mgx::SaveCellContourFile
Definition: MeshProcessExport.hpp:118
mgx::Mesh
Definition: Mesh.hpp:54
mgx::ExportInternalAngles
Definition: MeshProcessExport.hpp:152
mgx::SavePlyFile::SavePlyFile
SavePlyFile(const Process &process)
Definition: MeshProcessExport.hpp:61
mgx::PlyWallData::type
QString type
Definition: MeshProcessExport.hpp:40
mgx::Vector< 3, float >
mgx::PlyWallData::pointData
std::map< std::pair< int, int >, Point3f > pointData
Definition: MeshProcessExport.hpp:43
MeshProcessPDG.hpp
mgx::PlyWallData
Definition: MeshProcessExport.hpp:38
mgx::LoadPlyFileCellGraph::LoadPlyFileCellGraph
LoadPlyFileCellGraph(const Process &process)
Definition: MeshProcessExport.hpp:93
mgx::SaveCellContourFile::SaveCellContourFile
SaveCellContourFile(const Process &process)
Definition: MeshProcessExport.hpp:121
mgx::LoadPlyFileCellGraph
Definition: MeshProcessExport.hpp:90
mgx::ExportJunctionAnglesNew::ExportJunctionAnglesNew
ExportJunctionAnglesNew(const Process &proc)
Definition: MeshProcessExport.hpp:212
mgx::LoadPlyFileCellGraph::run
bool run()
Runs the process.
Definition: MeshProcessExport.hpp:106
mgx::ExportJunctionAngles
Definition: MeshProcessExport.hpp:180
mgx::PlyWallData::name
QString name
Definition: MeshProcessExport.hpp:40