Gaia
extractapplier.h
1 /*
2  * Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
3  *
4  * This file is part of Gaia
5  *
6  * Gaia is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License as published by the Free
8  * Software Foundation (FSF), either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the Affero GNU General Public License
17  * version 3 along with this program. If not, see http://www.gnu.org/licenses/
18  */
19 
20 #ifndef GAIA_EXTRACTAPPLIER_H
21 #define GAIA_EXTRACTAPPLIER_H
22 
23 #include "applier.h"
24 #include "3rdparty/libsvm/svm.h"
25 #include "utils.h"
26 
27 namespace gaia2 {
28 
29 class InnerDim {
30 public:
31  InnerDim(DescriptorLengthType ltype_, int desc_, int dim_) :
32  ltype(ltype_), desc(desc_), dim(dim_) {}
34  int desc;
35  int dim;
36 };
37 
38 
44 class ExtractApplier : public Applier {
45 
46  public:
47  ExtractApplier(const Transformation& transfo);
48  virtual ~ExtractApplier();
49 
53  virtual Point* mapPoint(const Point* p) const;
54 
55  protected:
56  QMap<QString, QList<int> > _dims;
57  PointLayout _newLayout;
58  IndexMap _realMap, _stringMap, _enumMap;
59 
60  typedef QList<QPair<InnerDim, InnerDim> > Mapping;
61  Mapping _mapping;
62 
63  Mapping getMappings(const PointLayout& layout) const;
64  void transferData(Point* p, const Mapping& m) const;
65 
66 };
67 
68 } // namespace gaia2
69 
70 #endif // GAIA_EXTRACTAPPLIER_H
Class containing all info pertaining to a specific transformation, ie: the name of the analyzer class...
Definition: transformation.h:41
Point * mapPoint(const Point *p, const PointLayout &newLayout, const IndexMap &realMap, const IndexMap &stringMap, const IndexMap &enumMap)
Creates a new Point that is a mapping of the given one, copying only those descriptors that are in ne...
Definition: utils.cpp:310
This class describes the layout of a point.
Definition: pointlayout.h:60
Definition: extractapplier.h:29
DescriptorLengthType
Either fixed-length or variable-length.
Definition: region.h:46
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
The Applier abstract base class.
Definition: applier.h:44
Extract applier class.
Definition: extractapplier.h:44
Definition: point.h:106