MorphoGraphX  2.0-1-227
DivisionAnalysisProcesses.hpp
Go to the documentation of this file.
1 #ifndef DIVISION_ANALYSIS_PROCESSES_HPP
2 #define DIVISION_ANALYSIS_PROCESSES_HPP
3 
4 #include <Process.hpp>
6 #include <CellDivision.hpp>
7 
8 
9 namespace mgx {
10 
11 
18  class FilterPlanes : public Process
19  {
20  public:
21  FilterPlanes(const Process& process) : Process(process)
22  {
23  setName("Mesh/Division Analysis/Display and Filter Planes");
24  setDesc("Displays planes of the Division analysis processes");
25  setIcon(QIcon(":/images/DivisionPlane.png"));
26 
27  addParm("Search on","Search on","All Planes", QStringList() << "All Planes" << "Filtered Planes"); // 0
28  addParm("Filter","Filter","Min Area", QStringList() << "None" << "Min Area" << "Max Area" << "Min Angle to Actual" << "Max Angle to Actual" << "Min Volume Ratio" << "Max Volume Ratio" << "Random"); // 1
29  addParm("Number of Planes","Number of Planes","3"); // 2
30  addParm("Min Angle Between Planes","Min Angle Between Planes","10.0"); // 3
31  addParm("Draw Planes","Draw Planes","Yes",booleanChoice()); // 4
32  addParm("Reset Other Mesh","Reset Other Mesh","Yes",booleanChoice()); // 5
33  addParm("Plane Size","Plane Size","10.0"); // 5
34  addParm("Plane Scaling 2D","Plane Scaling 2D","0.92"); // 5
35  addParm("Heat Map","Heat Map","Plane Area Rel Shortest", QStringList() << "None" << "Plane Area Abs" << "Normalized Area"<<"Plane Area Rel Shortest" << "Plane Area Rel Actual" << "Angle to Actual" << "Daughter Ratio" << "Distance Centroid"); // 0
36  addParm("Display Actual Plane","Display Actual Plane","Yes", booleanChoice()); // 5
37  addParm("Select Actual Planes","Select Actual Planes","Yes", booleanChoice());
38  }
39 
40  bool run()
41  {
42  Mesh *m = currentMesh();
43  Mesh *m2;
44  if(currentMesh() == mesh(0))
45  m2 = mesh(1);
46  else
47  m2 = mesh(0);
48  return run(m, m2, parm("Search on"), parm("Filter"), parm("Number of Planes").toInt(), parm("Min Angle Between Planes").toDouble(),
49  stringToBool(parm("Draw Planes")), stringToBool(parm("Reset Other Mesh")), parm("Plane Size").toDouble(),
50  stringToBool(parm("Display Actual Plane")),stringToBool(parm("Select Actual Planes")), parm("Heat Map"));
51  }
52 
53  bool run(Mesh *m, Mesh *m2, QString planes, QString filter, int maxPlanes, double maxSimilarity, bool drawPlanes, bool resetMesh2, double planeSize,
54  bool actual, bool selectActual, QString heatmap);
55 
56  };
57 
64  class ResetDivPlaneData : public Process
65  {
66  public:
67  ResetDivPlaneData(const Process& process) : Process(process)
68  {
69  setName("Mesh/Division Analysis/Reset Division Data");
70  setDesc("Reset Division Data");
71  setIcon(QIcon(":/images/DivisionPlane.png"));
72 
73  addParm("Actual Planes","Actual Planes","Yes", QStringList() << booleanChoice());
74  addParm("Simulated Planes","Simulated Planes","Yes", QStringList() << booleanChoice());
75  addParm("Filtered Planes","Filtered Planes","Yes", QStringList() << booleanChoice());
76  }
77 
78  bool run()
79  {
80  Mesh *m = currentMesh();
81 
82  AttrMap<int, CellDivisionAttr>& actualPlane = m->attributes().attrMap<int, CellDivisionAttr>("Cell Division Actual Plane");
83  AttrMap<int, CellDivisionAttr>& planeData = m->attributes().attrMap<int, CellDivisionAttr>("Cell Division Simulated Planes");
84  AttrMap<int, CellDivisionAttr>& planeDataFiltered = m->attributes().attrMap<int, CellDivisionAttr>("Cell Division Simulated Planes Filtered");
85 
86  if(stringToBool(parm("Actual Planes"))) actualPlane.clear();
87  if(stringToBool(parm("Simulated Planes"))) planeData.clear();
88  if(stringToBool(parm("Filtered Planes"))) planeDataFiltered.clear();
89 
90  return true;
91 
92  }
93  };
94 
95 
96 
104  {
105  public:
106  ComputeDivPlaneAngles(const Process& process) : Process(process)
107  {
108  setName("Mesh/Division Analysis/Compute Division Plane Angles");
109  setDesc("TBD");
110  setIcon(QIcon(":/images/DivisionPlane.png"));
111 
112  addParm("Plane","Plane", "Actual", QStringList() << "Actual" << "Shortest" << "Filtered Best" << "Filtered Worst");
113  addParm("Direction","Direction", "Custom Dir X", QStringList() << "Custom Dir X" << "Custom Dir Y" << "Custom Dir Z" << "Actual");
114 
115  }
116 
117  bool run()
118  {
119  Mesh *m = currentMesh();
120  Mesh *m2;
121  if(currentMesh() == mesh(0))
122  m2 = mesh(1);
123  else
124  m2 = mesh(0);
125  return run(m, m2, parm("Plane"), parm("Direction"));
126  }
127  bool run(Mesh *m, Mesh *m2, QString plane1, QString plane2);
128 
129  };
130 
131 
132 
133 
134 double maxPlaneSimilarity(AttrMap<int, CellDivisionAttr>& cellDivs, CellDivisionAttr cda);
135 }
136 #endif
mgx::ProcessParms::addParm
bool addParm(const QString &parmName, const QString &desc, const QString &def, const QStringList &choices=QStringList())
Add a parameter to the list.
Process.hpp
mgx::FilterPlanes::FilterPlanes
FilterPlanes(const Process &process)
Definition: DivisionAnalysisProcesses.hpp:21
DivisionAnalysisData.hpp
mgx::Mesh::attributes
const Attributes & attributes() const
Get the mesh attributes.
Definition: Mesh.hpp:187
mgx::maxPlaneSimilarity
double maxPlaneSimilarity(AttrMap< int, CellDivisionAttr > &cellDivs, CellDivisionAttr cda)
mgx::ProcessParms::booleanChoice
static QStringList booleanChoice()
Helper function that provides a list of choices for a boolean argument.
Definition: ProcessParms.hpp:83
mgx::ResetDivPlaneData::run
bool run()
Runs the process.
Definition: DivisionAnalysisProcesses.hpp:78
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::ComputeDivPlaneAngles
Definition: DivisionAnalysisProcesses.hpp:103
mgx::ComputeDivPlaneAngles::run
bool run()
Runs the process.
Definition: DivisionAnalysisProcesses.hpp:117
mgx::ProcessParms::setIcon
bool setIcon(const QIcon &icon)
Set the icon.
CellDivision.hpp
mgx::AttrMap::clear
void clear()
Definition: Attributes.hpp:817
mgx::Process
Definition: Process.hpp:219
mgx::ResetDivPlaneData
Definition: DivisionAnalysisProcesses.hpp:64
mgx::stringToBool
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
mgx::FilterPlanes::run
bool run()
Runs the process.
Definition: DivisionAnalysisProcesses.hpp:40
mgx::Attributes::attrMap
AttrMap< KeyT, ValueT > & attrMap(const QString &name, bool saveRequired=true)
Get the attribute, if it does not exist create it and add to the set If it exists,...
Definition: Attributes.hpp:1116
mgx::ProcessParms::setDesc
bool setDesc(const QString &description)
Set the description.
mgx::Mesh
Definition: Mesh.hpp:54
mgx::ResetDivPlaneData::ResetDivPlaneData
ResetDivPlaneData(const Process &process)
Definition: DivisionAnalysisProcesses.hpp:67
mgx::CellDivisionAttr
Definition: CellDivision.hpp:36
mgx::Process::mesh
Mesh * mesh(int i)
Returns the ith mesh.
mgx::FilterPlanes
Definition: DivisionAnalysisProcesses.hpp:18
mgx::ProcessParms::setName
bool setName(const QString &name)
Set the name.
mgx::ProcessParms::parm
QString parm(const QString &name) const
Get a single parameter value by name.
mgx::Process::currentMesh
Mesh * currentMesh()
Returns the current mesh (i.e.
mgx::AttrMap
Attribute map wraps std::map.
Definition: Attributes.hpp:686
mgx::ComputeDivPlaneAngles::ComputeDivPlaneAngles
ComputeDivPlaneAngles(const Process &process)
Definition: DivisionAnalysisProcesses.hpp:106