Statismo  0.10.1
 All Classes Namespaces Functions Typedefs
ConditionalModelBuilder.h
1 /*
2  * ConditionalModelBuilder.h
3  *
4  * Created by Remi Blanc,
5  *
6  * Copyright (c) 2011 ETH Zurich
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 __CONDITIONALMODELBUILDER_H_
39 #define __CONDITIONALMODELBUILDER_H_
40 
41 #include <vector>
42 #include <memory>
43 
44 #include "CommonTypes.h"
45 #include "Config.h"
46 #include "DataManagerWithSurrogates.h"
47 #include "ModelBuilder.h"
48 #include "StatisticalModel.h"
49 
50 namespace statismo {
51 
72 template <typename T>
74  public:
75 
78 
79  typedef std::pair<bool, statismo::ScalarType> CondVariableValuePair; //replace the first element by a bool (indicates whether the variable is in use)
80  typedef std::vector<CondVariableValuePair> CondVariableValueVectorType; //replace list by vector, to gain direct access
81 
83  typedef typename DataManagerType::DataItemListType DataItemListType;
84  typedef typename DataManagerType::DataItemWithSurrogatesType DataItemWithSurrogatesType;
85  typedef typename DataManagerType::SurrogateTypeInfoType SurrogateTypeInfoType;
86 
92  return new ConditionalModelBuilder();
93  }
94 
100  void Delete() {
101  delete this;
102  }
103 
114  StatisticalModelType* BuildNewModel(const DataItemListType& sampleSet,
115  const SurrogateTypeInfoType& surrogateTypesInfo,
116  const CondVariableValueVectorType& conditioningInfo,
117  float noiseVariance,
118  double modelVarianceRetained = 1) const;
119 
120  private:
121 
122  unsigned PrepareData(const DataItemListType& DataItemList,
123  const SurrogateTypeInfoType& surrogateTypesInfo,
124  const CondVariableValueVectorType& conditioningInfo,
125  DataItemListType* acceptedSamples,
126  MatrixType* surrogateMatrix,
127  VectorType* conditions) const;
128 
129  CondVariableValueVectorType m_conditioningInfo; //keep in storage
130 };
131 
132 
133 
134 } // namespace statismo
135 
136 #include "ConditionalModelBuilder.hxx"
137 
138 #endif /* __PCAMODELBUILDER_H_ */
void Delete()
Definition: ConditionalModelBuilder.h:100
StatisticalModelType * BuildNewModel(const DataItemListType &sampleSet, const SurrogateTypeInfoType &surrogateTypesInfo, const CondVariableValueVectorType &conditioningInfo, float noiseVariance, double modelVarianceRetained=1) const
Definition: ConditionalModelBuilder.hxx:126
Common base class for all the model builder classes.
Definition: ModelBuilder.h:54
Manages Training and Test Data for building Statistical Models and provides functionality for Crossva...
Definition: DataManagerWithSurrogates.h:56
Creates a StatisticalModel conditioned on some external data.
Definition: ConditionalModelBuilder.h:73
static ConditionalModelBuilder * Create()
Definition: ConditionalModelBuilder.h:91
A Point/Value pair that is used to specify a value at a given point.
Definition: StatisticalModel.h:100
ITK Wrapper for the statismo::StatisticalModel class.
Definition: itkStatisticalModel.h:62