38 #ifndef __DataManagerWithSurrogates_hxx
39 #define __DataManagerWithSurrogates_hxx
41 #include "DataManagerWithSurrogates.h"
45 #include "HDF5Utils.h"
56 DataManagerWithSurrogates<T>::DataManagerWithSurrogates(
const RepresenterType* representer,
const std::string& filename)
57 : DataManager<T>(representer) {
66 tmpVector = Utils::ReadVectorFromTxtFile(filename.c_str());
67 m_typeInfo.typeFilename = filename;
68 m_typeInfo.types.clear();
69 for (
unsigned i=0 ; i<tmpVector.size() ; i++) {
70 if (tmpVector(i)==0) m_typeInfo.types.push_back(DataItemWithSurrogatesType::Categorical);
71 else m_typeInfo.types.push_back(DataItemWithSurrogatesType::Continuous);
80 const std::string& datasetURI,
81 const std::string& surrogateFilename) {
86 assert(this->m_representer != 0);
88 const VectorType& surrogateVector = Utils::ReadVectorFromTxtFile(surrogateFilename.c_str());
90 if (static_cast<unsigned>(surrogateVector.size()) != m_typeInfo.types.size() )
throw StatisticalModelException(
"Trying to loading a dataset with unexpected number of surrogates");
92 DatasetPointerType sample;
93 sample = this->m_representer->CloneDataset(ds);
95 this->m_DataItemList.push_back(DataItemWithSurrogatesType::Create(this->m_representer,
97 this->m_representer->SampleToSampleVector(sample),
100 this->m_representer->DeleteDataset(sample);
void LoadSurrogateTypes(const std::string &filename)
Definition: DataManagerWithSurrogates.hxx:64
A trivial representer, that does no representation at all, but works directly with vectorial data...
Definition: TrivialVectorialRepresenter.h:83
Generic Exception class for the statismo Library.
Definition: Exceptions.h:68
void AddDatasetWithSurrogates(DatasetConstPointerType ds, const std::string &datasetURI, const std::string &surrogateFilename)
Definition: DataManagerWithSurrogates.hxx:79