Commit d2d7f162310f03451f1b9b357b4f3e3d7103cda5
1 parent
8dba6492
removed lognn
Showing
1 changed file
with
0 additions
and
82 deletions
openbr/plugins/cluster/lognn.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | - * Copyright 2012 The MITRE Corporation * | |
| 3 | - * * | |
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); * | |
| 5 | - * you may not use this file except in compliance with the License. * | |
| 6 | - * You may obtain a copy of the License at * | |
| 7 | - * * | |
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 * | |
| 9 | - * * | |
| 10 | - * Unless required by applicable law or agreed to in writing, software * | |
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, * | |
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | |
| 13 | - * See the License for the specific language governing permissions and * | |
| 14 | - * limitations under the License. * | |
| 15 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 16 | - | |
| 17 | -#include <fstream> | |
| 18 | - | |
| 19 | -#include <openbr/plugins/openbr_internal.h> | |
| 20 | - | |
| 21 | -namespace br | |
| 22 | -{ | |
| 23 | - | |
| 24 | -/*! | |
| 25 | - * \ingroup transforms | |
| 26 | - * \brief Log nearest neighbors to specified file. | |
| 27 | - * \author Charles Otto \cite caotto | |
| 28 | - * \br_property QString fileName The name of the log file. An empty fileName won't be written to. Default is "". | |
| 29 | - */ | |
| 30 | -class LogNNTransform : public TimeVaryingTransform | |
| 31 | -{ | |
| 32 | - Q_OBJECT | |
| 33 | - | |
| 34 | - Q_PROPERTY(QString fileName READ get_fileName WRITE set_fileName RESET reset_fileName STORED false) | |
| 35 | - BR_PROPERTY(QString, fileName, "") | |
| 36 | - | |
| 37 | - std::fstream fout; | |
| 38 | - | |
| 39 | - void projectUpdate(const Template &src, Template &dst) | |
| 40 | - { | |
| 41 | - dst = src; | |
| 42 | - | |
| 43 | - if (!dst.file.contains("neighbors")) { | |
| 44 | - fout << std::endl; | |
| 45 | - return; | |
| 46 | - } | |
| 47 | - | |
| 48 | - Neighbors neighbors = dst.file.get<Neighbors>("neighbors"); | |
| 49 | - if (neighbors.isEmpty() ) { | |
| 50 | - fout << std::endl; | |
| 51 | - return; | |
| 52 | - } | |
| 53 | - | |
| 54 | - QString aLine; | |
| 55 | - aLine.append(QString::number(neighbors[0].first)+":"+QString::number(neighbors[0].second)); | |
| 56 | - for (int i=1; i < neighbors.size();i++) | |
| 57 | - aLine.append(","+QString::number(neighbors[i].first)+":"+QString::number(neighbors[i].second)); | |
| 58 | - | |
| 59 | - fout << qPrintable(aLine) << std::endl; | |
| 60 | - } | |
| 61 | - | |
| 62 | - void init() | |
| 63 | - { | |
| 64 | - if (!fileName.isEmpty()) | |
| 65 | - fout.open(qPrintable(fileName), std::ios_base::out); | |
| 66 | - } | |
| 67 | - | |
| 68 | - void finalize(TemplateList &output) | |
| 69 | - { | |
| 70 | - (void) output; | |
| 71 | - fout.close(); | |
| 72 | - } | |
| 73 | - | |
| 74 | -public: | |
| 75 | - LogNNTransform() : TimeVaryingTransform(false, false) {} | |
| 76 | -}; | |
| 77 | - | |
| 78 | -BR_REGISTER(Transform, LogNNTransform) | |
| 79 | - | |
| 80 | -} // namespace br | |
| 81 | - | |
| 82 | -#include "cluster/lognn.moc" |