Statismo  0.10.1
 All Classes Namespaces Functions Typedefs
DataManagerWithSurrogates.h
1 /*
2  * DataManagerWithSurrogates.h
3  *
4  * Created by Marcel Luethi and Remi Blanc
5  *
6  * Copyright (c) 2011 University of Basel
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  *
20  * Neither the name of the project's author nor the names of its
21  * contributors may be used to endorse or promote products derived from
22  * this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
30  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef __DATAMANAGERWITHSURROGATES_H_
39 #define __DATAMANAGERWITHSURROGATES_H_
40 
41 #include "DataManager.h"
42 
43 namespace statismo {
44 
45 
55 template <typename T>
57 
58  public:
59 
60  typedef Representer<T> RepresenterType;
61 
62  typedef typename RepresenterType::DatasetPointerType DatasetPointerType;
63  typedef typename RepresenterType::DatasetConstPointerType DatasetConstPointerType;
64 
65 
66  typedef DataItemWithSurrogates<T> DataItemWithSurrogatesType;
67 
68  typedef typename DataItemWithSurrogatesType::SurrogateTypeVectorType SurrogateTypeVectorType;
69 
70  struct SurrogateTypeInfoType {
71  SurrogateTypeVectorType types;
72  std::string typeFilename;
73  };
74 
75 
80 
81 
86  static DataManagerWithSurrogates<T>* Create(const RepresenterType* representer, const std::string& surrogTypeFilename) {
87  return new DataManagerWithSurrogates<T>(representer, surrogTypeFilename);
88  }
89 
90 
91 
92 
99  void AddDatasetWithSurrogates(DatasetConstPointerType ds,
100  const std::string& datasetURI,
101  const std::string& surrogateFilename);
102 
106  SurrogateTypeVectorType GetSurrogateTypes() const {
107  return m_typeInfo.types;
108  }
109 
111  std::string GetSurrogateTypeFilename() const {
112  return m_typeInfo.typeFilename;
113  }
114 
116  SurrogateTypeInfoType GetSurrogateTypeInfo() const {
117  return m_typeInfo;
118  }
119 
120  protected:
121 
126  void LoadSurrogateTypes(const std::string& filename);
127 
128 
129 
130  // private - to prevent use
131  DataManagerWithSurrogates(const RepresenterType* r, const std::string& filename);
132 
135 
136  SurrogateTypeInfoType m_typeInfo;
137 };
138 
139 }
140 
141 #include "DataManagerWithSurrogates.hxx"
142 
143 #endif /* __DATAMANAGERWITHSURROGATES_H_ */
void LoadSurrogateTypes(const std::string &filename)
Definition: DataManagerWithSurrogates.hxx:64
std::string GetSurrogateTypeFilename() const
Definition: DataManagerWithSurrogates.h:111
Manages Training and Test Data for building Statistical Models and provides functionality for Crossva...
Definition: DataManager.h:114
Manages Training and Test Data for building Statistical Models and provides functionality for Crossva...
Definition: DataManagerWithSurrogates.h:56
A trivial representer, that does no representation at all, but works directly with vectorial data...
Definition: TrivialVectorialRepresenter.h:83
static DataManagerWithSurrogates< T > * Create(const RepresenterType *representer, const std::string &surrogTypeFilename)
Definition: DataManagerWithSurrogates.h:86
virtual ~DataManagerWithSurrogates()
Definition: DataManagerWithSurrogates.h:79
SurrogateTypeInfoType GetSurrogateTypeInfo() const
Definition: DataManagerWithSurrogates.h:116
void AddDatasetWithSurrogates(DatasetConstPointerType ds, const std::string &datasetURI, const std::string &surrogateFilename)
Definition: DataManagerWithSurrogates.hxx:79
SurrogateTypeVectorType GetSurrogateTypes() const
Definition: DataManagerWithSurrogates.h:106