Commit c07bbd3017772f149a9e9bb85255f233042b962e
1 parent
00184788
Add the ability to write matrix output using format classes
This allows e.g. writing .mat files as directly as output of compare, as well as writing similarity matrices as images (although this could use some scaling) Signed-off-by: caotto <ottochar@gmail.com>
Showing
1 changed file
with
20 additions
and
0 deletions
sdk/plugins/output.cpp
| @@ -44,6 +44,26 @@ | @@ -44,6 +44,26 @@ | ||
| 44 | 44 | ||
| 45 | namespace br | 45 | namespace br |
| 46 | { | 46 | { |
| 47 | +/*! | ||
| 48 | + * \ingroup outputs | ||
| 49 | + * \brief Adaptor class -- write a matrix output using Format classes. | ||
| 50 | + * \author Charles Otto \cite caotto | ||
| 51 | + */ | ||
| 52 | +class DefaultOutput : public MatrixOutput | ||
| 53 | +{ | ||
| 54 | + Q_OBJECT | ||
| 55 | + | ||
| 56 | + ~DefaultOutput() | ||
| 57 | + { | ||
| 58 | + if (file.isNull() || targetFiles.isEmpty() || queryFiles.isEmpty()) return; | ||
| 59 | + | ||
| 60 | + br::Template T(this->file, this->data); | ||
| 61 | + QScopedPointer<Format> writer(Factory<Format>::make(this->file)); | ||
| 62 | + writer->write(T); | ||
| 63 | + } | ||
| 64 | +}; | ||
| 65 | + | ||
| 66 | +BR_REGISTER(Output, DefaultOutput) | ||
| 47 | 67 | ||
| 48 | /*! | 68 | /*! |
| 49 | * \ingroup outputs | 69 | * \ingroup outputs |