Read@CVL
Forms.h
Go to the documentation of this file.
1 /*******************************************************************************************************
2 ReadModules are plugins for nomacs developed at CVL/TU Wien for the EU project READ.
3 
4 Copyright (C) 2016 Markus Diem <diem@caa.tuwien.ac.at>
5 Copyright (C) 2016 Stefan Fiel <fiel@caa.tuwien.ac.at>
6 Copyright (C) 2016 Florian Kleber <kleber@caa.tuwien.ac.at>
7 
8 This file is part of ReadModules.
9 
10 ReadFramework is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14 
15 ReadFramework is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 The READ project has received funding from the European Union’s Horizon 2020
24 research and innovation programme under grant agreement No 674943
25 
26 related links:
27 [1] http://www.caa.tuwien.ac.at/cvl/
28 [2] https://transkribus.eu/Transkribus/
29 [3] https://github.com/TUWien/
30 [4] http://nomacs.org
31 *******************************************************************************************************/
32 
33 #pragma once
34 
35 #include "DkPluginInterface.h"
36 #include "DkBatchInfo.h"
37 
38 #include "Shapes.h"
39 
40 // opencv defines
41 namespace cv {
42  class Mat;
43 }
44 
45 
46 namespace rdm {
47 
48 class FormsInfo : public nmc::DkBatchInfo {
49 
50 public:
51  FormsInfo(const QString& id = QString(), const QString& filePath = QString());
52 
53  void setFormName(const QString& p);
54  QString formName() const;
55 
56  void setMatchName(const QString& p);
57  QString matchName() const;
58 
59  void setFormSize(const QSize& s);
60  QSize formSize() const;
61 
62  void setTemplId(int id);
63  int iDForm() const;
64 
65  void setLines(QVector<rdf::Line> hL, QVector<rdf::Line> vL);
66  QVector<rdf::Line> hLines();
67  QVector<rdf::Line> vLines();
68 
69 private:
70  QString mProp; //form name
71  QString mMatchName;
72  int mIdForm = 0;
73  QSize mS;
74  QVector<rdf::Line> mVerLines;
75  QVector<rdf::Line> mHorLines;
76 
77 };
78 
79 class FormsAnalysis : public QObject, nmc::DkBatchPluginInterface {
80  Q_OBJECT
81  Q_INTERFACES(nmc::DkBatchPluginInterface)
82  Q_PLUGIN_METADATA(IID "com.nomacs.ImageLounge.Forms/3.2" FILE "Forms.json")
83 
84 public:
85  FormsAnalysis(QObject* parent = 0);
86  ~FormsAnalysis();
87 
88  QString id() const override;
89  QImage image() const override;
90 
91  QList<QAction*> createActions(QWidget* parent) override;
92  QList<QAction*> pluginActions() const override;
93  QSharedPointer<nmc::DkImageContainer> runPlugin(
94  const QString &runID,
95  QSharedPointer<nmc::DkImageContainer> imgC,
96  const nmc::DkSaveInfo& saveInfo,
97  QSharedPointer<nmc::DkBatchInfo>& info) const override;
98 
99  void preLoadPlugin() const override;
100  void postLoadPlugin(const QVector<QSharedPointer<nmc::DkBatchInfo> >& batchInfo) const override;
101 
102  enum {
107  // add actions here
108 
109  id_end
110  };
111 
112 protected:
113  QList<QAction*> mActions;
114  QStringList mRunIDs;
115  QStringList mMenuNames;
116  QStringList mMenuStatusTips;
117 
118  QString mLineTemplPath;
119  void loadSettings(QSettings& settings);
120  void saveSettings(QSettings& settings) const;
121 };
122 };
Definition: Drawer.h:53
Definition: Forms.h:105
QStringList mRunIDs
Definition: Forms.h:114
Definition: Forms.h:104
QStringList mMenuNames
Definition: Forms.h:115
QString mLineTemplPath
Definition: Forms.h:118
Definition: Forms.h:106
QList< QAction * > mActions
Definition: Forms.h:113
Definition: BatchTest.cpp:45
QStringList mMenuStatusTips
Definition: Forms.h:116
Definition: Forms.h:48
Definition: Forms.h:103
Definition: Forms.h:79