MorphoGraphX
AutoTrim.hpp
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 AUTO_TRIM_HPP
12 #define AUTO_TRIM_HPP
13 
14 #include <Process.hpp>
15 
16 namespace mgx {
17 namespace process {
26 class AutoTrim : public StackProcess {
27 public:
29  : Process(process)
30  , StackProcess(process)
31  {
32  }
33 
34  bool operator()(const QStringList& parms)
35  {
36  if(!checkState().stack(STACK_ANY))
37  return false;
38 
39  return (*this)(currentStack(), currentStack()->currentStore(), parms[0].toInt());
40  }
41 
42  bool operator()(Stack* stack, Store* store, int threshold);
43 
44  QString folder() const {
45  return "Canvas";
46  }
47  QString name() const {
48  return "AutoTrim";
49  }
51  {
52  return "Trim stack boundary box (BBox) to keep only non-empty part.\n"
53  "A voxel is considered empty if its intensity is less or equal to the threshold.";
54  }
56  return QStringList() << "Threshold";
57  }
59  return QStringList() << "Voxels below this threshold are considered empty.";
60  }
62  return QStringList() << "0";
63  }
64  QIcon icon() const {
65  return QIcon(":/images/AutoTrim.png");
66  }
67 };
68 } // namespace process
69 } // namespace mgx
70 #endif
Any stack.
Definition: Process.hpp:637
Stack * currentStack()
Returns the current stack (i.e.
const Store * currentStore() const
Returns the current store.
Definition: Stack.hpp:122
Process()
Default constructor.
QString description() const
Returns a description of the process for the GUI.
Definition: AutoTrim.hpp:50
CheckState checkState()
Call this function and convert the result to a boolean.
The Store class holds the actual 3D data and properties specific to it.
Definition: Store.hpp:35
Stack * stack(int i)
Returns the ith stack, or 0 if there is no such stack.
QStringList parmNames() const
List of named parameters.
Definition: AutoTrim.hpp:55
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
QStringList parmDefaults() const
List of default parms.
Definition: AutoTrim.hpp:61
QString folder() const
Folder in which to place the process.
Definition: AutoTrim.hpp:44
QString name() const
Returns the name of the process.
Definition: AutoTrim.hpp:47
Trim stack boundary box (BBox) to keep only non-empty part.
Definition: AutoTrim.hpp:26
File containing the definition of a Process.
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:35
QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: AutoTrim.hpp:64
This namespace contains all the classes needed to define processes.
Stack processes have non-mutable access to meshes and mutable access to stacks.
Definition: Process.hpp:829
bool operator()(const QStringList &parms)
Implementation of the process with generic arguments.
Definition: AutoTrim.hpp:34
QStringList parmDescs() const
List of parameters descriptions.
Definition: AutoTrim.hpp:58