MorphoGraphX  2.0-1-227
MeshProcessFibril.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 FIBRIL_ORIENTATIONS_HPP
12 #define FIBRIL_ORIENTATIONS_HPP
13 
14 #include <Process.hpp>
15 
16 namespace mgx
17 {
20 
27  class mgxBase_EXPORT FibrilOrientations : public Process {
28  public:
29  FibrilOrientations(const Process& process) : Process(process)
30  {
31  setName("Mesh/Cell Axis/Fibril Orientations/Compute Fibril Orientations");
32  setDesc("Compute principle orientations of lines in the mesh signal (vertex based version). \n"
33  "Based on Boudaoud et al., 'FibrilTool, an ImageJ plug-in to \n"
34  "quantify fibrillar structures in raw microscopy images', Nature Protocols 2014");
35  setIcon(QIcon(":/images/PrincipalOrientations.png"));
36 
37  addParm("Border Size","Width of cell border that is not taken into account for the computation.","1.0");
38  addParm("Min Area Ratio","Minimum ratio of inner area (whole cell - border) vs. total area needed for compuation.","0.25");
39  addParm("Blur Radius","Radius to blur the signal, 0 for none","0.5");
40  addParm("Background Radius","Radius to use for background substraction, 0 for none","0.0");
41  }
42 
43  bool run()
44  {
45  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SIGNAL))
46  return false;
47  Mesh* mesh = currentMesh();
48  return run(mesh, parm("Border Size").toDouble(), parm("Min Area Ratio").toDouble(),
49  parm("Blur Radius").toDouble(), parm("Background Radius").toDouble());
50  }
51 
52  bool run(Mesh* mesh, double border, double minAreaRatio, double blurRadius, double backRadius);
53 
54  };
55 
62  class mgxBase_EXPORT DisplayFibrilOrientations : public Process
63  {
64  public:
65  DisplayFibrilOrientations(const Process& process) : Process(process)
66  {
67  setName("Mesh/Cell Axis/Fibril Orientations/Display Fibril Orientations");
68  setDesc("Display the orientations of fibrils on the image (vertex based version). \n"
69  "Only the maximal direction (main orientation) is displayed as a vector.");
70  setIcon(QIcon(":/images/PrincipalOrientations.png"));
71 
72  addParm("Heatmap","Display orientation strength (= MaxDirection/MinDirection - 1) as a colormap.","none", QStringList() << "none" << "Orientation");
73  addParm("Line Color","Line Color","red", QColor::colorNames());
74  addParm("Line Width","Line Width","1.0");
75  addParm("Line Scale","Length of the vectors = Scale * orientation strength.","1.0");
76  addParm("Line Offset","Draw the vector ends a bit tilted up for proper display on surfaces.","0.1");
77  addParm("Threshold","Minimal value of orientation strength required for drawing main direction.","0.0");
78  }
79 
80  bool run()
81  {
82  if(!checkState().mesh(MESH_NON_EMPTY))
83  return false;
84 
85  return run(currentMesh(), parm("Heatmap"), QColor(parm("Line Color")), parm("Line Width").toFloat(),
86  parm("Line Scale").toFloat(), parm("Line Offset").toFloat(), parm("Threshold").toFloat());
87  }
88 
89  bool run(Mesh* mesh, const QString DisplayHeatMap, const QColor& ColorMax,
90  float AxisLineWidth, float ScaleAxisLength, float AxisOffset, float OrientationThreshold);
91 
92  };
93 
101  class mgxBase_EXPORT FibrilOrientationsVertex : public Process {
102  public:
103  FibrilOrientationsVertex(const Process& process) : Process(process)
104  {
105  setName("Mesh/Cell Axis/Fibril Orientations/Vertex Compute Orientations");
106  setDesc("Compute principle orientations of lines in the mesh signal (vertex based version). \n"
107  "Based on Boudaoud et al., 'FibrilTool, an ImageJ plug-in to \n"
108  "quantify fibrillar structures in raw microscopy images', Nature Protocols 2014");
109  setIcon(QIcon(":/images/PrincipalOrientations.png"));
110 
111  addParm("Border Size","Width of cell border that is not taken into account for the computation.","1.0");
112  addParm("Minimum inner area ratio","Minimum ratio of inner area (whole cell - border) vs. total area needed for compuation.","0.25");
113  addParm("Radius","Radius to use for orientation","2.0");
114  addParm("Blur Radius","Radius to blur the signal","1.0");
115 
116  }
117 
118  bool run()
119  {
120  if(!checkState().mesh(MESH_NON_EMPTY | MESH_SIGNAL))
121  return false;
122  Mesh* m = currentMesh();
123  Mesh *m2;
124  if(currentMesh() == mesh(0))
125  m2 = mesh(1);
126  else
127  m2 = mesh(0);
128  return run(m, m2, parm("Border Size").toFloat(), parm("Minimum inner area ratio").toFloat(), parm("Radius").toFloat(), parm("Blur Radius").toFloat());
129  }
130 
131  bool run(Mesh* m, Mesh* m2, float border, float minAreaRatio, float radius, float blurRadius);
132 
133  };
134 
135 
142  class mgxBase_EXPORT DisplayFibrilOrientationsVertex : public Process
143  {
144  public:
145  DisplayFibrilOrientationsVertex(const Process& process) : Process(process)
146  {
147  setName("Mesh/Cell Axis/Fibril Orientations/Vertex Display Orientations");
148  setDesc("Display the orientations of fibrils on the image (vertex based version). \n"
149  "Only the maximal direction (main orientation) is displayed as a vector.");
150  setIcon(QIcon(":/images/PrincipalOrientations.png"));
151 
152  addParm("Heatmap","Display orientation strength (= MaxDirection/MinDirection - 1) as a colormap.","none", QStringList() << "none" << "Orientation");
153  addParm("Line Color","Line Color","red", QColor::colorNames());
154  addParm("Line Width","Line Width","1.0");
155  addParm("Line Scale","Length of the vectors = Scale * orientation strength.","1.0");
156  addParm("Line Offset","Draw the vector ends a bit tilted up for proper display on surfaces.","0.1");
157  addParm("Threshold","Minimal value of orientation strength required for drawing main direction.","0.0");
158 
159 
160  }
161 
162  bool run()
163  {
164  if(!checkState().mesh(MESH_NON_EMPTY))
165  return false;
166 
167  return run(currentMesh(), parm("Heatmap"), QColor(parm("Line Color")), parm("Line Width").toFloat(),
168  parm("Line Scale").toFloat(), parm("Line Offset").toFloat(), parm("Threshold").toFloat());
169  }
170 
171  bool run(Mesh* mesh, const QString DisplayHeatMap, const QColor& ColorMax,
172  float AxisLineWidth, float ScaleAxisLength, float AxisOffset, float OrientationThreshold);
173 
174  };
175 
176 
184  class mgxBase_EXPORT SelectVerticesOfCell : public Process {
185  public:
186  SelectVerticesOfCell(const Process& process) : Process(process)
187  {
188  setName("Mesh/Cell Axis/Fibril Orientations/Vertices Select");
189  setDesc("Selects vertices of cells that are (roughly) equally spaced and distributed.");
190 
191  addParm("Min Point Distance","Minimum distance between two points","2.0"); // 0
192  addParm("Min Border Distance","Minimum distance of a generated point and a border vertex of the cell","0.0"); // 1
193  addParm("Only Cells With Parent Label","Only Cells With Parent Label","No",booleanChoice()); // 2
194  }
195 
196  bool run()
197  {
198  Mesh* m = currentMesh();
199 
200  return run(m, parm("Min Point Distance").toDouble(), parm("Min Border Distance").toDouble(),
201  stringToBool(parm("Only Cells With Parent Label")));
202  }
203 
204  bool run(Mesh* m, double minPointDis, double minBorderDis, bool ignoreNoParents);
205 
206  };
207 
208 
210 }
211 
212 #endif
mgx::DisplayFibrilOrientations::DisplayFibrilOrientations
DisplayFibrilOrientations(const Process &process)
Definition: MeshProcessFibril.hpp:65
Process.hpp
mgx::DisplayFibrilOrientationsVertex::DisplayFibrilOrientationsVertex
DisplayFibrilOrientationsVertex(const Process &process)
Definition: MeshProcessFibril.hpp:145
mgx::FibrilOrientationsVertex::FibrilOrientationsVertex
FibrilOrientationsVertex(const Process &process)
Definition: MeshProcessFibril.hpp:103
mgx::DisplayFibrilOrientations
Definition: MeshProcessFibril.hpp:62
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::FibrilOrientations::run
bool run()
Runs the process.
Definition: MeshProcessFibril.hpp:43
mgx::FibrilOrientationsVertex
Definition: MeshProcessFibril.hpp:101
mgx::SelectVerticesOfCell::run
bool run()
Runs the process.
Definition: MeshProcessFibril.hpp:196
mgx::Process
Definition: Process.hpp:219
mgx::FibrilOrientations::FibrilOrientations
FibrilOrientations(const Process &process)
Definition: MeshProcessFibril.hpp:29
mgx::stringToBool
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
mgx::SelectVerticesOfCell::SelectVerticesOfCell
SelectVerticesOfCell(const Process &process)
Definition: MeshProcessFibril.hpp:186
mgx::FibrilOrientationsVertex::run
bool run()
Runs the process.
Definition: MeshProcessFibril.hpp:118
mgx::Mesh
Definition: Mesh.hpp:54
mgx::DisplayFibrilOrientations::run
bool run()
Runs the process.
Definition: MeshProcessFibril.hpp:80
mgx::DisplayFibrilOrientationsVertex
Definition: MeshProcessFibril.hpp:142
mgx::DisplayFibrilOrientationsVertex::run
bool run()
Runs the process.
Definition: MeshProcessFibril.hpp:162
mgx::SelectVerticesOfCell
Definition: MeshProcessFibril.hpp:184
mgx::FibrilOrientations
Definition: MeshProcessFibril.hpp:27