From e6c2e195ee1f64fa5293996717c91d25d4b58463 Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Mon, 20 May 2013 20:55:11 -0400 Subject: [PATCH] Rename collectValues to get, add a values method --- openbr/core/bee.cpp | 4 ++-- openbr/core/cluster.cpp | 2 +- openbr/openbr_plugin.cpp | 6 +++--- openbr/openbr_plugin.h | 14 ++++++++++---- openbr/plugins/eigen3.cpp | 4 +--- openbr/plugins/independent.cpp | 2 +- openbr/plugins/output.cpp | 4 ++-- openbr/plugins/svm.cpp | 4 ++-- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/openbr/core/bee.cpp b/openbr/core/bee.cpp index bfd3103..fb840ca 100644 --- a/openbr/core/bee.cpp +++ b/openbr/core/bee.cpp @@ -262,8 +262,8 @@ cv::Mat BEE::makeMask(const br::FileList &targets, const br::FileList &queries, { // Would like to use indexProperty for this, but didn't make a version of that for Filelist yet // -cao - QList targetLabels = targets.collectValues("Subject", "-1"); - QList queryLabels = queries.collectValues("Subject", "-1"); + QList targetLabels = targets.get("Subject", "-1"); + QList queryLabels = queries.get("Subject", "-1"); QList targetPartitions = targets.crossValidationPartitions(); QList queryPartitions = queries.crossValidationPartitions(); diff --git a/openbr/core/cluster.cpp b/openbr/core/cluster.cpp index 40482e8..fdff3d8 100644 --- a/openbr/core/cluster.cpp +++ b/openbr/core/cluster.cpp @@ -280,7 +280,7 @@ void br::EvalClustering(const QString &csv, const QString &input) // We assume clustering algorithms store assigned cluster labels as integers (since the clusters are // not named). - QList labels = TemplateList::fromGallery(input).files().collectValues("Subject"); + QList labels = TemplateList::fromGallery(input).files().get("Subject"); QHash labelToIndex; int nClusters = 0; diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 393fb8f..70724c5 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -437,7 +437,7 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) // stores the index values in "Label" of the output template list -cao TemplateList TemplateList::relabel(const TemplateList &tl, const QString & propName) { - const QList originalLabels = tl.collectValues(propName); + const QList originalLabels = tl.get(propName); QHash labelTable; foreach (const QString & label, originalLabels) if (!labelTable.contains(label)) @@ -465,7 +465,7 @@ QList TemplateList::indexProperty(const QString & propName, QHash originalLabels = collectValues(propName); + const QList originalLabels = values(propName); foreach (const QVariant & label, originalLabels) { QString labelString = label.toString(); if (!valueMap.contains(labelString)) { @@ -484,7 +484,7 @@ QList TemplateList::indexProperty(const QString & propName, QHash TemplateList::applyIndex(const QString & propName, const QHash & valueMap) const { - const QList originalLabels = collectValues(propName); + const QList originalLabels = get(propName); QList result; for (int i=0; i QStringList flat() const; /*!< \brief Returns br::File::flat() for each file in the list. */ QStringList names() const; /*!< \brief Returns #br::File::name for each file in the list. */ void sort(const QString& key); /*!< \brief Sort the list based on metadata. */ - /*!< \brief Returns br::File::label() for each file in the list. */ + /*!< \brief Returns values associated with the input propName for each file in the list. */ template - QList collectValues(const QString & propName) const + QList get(const QString & propName) const { QList values; values.reserve(size()); foreach (const File &f, *this) @@ -307,7 +307,7 @@ struct BR_EXPORT FileList : public QList return values; } template - QList collectValues(const QString & propName, T defaultValue) const + QList get(const QString & propName, T defaultValue) const { QList values; values.reserve(size()); foreach (const File &f, *this) @@ -480,12 +480,18 @@ struct TemplateList : public QList