Statismo  0.10.1
 All Classes Namespaces Functions Typedefs
PosteriorModelBuilder.h
1 /*
2  * This file is part of the statismo library.
3  *
4  * Author: Marcel Luethi (marcel.luethi@unibas.ch)
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 
39 #ifndef __POSTERIORMODELBUILDER_H_
40 #define __POSTERIORMODELBUILDER_H_
41 
42 #include <list>
43 #include <vector>
44 
45 #include "CommonTypes.h"
46 #include "Config.h"
47 #include "DataManager.h"
48 #include "ModelBuilder.h"
49 #include "Representer.h"
50 #include "StatisticalModel.h"
51 
52 namespace statismo {
53 
54 
70 template <typename T>
72  public:
73 
74  typedef Representer<T> RepresenterType;
78  typedef typename RepresenterType::ValueType ValueType;
79  typedef typename RepresenterType::PointType PointType;
80  typedef typename StatisticalModelType::PointValueListType PointValueListType;
81  typedef typename DataManagerType::DataItemListType DataItemListType;
82 
83  // Maybe at some point, we can statically define a 3x3 resp. 2x3 matrix type.
84  typedef MatrixType PointCovarianceMatrixType;
85 
86  typedef typename StatisticalModelType::PointValuePairType PointValuePairType;
87  typedef typename std::pair<PointValuePairType, PointCovarianceMatrixType> PointValueWithCovariancePairType;
88  typedef typename std::list<PointValueWithCovariancePairType> PointValueWithCovarianceListType;
89 
95  return new PosteriorModelBuilder();
96  }
97 
103  void Delete() {
104  delete this;
105  }
106 
111 
124  StatisticalModelType* BuildNewModel(const DataItemListType& dataItemList,
125  const PointValueListType& pointValues,
126  double pointValueNoiseVariance,
127  double noiseVariance) const;
128 
129 
142  StatisticalModelType* BuildNewModel(const DataItemListType& DataItemList,
143  const PointValueWithCovarianceListType& pointValuesWithCovariance,
144  double noiseVariance) const;
145 
146 
147 
164  StatisticalModelType* BuildNewModelFromModel(const StatisticalModelType* model, const PointValueListType& pointValues, double pointValueNoiseVariance, bool computeScores=true) const;
165 
166 
183  const PointValueWithCovarianceListType& pointValuesWithCovariance,
184  bool computeScores=true) const;
185 
195  PointValueWithCovarianceListType TrivialPointValueWithCovarianceListWithUniformNoise(const PointValueListType& pointValues,
196  double pointValueNoiseVariance) const;
197 
198  private:
201  PosteriorModelBuilder& operator=(const PosteriorModelBuilder& rhs);
202 
203 
204 };
205 
206 } // namespace statismo
207 
208 #include "PosteriorModelBuilder.hxx"
209 
210 #endif /* __POSTERIORMODELBUILDER_H_ */
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: DataManager.h:114
static PosteriorModelBuilder * Create()
Definition: PosteriorModelBuilder.h:94
StatisticalModelType * BuildNewModel(const DataItemListType &dataItemList, const PointValueListType &pointValues, double pointValueNoiseVariance, double noiseVariance) const
Definition: PosteriorModelBuilder.hxx:65
StatisticalModelType * BuildNewModelFromModel(const StatisticalModelType *model, const PointValueListType &pointValues, double pointValueNoiseVariance, bool computeScores=true) const
Definition: PosteriorModelBuilder.hxx:76
PointValueWithCovarianceListType TrivialPointValueWithCovarianceListWithUniformNoise(const PointValueListType &pointValues, double pointValueNoiseVariance) const
Definition: PosteriorModelBuilder.hxx:88
virtual ~PosteriorModelBuilder()
Definition: PosteriorModelBuilder.h:110
A Point/Value pair that is used to specify a value at a given point.
Definition: StatisticalModel.h:100
Given a statistical model (prior) and a set of point constraints (likelihood), generate a new PCA mod...
Definition: PosteriorModelBuilder.h:71
void Delete()
Definition: PosteriorModelBuilder.h:103
ITK Wrapper for the statismo::StatisticalModel class.
Definition: itkStatisticalModel.h:62