MorphoGraphX  2.0-1-227
StackProcessAnalyses.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 STACKPROCESSANALYSES_HPP
12 #define STACKPROCESSANALYSES_HPP
13 
14 #include <Process.hpp>
15 
16 namespace mgx
17 {
20 
28  class mgxBase_EXPORT ComputeVolume : public Process
29  {
30  public:
31  ComputeVolume(const Process& process) : Process(process)
32  {
33  setName("Stack/Analyses/Compute Volumes");
34  setDesc("Compute the volumes of the labels, i.e. the number of voxels multiplied by the voxel size.");
35  setIcon(QIcon(":/images/CellFiles3D.png"));
36 
37  addParm("Filename","Filename","output.csv");
38  }
39 
40  bool run()
41  {
42  if(!checkState().store(STORE_NON_EMPTY | STORE_LABEL))
43  return false;
44  Store* input = currentStack()->currentStore();
45  return run(input, parm("Filename"));
46  }
47 
48  bool run(const Store* input, QString filename);
49 
50  };
51 
52 
53 class mgxBase_EXPORT StackVoxelCount : public Process
54  {
55  public:
56  StackVoxelCount(const Process& process) : Process(process)
57  {
58  setName("Stack/Analyses/Export Voxel Count");
59  setDesc("Count the occurance of different voxel values along the z-axis and export it to a file");
60  setIcon(QIcon(":/images/MakeHeatMap.png"));
61 
62  addParm("Filename","Filename","");
63  }
64  //bool initialize(QStringList& parms, QWidget* parent);
65 
66  bool run()
67  {
68  Stack* s1 = currentStack();
69  Store* store1 = s1->main();
70  //Store* store2 = s1->work();
71  //Mesh* m = currentMesh();
72  return run(s1, store1, parm("Filename"));
73  }
74  bool run(Stack* s1, Store* store1, QString filename);
75 
76  };
77 
78 class mgxBase_EXPORT StackCircularHistogram : public Process
79  {
80  public:
81  StackCircularHistogram(const Process& process) : Process(process)
82  {
83  setName("Stack/Analyses/Export Histogram Circular");
84  setDesc("Computes a circular histogram in counter-clockwise direction of the active main store signal values around the given cartesian axis.");
85  setIcon(QIcon(":/images/StackHistoCirc.png"));
86 
87  addParm("Central Axis","Central Axis","Z", QStringList() << "X" << "Y" << "Z");
88  addParm("Bin Number","Number of bins for the whole circle","360");
89  addParm("Voxel Value Threshold (%)","Ignore voxels with values lower than this threshold (% from 16bit value). Set to 0 to include all. Ignoring low values can speed this process up significantly","1.0");
90  addParm("Voxel Distance Min (um)","Only consider voxels with a minimum distance to the Bezier larger than this. Set to -1 to include all.","-1");
91  addParm("Voxel Distance Max (um)","Only consider voxels with a maximum distance to the Bezier smaller than this. Set to -1 to include all.","-1");
92  addParm("Align at Max","Align at Max","No", QStringList() << "Align at Max of Signal Sum" << "Align at Signal Max" << "No");
93  addParm("Weight by Volume","Weight signal values by the voxel volume","Yes",booleanChoice());
94  addParm("Filename","Filename","");
95  addParm("Fill Labels in Other Store","Fill the other store with the bin labels of all voxels in range","No",booleanChoice());
96  }
97 
98  bool initialize(QWidget* parent);
99 
100  bool run()
101  {
102  Stack* s1 = currentStack();
103  //Store* store1 = s1->currentStore();
104  Store* store1 = s1->main();
105  Store* store2 = s1->work();
106  return run(s1, store1, store2, parm("Central Axis"), parm("Bin Number").toInt(), parm("Voxel Value Threshold (%)").toDouble(), parm("Voxel Distance Min (um)").toDouble(),
107  parm("Voxel Distance Max (um)").toDouble(), parm("Align at Max"), stringToBool(parm("Weight by Volume")), parm("Filename"), stringToBool(parm("Fill Labels in Other Store")));
108  }
109  bool run(Stack* s1, Store* store1, Store* store2, QString centralAxis, int binNumber, double thresholdValue, double minDis, double maxDis, QString align, bool weightVol, QString filename, bool writeStack);
110 
111  };
112 
113 
114  class mgxBase_EXPORT StackHistogramBezier : public Process
115  {
116  public:
117  StackHistogramBezier(const Process& process) : Process(process)
118  {
119  setName("Stack/Analyses/Export Histogram Bezier");
120  setDesc("Export a histogram of voxel (signal) values of the active main store binned according to coordinates along a Bezier line.");
121  setIcon(QIcon(":/images/StackHistoLine.png"));
122 
123  addParm("Bin Size (um)","Bin Size (um)","10");
124  addParm("Voxel Value Threshold (%)","Ignore voxels with values lower than this threshold (% from 16bit value). Set to 0 to include all. Ignoring low values can speed this process up significantly","1.0");
125  addParm("Voxel Distance Min (um)","Only consider voxels with a minimum distance to the Bezier larger than this. Set to -1 to include all.","-1");
126  addParm("Voxel Distance Max (um)","Only consider voxels with a maximum distance to the Bezier smaller than this. Set to -1 to include all.","-1");
127  addParm("Bezier Discretization","Bezier Discretization","100");
128  addParm("Filename","Filename","");
129  addParm("Fill Labels in Other Store","Fill the other store with the bin labels of all voxels in range","No",booleanChoice());
130  }
131 
132  bool initialize(QWidget* parent);
133 
134  bool run()
135  {
136  Stack* s1 = currentStack();
137  //Store* store1 = s1->currentStore();
138  Store* store1 = s1->main();
139  Store* store2 = s1->work();
140  Mesh* m = currentMesh();
141  return run(s1, store1, store2, m, parm("Bin Size (um)").toDouble(), parm("Voxel Value Threshold (%)").toDouble(), parm("Voxel Distance Min (um)").toDouble(),
142  parm("Voxel Distance Max (um)").toDouble(), parm("Bezier Discretization").toInt(), parm("Filename"), stringToBool(parm("Fill Labels in Other Store")));
143  }
144 
145  bool run(Stack* s1, Store* store1, Store* store2, Mesh* m, double binSize, double ignoreLow, double minDis, double maxDis, int bezPoints, QString filename, bool writeStack);
146 
147  };
148 
149 
150 class mgxBase_EXPORT StackBorderFromSegmented : public Process
151  {
152  public:
153  StackBorderFromSegmented(const Process& process) : Process(process)
154  {
155  setName("Stack/Analyses/Border from Segmented Stack");
156  setDesc("From a segmented stack in the main stack border voxels are set to max in the work stack.");
157  setIcon(QIcon(":/images/MakeHeatMap.png"));
158 
159  addParm("Width","Width","1");
160  addParm("Ignore X","Ignore X","No",booleanChoice());
161  addParm("Ignore Y","Ignore Y","No",booleanChoice());
162  addParm("Ignore Z","Ignore Z","Yes",booleanChoice());
163  }
164 
165  bool run()
166  {
167  Stack* s1 = currentStack();
168  Store* store1 = s1->main();
169  return run(s1, store1, parm("Width").toInt(), stringToBool(parm("Ignore X")), stringToBool(parm("Ignore Y")), stringToBool(parm("Ignore Z")));
170  }
171  bool run(Stack* s1, Store* store1, int width, bool ignX, bool ignY, bool ignZ);
172 
173  };
174 
176 }
177 #endif
Process.hpp
mgx::ComputeVolume::run
bool run()
Runs the process.
Definition: StackProcessAnalyses.hpp:40
mgx::StackHistogramBezier::StackHistogramBezier
StackHistogramBezier(const Process &process)
Definition: StackProcessAnalyses.hpp:117
mgx::Stack::work
const Store * work() const
Access the work store.
Definition: Stack.hpp:101
mgx::StackHistogramBezier
Definition: StackProcessAnalyses.hpp:114
mgx::Stack::main
const Store * main() const
Access the main store.
Definition: Stack.hpp:82
mgx::ComputeVolume::ComputeVolume
ComputeVolume(const Process &process)
Definition: StackProcessAnalyses.hpp:31
mgx::Stack
Definition: Stack.hpp:33
mgx
Distributed matrix library.
Definition: Assert.hpp:26
mgx::StackCircularHistogram::run
bool run()
Runs the process.
Definition: StackProcessAnalyses.hpp:100
mgx::Process
Definition: Process.hpp:219
mgx::StackBorderFromSegmented::run
bool run()
Runs the process.
Definition: StackProcessAnalyses.hpp:165
mgx::stringToBool
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
mgx::StackCircularHistogram
Definition: StackProcessAnalyses.hpp:78
mgx::StackBorderFromSegmented::StackBorderFromSegmented
StackBorderFromSegmented(const Process &process)
Definition: StackProcessAnalyses.hpp:153
mgx::StackVoxelCount::StackVoxelCount
StackVoxelCount(const Process &process)
Definition: StackProcessAnalyses.hpp:56
mgx::StackHistogramBezier::run
bool run()
Runs the process.
Definition: StackProcessAnalyses.hpp:134
mgx::Mesh
Definition: Mesh.hpp:54
mgx::StackVoxelCount
Definition: StackProcessAnalyses.hpp:53
mgx::StackBorderFromSegmented
Definition: StackProcessAnalyses.hpp:150
mgx::ComputeVolume
Definition: StackProcessAnalyses.hpp:28
mgx::StackVoxelCount::run
bool run()
Runs the process.
Definition: StackProcessAnalyses.hpp:66
mgx::StackCircularHistogram::StackCircularHistogram
StackCircularHistogram(const Process &process)
Definition: StackProcessAnalyses.hpp:81
mgx::Store
Definition: Store.hpp:33