diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 9ece43f..affb3c2 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -1255,6 +1255,17 @@ void MatrixOutput::set(float value, int i, int j) BR_REGISTER(Output, MatrixOutput) +/* Format - public methods */ +Template Format::read(const QString &file) +{ + return QScopedPointer(Factory::make(file))->read(); +} + +void Format::write(const QString &file, const Template &t) +{ + QScopedPointer(Factory::make(file))->write(t); +} + /* Gallery - public methods */ TemplateList Gallery::read() { diff --git a/openbr/openbr_plugin.h b/openbr/openbr_plugin.h index 4b8447f..5a35bf1 100644 --- a/openbr/openbr_plugin.h +++ b/openbr/openbr_plugin.h @@ -1080,6 +1080,8 @@ public: virtual ~Format() {} virtual Template read() const = 0; /*!< \brief Returns a br::Template created by reading #br::Object::file. */ virtual void write(const Template &t) const = 0; /*!< \brief Writes the br::Template to #br::Object::file. */ + static Template read(const QString &file); + static void write(const QString &file, const Template &t); }; /*! diff --git a/openbr/plugins/format.cpp b/openbr/plugins/format.cpp index 48e7eeb..48eed7d 100644 --- a/openbr/plugins/format.cpp +++ b/openbr/plugins/format.cpp @@ -293,7 +293,11 @@ class mtxFormat : public Format Template read() const { - return BEE::readMatrix(file); + QString target, query; + Template result = BEE::readMatrix(file, &target, &query); + result.file.set("Target", target); + result.file.set("Query", query); + return result; } void write(const Template &t) const