MorphoGraphX
Process.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 PROCESS_HPP
12 #define PROCESS_HPP
13 
20 #include <Config.hpp>
21 #include <GL.hpp>
22 
23 #include <Clip.hpp>
24 #include <CuttingSurface.hpp>
25 #include <Forall.hpp>
26 #include <Information.hpp>
27 #include <Mesh.hpp>
28 #include <Stack.hpp>
29 #include <Store.hpp>
30 #include <Vector.hpp>
31 
32 #include <algorithm>
33 #include <iostream>
34 #include <QIcon>
35 #include <QSharedPointer>
36 #include <QStringList>
37 #include <QTextStream>
38 #include <typeinfo>
39 
40 class QWidget;
41 class MorphoGraphX;
42 
52 #define PROCESS_VERSION 1243
53 
103 namespace mgx { namespace process {
224 
225  #ifndef DOXYGEN
226  enum SystemCommand { LOAD_VIEW = 1, SAVE_VIEW, UPDATE_STRUCTURE, SET_CURRENT_STACK, TAKE_SNAPSHOT, RESET_PROJECT };
227 
228  class PrivateProcess;
229  class SetupProcess;
230  class GlobalProcess;
231  #endif
232 
240  class mgx_EXPORT UserCancelException : public std::exception {
241  public:
242  UserCancelException() : std::exception() {}
243 
244  const char* what() const throw() {
245  return "Process canceled by user.";
246  }
247  };
248 
258  class mgx_EXPORT Process {
259  public:
260  static unsigned int processVersion;
261 
262  typedef std::vector<Stack*>::iterator stack_iterator;
263  typedef std::vector<Stack*>::const_iterator const_stack_iterator;
264 
265  typedef std::vector<Mesh*>::iterator mesh_iterator;
266  typedef std::vector<Mesh*>::const_iterator const_mesh_iterator;
267 
271  Process();
278  Process(const Process& p);
282  virtual ~Process() {}
283 
292  void actingFile(const QString& filename, bool project_file = false);
293 
297  QString actingFile() const;
298 
302  QString pythonCall(const QStringList& parms) const;
303 
307  int stackCount() const;
311  Stack* stack(int i);
315  Stack* currentStack();
319  int currentStackId() const;
323  void setCurrentStackId(int i);
324 
326  std::pair<stack_iterator, stack_iterator> stacks();
328  std::pair<const_stack_iterator, const_stack_iterator> stacks() const;
329 
333  Stack* addStack();
334 
340  bool deleteStack(int i);
341 
345  int meshCount() const;
349  Mesh* mesh(int i);
353  Mesh* currentMesh();
357  int currentMeshId() const;
361  void setCurrentMeshId(int i);
362 
364  std::pair<mesh_iterator, mesh_iterator> meshes();
366  std::pair<const_mesh_iterator, const_mesh_iterator> meshes() const;
367 
371  Mesh* addMesh(const Stack* stack);
372 
376  bool deleteMesh(int i);
377 
381  int selectedLabel() const;
382 
386  void setSelectedLabel(int label);
387 
391  float globalBrightness();
392 
396  float globalContrast();
397 
403  void setGlobalBrightness(float value);
404 
410  void setGlobalContrast(float value);
411 
415  bool meshSelection() const;
419  bool lineBorderSelection() const;
420 
425  void updateState();
429  void updateViewer();
430 
434  bool setErrorMessage(const QString& str);
435 
439  QString errorMessage() const;
440 
444  void setWarningMessage(const QString& str);
448  QString warningMessage() const;
449 
453  void userCancel() const {
454  throw UserCancelException();
455  }
456 
460  const QString& file() const;
461 
465  Clip* clip1();
469  Clip* clip2();
473  Clip* clip3();
474 
478  const Clip* clip1() const;
482  const Clip* clip2() const;
486  const Clip* clip3() const;
487 
491  CuttingSurface* cuttingSurface();
495  const CuttingSurface* cuttingSurface() const;
496 
498  //\name Methods needed to launch other processes
499 
503  Process* makeProcess(const QString& processType, const QString& processName);
504 
510  bool RunProcess(Process& proc, const QStringList& parms) throw();
511 
517  bool RunProcess(const QString& processType, const QString& processName, const QStringList& parms) throw();
519 
523  virtual QString type() const = 0;
524 
525  // @{ Functions to be defined by the user
526 
532  virtual bool operator()(const QStringList& parms) = 0;
537  virtual QString name() const = 0;
541  virtual QString description() const = 0;
550  virtual QString folder() const {
551  return QString();
552  }
558  virtual QStringList parmNames() const = 0;
564  virtual QStringList parmDescs() const {
565  return QStringList();
566  }
570  virtual QStringList parmDefaults() const {
571  return QStringList();
572  }
578  virtual ParmChoiceMap parmChoice() const {
579  return ParmChoiceMap();
580  }
587  virtual QIcon icon() const {
588  return QIcon();
589  }
601  virtual bool initialize(QStringList& /*parms*/, QWidget* /*parent*/) {
602  return true;
603  }
604  // @}
605 
610  {
611  return QStringList() << "Yes"
612  << "No";
613  }
618  {
619  return QStringList() << "Main"
620  << "Work";
621  }
622 
626  virtual uint numParms() const {
627  return parmDefaults().size();
628  }
629 
631  //\name Methods to get and check elements
632 
637  STACK_ANY = 0,
638  STACK_NON_EMPTY = 0x01,
639  STACK_VISIBLE = 0x02,
640  STACK_EMPTY = 0x04,
641 
642  STACK_SCALED = 0x08,
643  STACK_TRANSFORMED = 0x10,
644  STACK_NON_SCALED = 0x20,
645  STACK_NON_TRANSFORMED = 0x40,
646  };
647 
652  STORE_ANY = 0,
653  STORE_NON_EMPTY = 0x0001,
654  STORE_VISIBLE = 0x0002,
655  STORE_EMPTY = 0x0004,
656 
657  STORE_LABEL = 0x0008,
658  STORE_NON_LABEL = 0x0010,
659 
660  STORE_SCALED = 0x0020,
661  STORE_TRANSFORMED = 0x0040,
662  STORE_NON_SCALED = 0x0080,
663  STORE_NON_TRANSFORMED = 0x0100,
664 
665  STORE_WORK = 0x1000,
666  STORE_MAIN = 0x2000
667  };
668 
673  MESH_ANY = 0,
674  MESH_NON_EMPTY = 0x000001,
675  MESH_VISIBLE = 0x000002,
676 
677  MESH_HEAT = 0x000004,
678  MESH_LABEL = 0x000008,
679  MESH_NORMAL = 0x000010,
680 
681  MESH_SIGNAL = 0x000020,
682  MESH_TEXTURE = 0x000040,
683  MESH_IMAGE = 0x000080,
684 
685  MESH_SHOW_MESH = 0x000100,
686  MESH_SHOW_SURF = 0x000200,
687 
688  MESH_ALL = 0x000400,
689  MESH_BORDER = 0x000800,
690  MESH_CELLMAP = 0x001000,
691 
692  MESH_CELLS = 0x002000,
693  MESH_IMG_TEX = 0x004000,
694  MESH_SCALED = 0x008000,
695  MESH_TRANSFORMED = 0x010000,
696 
697  MESH_EMPTY = 0x020000,
698  MESH_NON_CELLS = 0x040000,
699  MESH_NON_IMG_TEX = 0x080000,
700  MESH_NON_SCALED = 0x100000,
701  MESH_NON_TRANSFORMED = 0x200000,
702 
703  MESH_PARENT = 0x400000,
704  MESH_LABEL_PARENT = 0x800000
705  };
706 
710  enum CheckType {
711  CHECK_STACK = 0,
712  CHECK_STORE = 1,
713  CHECK_MESH = 2
714  };
715 
716  enum CheckWhich {
717  CHECK_CURRENT = -1
718  };
719 
725  class mgx_EXPORT CheckState {
726  public:
727  CheckState(const CheckState& copy);
729 
733  CheckState& store(int checks = STORE_ANY, int which = CHECK_CURRENT);
737  CheckState& stack(int checks = STACK_ANY, int which = CHECK_CURRENT);
741  CheckState& mesh(int checks = MESH_ANY, int which = CHECK_CURRENT);
742 
746  operator bool();
747 
748  protected:
749  void setError();
750 
751  struct ProcessReqs {
752  int type;
753  int checks;
754  int which;
755  };
756 
757  QList<ProcessReqs> reqs;
758  Process* process;
759  };
760 
761  friend class Process::CheckState;
762 
779  CheckState checkState();
781 
782  PrivateProcess* p;
783 
784  protected:
786 
792  bool systemCommand(SystemCommand cmd, const QStringList& parms);
796  bool stackCheck(int checks, int which);
800  bool storeCheck(int checks, int which);
804  bool meshCheck(int checks, int which);
805 
809  QString stackError(int checks, int which);
813  QString storeError(int checks, int which);
817  QString meshError(int checks, int which);
819  };
820 
829  class mgx_EXPORT StackProcess : public virtual Process {
830  friend class SetupProcess;
831  friend class GlobalProcess;
832  StackProcess() {
833  }
834 
835  public:
841  StackProcess(const StackProcess& copy) : Process(copy) {}
842 
843  virtual QString type() const {
844  return "Stack";
845  }
846  const Mesh* mesh(int i) {
847  return Process::mesh(i);
848  }
849  const Mesh* currentMesh() {
850  return Process::currentMesh();
851  }
852  std::pair<const_mesh_iterator, const_mesh_iterator> meshes() const {
853  return Process::meshes();
854  }
855  };
856 
865  class mgx_EXPORT MeshProcess : public virtual Process {
866  friend class SetupProcess;
867  friend class GlobalProcess;
868  MeshProcess() {
869  }
870 
871  public:
878  : Process(copy)
879  {
880  }
881 
882  virtual QString type() const {
883  return "Mesh";
884  }
885  const Stack* stack(int i) {
886  return Process::stack(i);
887  }
888  const Stack* currentStack() {
889  return Process::currentStack();
890  }
891  std::pair<const_stack_iterator, const_stack_iterator> stacks() const {
892  return Process::stacks();
893  }
894  };
895 
904  class mgx_EXPORT GlobalProcess : public MeshProcess, public StackProcess {
905  friend class SetupProcess;
906  GlobalProcess() {}
907 
908  public:
915  : Process(copy) , MeshProcess(copy) , StackProcess(copy) {}
916 
917  virtual QString type() const {
918  return "Global";
919  }
920  Mesh* mesh(int i) {
921  return Process::mesh(i);
922  }
923  Mesh* currentMesh() {
924  return Process::currentMesh();
925  }
926  Stack* stack(int i) {
927  return Process::stack(i);
928  }
929  Stack* currentStack() {
930  return Process::currentStack();
931  }
932  std::pair<stack_iterator, stack_iterator> stacks() {
933  return Process::stacks();
934  }
935  std::pair<const_stack_iterator, const_stack_iterator> stacks() const {
936  return Process::stacks();
937  }
938  std::pair<mesh_iterator, mesh_iterator> meshes() {
939  return Process::meshes();
940  }
941  std::pair<const_mesh_iterator, const_mesh_iterator> meshes() const {
942  return Process::meshes();
943  }
944 
945  bool setCurrentStack(int id, bool is_main);
946 
947  bool resetProject();
948 
949  bool takeSnapshot(QString filename, float overSampling = 1.0f, int width = 0, int height = 0, int quality = 95,
950  bool expand_frustum = false);
951 
952  using Process::systemCommand; //(SystemCommand cmd, const QStringList& parms);
953  };
954 
955  #ifndef DOXYGEN
956 
957  template <typename P> struct ProcessFactory {
958  typedef P ProcessType;
959 
960  ProcessFactory() : cnt(0) {}
961  ProcessFactory(const ProcessFactory&) : cnt(0) {}
962  virtual ~ProcessFactory() {}
963 
964  virtual ProcessType* operator()(const ProcessType& process) const = 0;
965 
966  int cnt;
967  };
968 
969  # ifdef WIN32
970  template struct mgx_EXPORT ProcessFactory<StackProcess>;
971  template struct mgx_EXPORT ProcessFactory<MeshProcess>;
972  template struct mgx_EXPORT ProcessFactory<GlobalProcess>;
973  # endif
974 
975  template <typename P, typename Process> struct ClassProcessFactory : public ProcessFactory<P> {
976  ClassProcessFactory() : ProcessFactory<P>() {}
977  ClassProcessFactory(const ClassProcessFactory& copy) : ProcessFactory<P>(copy) {}
978 
979  typedef P ProcessType;
980  virtual ProcessType* operator()(const ProcessType& process) const {
981  return new Process(process);
982  }
983  };
984 
985  template <typename X> struct FactoryPointer {
986  typedef X ProcessType;
987  typedef ProcessFactory<X> value;
988  typedef ProcessFactory<X>* pointer;
989  typedef ProcessFactory<X>& reference;
990  typedef const ProcessFactory<X>* const_pointer;
991  typedef const ProcessFactory<X>& const_reference;
992 
993  FactoryPointer() : p(0) {}
994 
995  FactoryPointer(pointer ptr) : p(ptr)
996  {
997  acquire();
998  }
999 
1000  template <typename T>
1001  FactoryPointer(T* ptr) : p(ptr)
1002  {
1003  acquire();
1004  }
1005 
1006  FactoryPointer(const FactoryPointer& other) : p(other.p)
1007  {
1008  acquire();
1009  }
1010 
1011  template <typename T>
1012  FactoryPointer(const FactoryPointer<T>& other) : p(other.p)
1013  {
1014  acquire();
1015  }
1016 
1017  ~FactoryPointer() {
1018  release();
1019  }
1020 
1021  operator bool() const { return bool(p); }
1022 
1023  ProcessType* operator()(const ProcessType& process) const {
1024  return (*p)(process);
1025  }
1026 
1027  template <typename T> FactoryPointer& operator=(const T* other)
1028  {
1029  if(p != other) {
1030  release();
1031  p = other;
1032  acquire();
1033  }
1034  return *this;
1035  }
1036 
1037  FactoryPointer& operator=(const FactoryPointer& other)
1038  {
1039  if(p != other.p) {
1040  release();
1041  p = other.p;
1042  acquire();
1043  }
1044  return *this;
1045  }
1046 
1047  template <typename T> FactoryPointer& operator=(const FactoryPointer<T>& other)
1048  {
1049  if(p != other.p) {
1050  release();
1051  p = other.p;
1052  acquire();
1053  }
1054  return *this;
1055  }
1056 
1057  bool operator==(const FactoryPointer& other) const {
1058  return p == other.p;
1059  }
1060 
1061  bool operator!=(const FactoryPointer& other) const {
1062  return p != other.p;
1063  }
1064 
1065  reference operator*() {
1066  return *p;
1067  }
1068  pointer operator->() {
1069  return p;
1070  }
1071 
1072  const_reference operator*() const {
1073  return *p;
1074  }
1075  const_pointer operator->() const {
1076  return p;
1077  }
1078 
1079  uintptr_t id() const {
1080  return (uintptr_t)p;
1081  }
1082 
1083  private:
1084  void release()
1085  {
1086  if(p) {
1087  p->cnt--;
1088  if(p->cnt == 0) {
1089  if(DEBUG)
1090  Information::out << "Deleting factory for " << util::qdemangle(typeid(*p).name())
1091  << " at address 0x" << QString::number(id(), 16) << endl;
1092  delete p;
1093  }
1094  p = 0;
1095  }
1096  }
1097 
1098  void acquire()
1099  {
1100  if(p)
1101  p->cnt++;
1102  }
1103 
1104  pointer p;
1105  };
1106 
1107  template <typename P> struct Registration {
1108  typedef P ProcessType;
1109  typedef FactoryPointer<P> processFactory;
1110  typedef QList<processFactory> factoryList;
1111 
1112  Registration(processFactory f, const char* class_name, unsigned int compiledVersion);
1113  ~Registration();
1114  static factoryList& processFactories();
1115 
1116  processFactory factory;
1117  const char* classname;
1118 
1119  private:
1120  static factoryList factories;
1121  };
1122 
1123  template <typename P>
1124  Registration<P>::Registration(processFactory f, const char* class_name, unsigned int compiledVersion)
1125  : factory(), classname(class_name)
1126  {
1127  if(DEBUG) {
1128  Information::out << "Registration of process " << util::qdemangle(classname) << " at address 0x"
1129  << QString::number(f.id(), 16) << endl
1130  << " Type of data: " << util::qdemangle(typeid(*f).name()) << endl;
1131  }
1132  if(Process::processVersion != compiledVersion) {
1133  QTextStream err(stderr);
1134  err << "Error registering factory " << util::qdemangle(class_name) << endl
1135  << " It has been compiled against a different revision of MorphoGraphX:" << QString::number(compiledVersion)
1136  << endl << " and MorphoGraphX is running process revision:" << QString::number(Process::processVersion)
1137  << endl;
1138  } else {
1139  factory = f;
1140  if(!factory and DEBUG)
1141  Information::out << "Storing null factory!" << endl;
1142  processFactories() << factory;
1143  }
1144  }
1145 
1146  template <typename P> Registration<P>::~Registration()
1147  {
1148  if(factory) {
1149  if(DEBUG) {
1150  Information::out << "Unregistration of process " << util::qdemangle(classname) << " at address 0x"
1151  << QString::number(factory.id(), 16) << endl
1152  << " Type of data: " << util::qdemangle(typeid(*factory).name()) << endl;
1153  }
1154  QList<processFactory>& list = processFactories();
1155  int size_before = list.size();
1156  for(int i = 0; i < list.size(); ++i) {
1157  if(list[i] == factory) {
1158  list.removeAt(i);
1159  break;
1160  }
1161  }
1162  if(DEBUG and list.size() == size_before) {
1163  Information::out << "Error, could not find processFactory to remove" << endl;
1164  }
1165  }
1166  }
1167 
1168  template <typename P> QList<typename Registration<P>::processFactory>& Registration<P>::processFactories()
1169  {
1170  return factories;
1171  }
1172 
1173  # ifdef WIN32
1174  template struct mgx_EXPORT Registration<StackProcess>;
1175  template struct mgx_EXPORT Registration<MeshProcess>;
1176  template struct mgx_EXPORT Registration<GlobalProcess>;
1177  # else
1178  template <typename P> typename Registration<P>::factoryList Registration<P>::factories;
1179  # endif
1180 
1181  typedef Registration<StackProcess> StackRegistration;
1182  typedef Registration<MeshProcess> MeshRegistration;
1183  typedef Registration<GlobalProcess> GlobalRegistration;
1184 
1185  typedef StackRegistration::processFactory stackProcessFactory;
1186  typedef MeshRegistration::processFactory meshProcessFactory;
1187  typedef GlobalRegistration::processFactory globalProcessFactory;
1188 
1189  inline QList<stackProcessFactory>& stackProcessFactories() {
1190  return StackRegistration::processFactories();
1191  }
1192  inline QList<meshProcessFactory>& meshProcessFactories() {
1193  return MeshRegistration::processFactories();
1194  }
1195  inline QList<globalProcessFactory>& globalProcessFactories() {
1196  return GlobalRegistration::processFactories();
1197  }
1198  #endif
1199 
1207  #define REGISTER_STACK_PROCESS(ClassName) \
1208  mgx::process::StackRegistration ClassName ## registration(new ClassProcessFactory<StackProcess, ClassName>(), \
1209  typeid(ClassName).name(), PROCESS_VERSION)
1210 
1218  #define REGISTER_MESH_PROCESS(ClassName) \
1219  mgx::process::MeshRegistration ClassName ## registration(new ClassProcessFactory<MeshProcess, ClassName>(), \
1220  typeid(ClassName).name(), PROCESS_VERSION)
1221 
1229  #define REGISTER_GLOBAL_PROCESS(ClassName) \
1230  mgx::process::GlobalRegistration ClassName ## registration(new ClassProcessFactory<GlobalProcess, ClassName>(), \
1231  typeid(ClassName).name(), PROCESS_VERSION)
1232 
1239  struct mgx_EXPORT BaseProcessDefinition {
1247  // uint nbNamedStrings; ///< Number of named string parameters
1248  // uint nbNamedValues; ///< Number of named value parameters
1249  ParmChoiceMap parmChoice;
1250  };
1251 
1258  template <typename P> struct ProcessDefinition : public BaseProcessDefinition {
1264  typedef P process_t;
1268  typedef FactoryPointer<P> processFactory;
1272  processFactory factory;
1273  };
1274 
1275  #ifndef DOXYGEN
1276  typedef QMap<QString, ProcessDefinition<StackProcess> > stackProcessesMap_t;
1277  typedef QMap<QString, ProcessDefinition<MeshProcess> > meshProcessesMap_t;
1278  typedef QMap<QString, ProcessDefinition<GlobalProcess> > globalProcessesMap_t;
1279 
1280  mgx_EXPORT extern stackProcessesMap_t stackProcesses;
1281  mgx_EXPORT extern meshProcessesMap_t meshProcesses;
1282  mgx_EXPORT extern globalProcessesMap_t globalProcesses;
1283  #endif
1284 
1287 
1290  mgx_EXPORT BaseProcessDefinition* getBaseProcessDefinition(const QString& processType, const QString& processName);
1291 
1293  mgx_EXPORT bool getLastParms(const Process& proc, QStringList& parms);
1295  mgx_EXPORT bool getDefaultParms(const Process& proc, QStringList& parms);
1297  mgx_EXPORT bool saveDefaultParms(const Process& proc, const QStringList& parms);
1299  mgx_EXPORT bool checkProcessParms(const Process& proc, const QStringList& parms, size_t* nbParms = 0);
1301  mgx_EXPORT bool getLastParms(const QString& processType, const QString& processName, QStringList& parms);
1303  mgx_EXPORT bool getDefaultParms(const QString& processType, const QString& processName, QStringList& parms);
1305  mgx_EXPORT bool saveDefaultParms(const QString& processType, const QString& processName, const QStringList& parms);
1307  mgx_EXPORT bool checkProcessParms(const QString& processType, const QString& processName, const QStringList& parms,
1308  size_t* nbParms = 0);
1310  mgx_EXPORT BaseProcessDefinition* getBaseProcessDefinition(const QString& processThread, const QString& processName);
1311 
1315  mgx_EXPORT QStringList listProcesses(const QString& processType);
1316 
1320  mgx_EXPORT bool validProcessType(const QString& processType);
1324  mgx_EXPORT bool validProcessName(const QString& processType, const QString& processName);
1325 
1327  mgx_EXPORT bool stringToBool(const QString& string);
1329  mgx_EXPORT bool stringToWorkStore(const QString& string);
1331  mgx_EXPORT bool stringToMainStore(const QString& string);
1332 
1334  inline QString boolToString(bool b) {
1335  return (b ? "Yes" : "No");
1336  }
1337 
1339 }}
1340 #endif
StackProcess(const StackProcess &copy)
Copy constructor.
Definition: Process.hpp:841
Definition: CuttingSurface.hpp:28
virtual uint numParms() const
Returns the number of named string for this process.
Definition: Process.hpp:626
Stack * currentStack()
Returns the current stack (i.e.
This file contains the defines the forall loops.
virtual QString type() const
Returns a string identifying the process type.
Definition: Process.hpp:843
virtual QString type() const
Returns a string identifying the process type.
Definition: Process.hpp:882
virtual QStringList parmDescs() const
List of parameters descriptions.
Definition: Process.hpp:564
QStringList parmNames
List of named parameters of the process.
Definition: Process.hpp:1242
Definition of a process, without the process factory.
Definition: Process.hpp:1239
MeshCheckType
Enumeration for the bitfield that identifies mesh properties.
Definition: Process.hpp:672
mgx_EXPORT bool validProcessName(const QString &processType, const QString &processName)
Check if the processName exist in the list of processType.
std::pair< mesh_iterator, mesh_iterator > meshes()
Iterate over all the meshs.
QString name
Name of the process.
Definition: Process.hpp:1240
mgx_EXPORT bool stringToWorkStore(const QString &string)
Returns true if string correspond to the work store, false otherwise.
mgx_EXPORT bool checkProcessParms(const QString &processType, const QString &processName, const QStringList &parms, size_t *nbParms=0)
Check if the parameters have enough defaults.
number(long n, int base=10)
Exception launched when a user clicks the Cancel button.
Definition: Process.hpp:240
std::pair< stack_iterator, stack_iterator > stacks()
Iterate over all the stacks.
QIcon icon
Icon of the process.
Definition: Process.hpp:1246
Definition of a process, including the process factory.
Definition: Process.hpp:1258
This class holds the actual mesh as a VV Graph and all sort of properties for it, including visualiza...
Definition: Mesh.hpp:177
Definition: MorphoGraphX.hpp:53
mgx_EXPORT bool saveDefaultParms(const QString &processType, const QString &processName, const QStringList &parms)
Save the default parameters in memory.
StackCheckType
Enumeration for the bitfield that identifies stack properties.
Definition: Process.hpp:636
Stack * stack(int i)
Returns the ith stack, or 0 if there is no such stack.
virtual QString folder() const
Folder in which to place the process.
Definition: Process.hpp:550
GlobalProcess(const GlobalProcess &copy)
Copy constructor.
Definition: Process.hpp:914
CheckType
Enumeration of the type of checks that can be performed.
Definition: Process.hpp:710
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26
QStringList parms
List of parameters/parameter defaults.
Definition: Process.hpp:1244
virtual QStringList parmDefaults() const
List of default parms.
Definition: Process.hpp:570
QStringList storeChoice() const
Helper function that provides a list of choices for choosing from the main or work stack...
Definition: Process.hpp:617
QString description
Description of the process.
Definition: Process.hpp:1241
StoreCheckType
Enumeration for the bitfield that identifies store properties.
Definition: Process.hpp:651
virtual ~Process()
Virtual destructor.
Definition: Process.hpp:282
virtual QString type() const
Returns a string identifying the process type.
Definition: Process.hpp:917
void userCancel() const
Throw an exception informing the system that the user canceled the current process.
Definition: Process.hpp:453
processFactory factory
Process factory.
Definition: Process.hpp:1272
CheckWhich
Definition: Process.hpp:716
Mesh * mesh(int i)
Returns the ith mesh.
The Stack class represent the dimensions of the 3D data, and the frames transformations.
Definition: Stack.hpp:35
This is the main process class, the one all process inherit from.
Definition: Process.hpp:258
virtual bool initialize(QStringList &, QWidget *)
This is an optional method that is called only when a process is launched from the GUI...
Definition: Process.hpp:601
Global processes have full mutable access to all properties of the process.
Definition: Process.hpp:904
mgx_EXPORT bool stringToBool(const QString &string)
Helper function converting a string into a boolean.
This namespace contains all the classes needed to define processes.
virtual QIcon icon() const
Icon to use to represent the process in the GUI.
Definition: Process.hpp:587
mgx_EXPORT QStringList listProcesses(const QString &processType)
Returns the list of names of the processes of a given type.
mgx_EXPORT bool getLastParms(const QString &processType, const QString &processName, QStringList &parms)
Get the parameters for a given process.
QHash< int, QStringList > ParmChoiceMap
Type of the dictionary giving the list of possible strings for each argument.
Definition: Process.hpp:223
mgx_EXPORT BaseProcessDefinition * getBaseProcessDefinition(const QString &processType, const QString &processName)
Retrieves the process definition from the type and name of the process.
Definition: Clip.hpp:21
QStringList parmDescs
List of descriptions of named parameters.
Definition: Process.hpp:1243
mgx_EXPORT bool validProcessType(const QString &processType)
Check if processType is a valid type (i.e.
Class that construct a state check on the current process.
Definition: Process.hpp:725
mgx_EXPORT bool getDefaultParms(const QString &processType, const QString &processName, QStringList &parms)
Get the default parameters for a given process (i.e. the ones defined by the process) ...
bool systemCommand(SystemCommand cmd, const QStringList &parms)
Method that can be used to launch a system command.
This files contains the definition of a mesh for the Process API.
P process_t
Type of the generated process.
Definition: Process.hpp:1264
Stack processes have non-mutable access to meshes and mutable access to stacks.
Definition: Process.hpp:829
QStringList booleanChoice() const
Helper function that provides a list of choices for a boolean argument.
Definition: Process.hpp:609
QString folder
Folder in which to place the process.
Definition: Process.hpp:1245
Mesh * currentMesh()
Returns the current mesh (i.e.
QString boolToString(bool b)
Helper function converting a boolean into a string.
Definition: Process.hpp:1334
MeshProcess(const MeshProcess &copy)
Copy constructor.
Definition: Process.hpp:877
ParmChoiceMap parmChoice
Map of choices for parameters.
Definition: Process.hpp:1249
Defines the Vector class template This file is shared by cuda, do not include headers that nvcc can&#39;t...
Mesh processes have mutable access to meshes and non-mutable access to stacks.
Definition: Process.hpp:865
mgx_EXPORT bool stringToMainStore(const QString &string)
Returns true if string correspond to the main store, false otherwise.
virtual ParmChoiceMap parmChoice() const
Purely for GUI purposes, provides for some of the parms parameter a choice.
Definition: Process.hpp:578