primatologist-gpl  5.1.2
proba.h
Go to the documentation of this file.
1 /* Copyright (C) 2000-2013 CEA
2  *
3  * This software and supporting documentation were developed by
4  * bioPICSEL
5  * CEA/DSV/I²BM/MIRCen/LMN, Batiment 61,
6  * 18, route du Panorama
7  * 92265 Fontenay-aux-Roses
8  * France
9  */
10 
11 #ifndef PRIMATOLOGIST_PROBA_PROBA_H
12 #define PRIMATOLOGIST_PROBA_PROBA_H
13 
14 #include <cartodata/volume/volume.h>
15 
16 namespace aims {
17 namespace proba {
18 
19  //--- attenuate ------------------------------------------------------------
20 
21  double attenuate( double proba, float alpha, int n );
22 
23  template <typename P, typename M>
24  carto::VolumeRef<P> &
25  attenuate( carto::VolumeRef<P> & proba,
26  float alpha,
27  const carto::VolumeRef<M> & mask );
28 
29  template <typename P>
30  carto::VolumeRef<P> &
31  attenuate( carto::VolumeRef<P> & proba,float alpha );
32 
33  template <typename P, typename M>
34  carto::VolumeRef<P>
35  newAttenuate( const carto::VolumeRef<P> & proba,
36  float alpha,
37  const carto::VolumeRef<M> & mask );
38 
39  template <typename P>
40  carto::VolumeRef<P>
41  newAttenuate( const carto::VolumeRef<P> & proba, float alpha );
42 
43  template <typename P, typename M>
44  carto::VolumeRef<P> &
45  attenuateZ( carto::VolumeRef<P> & proba,
46  float alpha,
47  const carto::VolumeRef<M> & mask );
48 
49  template <typename P>
50  carto::VolumeRef<P> &
51  attenuateZ( carto::VolumeRef<P> & proba, float alpha );
52 
53  template <typename P, typename M>
54  carto::VolumeRef<P>
55  newAttenuateZ( const carto::VolumeRef<P> & proba,
56  float alpha,
57  const carto::VolumeRef<M> & mask );
58 
59  template <typename P>
60  carto::VolumeRef<P>
61  newAttenuateZ( const carto::VolumeRef<P> & proba, float alpha );
62 
63  //--- normalize ------------------------------------------------------------
64 
65  template <typename P, typename M>
66  carto::VolumeRef<P> &
67  normalize( carto::VolumeRef<P> & proba,
68  const carto::VolumeRef<M> & mask );
69 
70  template <typename P>
71  carto::VolumeRef<P> &
72  normalize( carto::VolumeRef<P> & proba );
73 
74  template <typename P, typename M>
75  carto::VolumeRef<P>
76  newNormalize( const carto::VolumeRef<P> & proba,
77  const carto::VolumeRef<M> & mask );
78 
79  template <typename P>
80  carto::VolumeRef<P>
81  newNormalize( const carto::VolumeRef<P> & proba );
82 
83  //--- pdf ------------------------------------------------------------------
84 
85  // TODO: multivariate case
86  template <typename P, typename I, typename M, typename Distrib>
87  carto::VolumeRef<P> &
88  pdf( const std::vector<Distrib> & param,
89  const carto::VolumeRef<I> & values,
90  carto::VolumeRef<P> & output,
91  const carto::VolumeRef<M> & mask );
92 
93  template <typename P, typename I, typename Distrib>
94  carto::VolumeRef<P> &
95  pdf( const std::vector<Distrib> & param,
96  const carto::VolumeRef<I> & values,
97  carto::VolumeRef<P> & output );
98 
99  template <typename P, typename I, typename M, typename Distrib>
100  carto::VolumeRef<P>
101  newPdf( const std::vector<Distrib> & param,
102  const carto::VolumeRef<I> & values,
103  const carto::VolumeRef<M> & mask );
104 
105  template <typename P, typename I, typename Distrib>
106  carto::VolumeRef<P>
107  newPdf( const std::vector<Distrib> & param,
108  const carto::VolumeRef<I> & values );
109 
110  //--- bayes : stationary ---------------------------------------------------
111 
112  template <typename OP, typename P1, typename P2, typename M>
113  carto::VolumeRef<OP> &
114  bayes( const carto::VolumeRef<P1> & conditional,
115  const std::vector<P2> & prior,
116  carto::VolumeRef<OP> & output,
117  const carto::VolumeRef<M> & mask );
118 
119  template <typename OP, typename P1, typename P2>
120  carto::VolumeRef<OP> &
121  bayes( const carto::VolumeRef<P1> & conditional,
122  const std::vector<P2> & prior,
123  carto::VolumeRef<OP> & output);
124 
125  template <typename OP, typename P1, typename P2, typename M>
126  carto::VolumeRef<OP>
127  newBayes( const carto::VolumeRef<P1> & conditional,
128  const std::vector<P2> & prior,
129  const carto::VolumeRef<M> & mask );
130 
131  template <typename OP, typename P1, typename P2>
132  carto::VolumeRef<OP>
133  newBayes( const carto::VolumeRef<P1> & conditional,
134  const std::vector<P2> & prior );
135 
136  //--- bayes : non-stationary -----------------------------------------------
137 
138  template <typename OP, typename P1, typename P2, typename M>
139  carto::VolumeRef<OP> &
140  bayes( const carto::VolumeRef<P1> & conditional,
141  const carto::VolumeRef<P2> & prior,
142  carto::VolumeRef<OP> & output,
143  const carto::VolumeRef<M> & mask );
144 
145  template <typename OP, typename P1, typename P2>
146  carto::VolumeRef<OP> &
147  bayes( const carto::VolumeRef<P1> & conditional,
148  const carto::VolumeRef<P2> & prior,
149  carto::VolumeRef<OP> & output);
150 
151  template <typename OP, typename P1, typename P2, typename M>
152  carto::VolumeRef<OP>
153  newBayes( const carto::VolumeRef<P1> & conditional,
154  const carto::VolumeRef<P2> & prior,
155  const carto::VolumeRef<M> & mask );
156 
157  template <typename OP, typename P1, typename P2>
158  carto::VolumeRef<OP>
159  newBayes( const carto::VolumeRef<P1> & conditional,
160  const carto::VolumeRef<P2> & prior );
161 
162  //--- robust bayes : stationary --------------------------------------------
163 
164  template <typename OP, typename P1, typename P2, typename M>
165  carto::VolumeRef<OP> &
166  robustBayes( int n_best,
167  const carto::VolumeRef<P1> & conditional,
168  const std::vector<P2> & prior,
169  carto::VolumeRef<OP> & output,
170  const carto::VolumeRef<M> & mask );
171 
172  template <typename OP, typename P1, typename P2>
173  carto::VolumeRef<OP> &
174  robustBayes( int n_best,
175  const carto::VolumeRef<P1> & conditional,
176  const std::vector<P2> & prior,
177  carto::VolumeRef<OP> & output);
178 
179  template <typename OP, typename P1, typename P2, typename M>
180  carto::VolumeRef<OP>
181  newRobustBayes( int n_best,
182  const carto::VolumeRef<P1> & conditional,
183  const std::vector<P2> & prior,
184  const carto::VolumeRef<M> & mask );
185 
186  template <typename OP, typename P1, typename P2>
187  carto::VolumeRef<OP>
188  newRobustBayes( int n_best,
189  const carto::VolumeRef<P1> & conditional,
190  const std::vector<P2> & prior );
191 
192  //--- robust bayes : non-stationary ----------------------------------------
193 
194  template <typename OP, typename P1, typename P2, typename M>
195  carto::VolumeRef<OP> &
196  robustBayes( int n_best,
197  const carto::VolumeRef<P1> & conditional,
198  const carto::VolumeRef<P2> & prior,
199  carto::VolumeRef<OP> & output,
200  const carto::VolumeRef<M> & mask );
201 
202  template <typename OP, typename P1, typename P2>
203  carto::VolumeRef<OP> &
204  robustBayes( int n_best,
205  const carto::VolumeRef<P1> & conditional,
206  const carto::VolumeRef<P2> & prior,
207  carto::VolumeRef<OP> & output);
208 
209  template <typename OP, typename P1, typename P2, typename M>
210  carto::VolumeRef<OP>
211  newRobustBayes( int n_best,
212  const carto::VolumeRef<P1> & conditional,
213  const carto::VolumeRef<P2> & prior,
214  const carto::VolumeRef<M> & mask );
215 
216  template <typename OP, typename P1, typename P2>
217  carto::VolumeRef<OP>
218  newRobustBayes( int n_best,
219  const carto::VolumeRef<P1> & conditional,
220  const carto::VolumeRef<P2> & prior );
221 
222  //--- maximum likelihood ---------------------------------------------------
223 
224  template <typename C, typename P, typename M>
225  carto::VolumeRef<C> &
226  maximumLikelihood( const carto::VolumeRef<P> & proba,
227  carto::VolumeRef<C> & output,
228  const carto::VolumeRef<M> & mask );
229 
230  template <typename C, typename P>
231  carto::VolumeRef<C> &
232  maximumLikelihood( const carto::VolumeRef<P> & proba,
233  carto::VolumeRef<C> & output );
234 
235  template <typename C, typename P, typename M>
236  carto::VolumeRef<C>
237  newMaximumLikelihood( const carto::VolumeRef<P> & proba,
238  const carto::VolumeRef<M> & mask );
239 
240  template <typename C, typename P>
241  carto::VolumeRef<C>
242  newMaximumLikelihood( const carto::VolumeRef<P> & proba );
243 
244  //--- maximum a posteriori -------------------------------------------------
245 
246  template <typename C, typename P1, typename P2, typename M>
247  carto::VolumeRef<C> &
248  maximumAPosteriori( const carto::VolumeRef<P1> & conditional,
249  const carto::VolumeRef<P2> & prior,
250  carto::VolumeRef<C> & output,
251  const carto::VolumeRef<M> & mask );
252 
253  template <typename C, typename P1, typename P2>
254  carto::VolumeRef<C> &
255  maximumAPosteriori( const carto::VolumeRef<P1> & conditional,
256  const carto::VolumeRef<P2> & prior,
257  carto::VolumeRef<C> & output );
258 
259  template <typename C, typename P1, typename P2, typename M>
260  carto::VolumeRef<C>
261  newMaximumAPosteriori( const carto::VolumeRef<P1> & conditional,
262  const carto::VolumeRef<P2> & prior,
263  const carto::VolumeRef<M> & mask );
264 
265  template <typename C, typename P1, typename P2>
266  carto::VolumeRef<C>
267  newMaximumAPosteriori( const carto::VolumeRef<P1> & conditional,
268  const carto::VolumeRef<P2> & prior );
269 
270  //--- robust maximum a posteriori ------------------------------------------
271 
272  template <typename C, typename P1, typename P2, typename M>
273  carto::VolumeRef<C> &
274  robustMaximumAPosteriori( int n_best,
275  const carto::VolumeRef<P1> & conditional,
276  const carto::VolumeRef<P2> & prior,
277  carto::VolumeRef<C> & output,
278  const carto::VolumeRef<M> & mask );
279 
280  template <typename C, typename P1, typename P2>
281  carto::VolumeRef<C> &
282  robustMaximumAPosteriori( int n_best,
283  const carto::VolumeRef<P1> & conditional,
284  const carto::VolumeRef<P2> & prior,
285  carto::VolumeRef<C> & output );
286 
287  template <typename C, typename P1, typename P2, typename M>
288  carto::VolumeRef<C>
289  newRobustMaximumAPosteriori( int n_best,
290  const carto::VolumeRef<P1> & conditional,
291  const carto::VolumeRef<P2> & prior,
292  const carto::VolumeRef<M> & mask );
293 
294  template <typename C, typename P1, typename P2>
295  carto::VolumeRef<C>
296  newRobustMaximumAPosteriori( int n_best,
297  const carto::VolumeRef<P1> & conditional,
298  const carto::VolumeRef<P2> & prior );
299 
300  //--- log-likelihood -------------------------------------------------------
301 
302  template <typename P, typename M>
303  double
304  logLikelihoodSum( const carto::VolumeRef<P> & conditional,
305  const carto::VolumeRef<M> & mask );
306 
307  template <typename P>
308  double
309  logLikelihoodSum( const carto::VolumeRef<P> & proba);
310 
311 } // namespace proba
312 } // namespace aims
313 
314 #endif // PRIMATOLOGIST_PROBA_PROBA_H
carto::VolumeRef< OP > newRobustBayes(int n_best, const carto::VolumeRef< P1 > &conditional, const std::vector< P2 > &prior, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:429
carto::VolumeRef< P > & normalize(carto::VolumeRef< P > &proba, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:151
double attenuate(double proba, float alpha, int n)
Definition: proba_d.h:33
carto::VolumeRef< P > newPdf(const std::vector< Distrib > &param, const carto::VolumeRef< I > &values, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:234
double logLikelihoodSum(const carto::VolumeRef< P > &conditional, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:720
carto::VolumeRef< P > newNormalize(const carto::VolumeRef< P > &proba, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:183
carto::VolumeRef< P > newAttenuateZ(const carto::VolumeRef< P > &proba, float alpha, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:129
carto::VolumeRef< C > newRobustMaximumAPosteriori(int n_best, const carto::VolumeRef< P1 > &conditional, const carto::VolumeRef< P2 > &prior, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:697
carto::VolumeRef< P > newAttenuate(const carto::VolumeRef< P > &proba, float alpha, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:71
carto::VolumeRef< C > & maximumAPosteriori(const carto::VolumeRef< P1 > &conditional, const carto::VolumeRef< P2 > &prior, carto::VolumeRef< C > &output, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:578
carto::VolumeRef< P > & pdf(const std::vector< Distrib > &param, const carto::VolumeRef< I > &values, carto::VolumeRef< P > &output, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:205
carto::VolumeRef< C > newMaximumAPosteriori(const carto::VolumeRef< P1 > &conditional, const carto::VolumeRef< P2 > &prior, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:623
carto::VolumeRef< C > newMaximumLikelihood(const carto::VolumeRef< P > &proba, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:559
carto::VolumeRef< C > & robustMaximumAPosteriori(int n_best, const carto::VolumeRef< P1 > &conditional, const carto::VolumeRef< P2 > &prior, carto::VolumeRef< C > &output, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:644
carto::VolumeRef< OP > & robustBayes(int n_best, const carto::VolumeRef< P1 > &conditional, const std::vector< P2 > &prior, carto::VolumeRef< OP > &output, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:384
carto::VolumeRef< C > & maximumLikelihood(const carto::VolumeRef< P > &proba, carto::VolumeRef< C > &output, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:523
carto::VolumeRef< OP > newBayes(const carto::VolumeRef< P1 > &conditional, const std::vector< P2 > &prior, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:291
carto::VolumeRef< P > & attenuateZ(carto::VolumeRef< P > &proba, float alpha, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:91
carto::VolumeRef< OP > & bayes(const carto::VolumeRef< P1 > &conditional, const std::vector< P2 > &prior, carto::VolumeRef< OP > &output, const carto::VolumeRef< M > &mask)
Definition: proba_d.h:256