Medical Imaging Interaction Toolkit  2018.4.99-08619e4f
Medical Imaging Interaction Toolkit
MitkFlowBench.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include <mitkBaseApplication.h>
14 #include <QVariant>
15 
16 #if defined __GNUC__ && !defined __clang__
17 # include <QDir>
18 # include <QFileInfo>
19 # include <QString>
20 # include <QStringList>
21 #endif
22 
23 class FlowApplication : public mitk::BaseApplication
24 {
25 public:
26  static const QString ARG_OUTPUTDIR;
27  static const QString ARG_OUTPUTFORMAT;
28 
29  FlowApplication(int argc, char **argv) : mitk::BaseApplication(argc, argv)
30  {
31  };
32 
33  ~FlowApplication() = default;
34 
35 protected:
40  void defineOptions(Poco::Util::OptionSet &options) override
41  {
42  Poco::Util::Option outputDirOption(ARG_OUTPUTDIR.toStdString(), "", "the location for storing persistent application data");
43  outputDirOption.argument("<dir>").binding(ARG_OUTPUTDIR.toStdString());
44  options.addOption(outputDirOption);
45 
46  Poco::Util::Option outputFormatOption(ARG_OUTPUTFORMAT.toStdString(), "", "the location for storing persistent application data");
47  outputFormatOption.argument("<format>").binding(ARG_OUTPUTFORMAT.toStdString());
48  options.addOption(outputFormatOption);
49 
51  };
52 };
53 
54 const QString FlowApplication::ARG_OUTPUTDIR = "flow.outputdir";
55 const QString FlowApplication::ARG_OUTPUTFORMAT = "flow.outputextension";
56 
57 int main(int argc, char **argv)
58 {
59  FlowApplication app(argc, argv);
60 
61  app.setSingleMode(true);
62  app.setApplicationName("MITK FlowBench");
63  app.setOrganizationName("DKFZ");
64 
65  // Preload the org.blueberry.core.expressions plugin to work around a bug in
66  // GCC that leads to undefined symbols while loading certain libraries even though
67  // the symbols are actually defined.
68 #if defined __GNUC__ && !defined __clang__
69  auto library = QFileInfo(argv[0]).dir().path() + "/../lib/plugins/liborg_blueberry_core_expressions.so";
70 
71  if (!QFileInfo(library).exists())
72  library = "liborg_blueberry_core_expressions";
73 
74  app.setPreloadLibraries(QStringList() << library);
75 #endif
76 
77  app.setProperty(mitk::BaseApplication::PROP_PRODUCT, "org.mitk.gui.qt.flowapplication.workbench");
78 
79  // Run the workbench.
80  return app.run();
81 }
DataCollection - Class to facilitate loading/accessing structured data.
void defineOptions(Poco::Util::OptionSet &options) override
static const QString PROP_PRODUCT
BaseApplication(int argc, char **argv)
int main(const std::vector< std::string > &args) override