DGtal  1.1.0
Profile.h
1 
17 #pragma once
18 
33 #if defined(Profile_RECURSES)
34 #error Recursive header files inclusion detected in Profile.h
35 #else // defined(Profile_RECURSES)
36 
37 #define Profile_RECURSES
38 
39 #if !defined Profile_h
40 
41 #define Profile_h
42 
44 // Inclusions
45 #include <iostream>
46 #include <vector>
47 #include "DGtal/math/Statistic.h"
48 
49 #include "DGtal/base/Common.h"
51 
52 namespace DGtal
53 {
54 
56  // class Profile
135  template<typename TValueFunctor = functors::Identity, typename TValue = double >
136  class Profile
137  {
138  // ----------------------- Standard services ------------------------------
139  public:
140 
147 
151  typedef TValueFunctor Functor;
152 
156  typedef TValue Value;
157 
159 
160 
165 
170 
171 
177 
178 
183  Profile( const Profile & other );
184 
185 
192  Profile & operator= ( const Profile & other );
193 
194 
195 
199  void clear();
200 
201 
202 
213  template <typename Iterator>
214  void init( Iterator beginXvalues, Iterator endXvalues,
215  const bool storeValsInStats=false );
216 
217 
218 
227  void init( const unsigned int nb, const bool storeValsInStats=false );
228 
229 
236  void addValue( const unsigned int indexX, const TValue value );
237 
238 
246  void addStatistic( const unsigned int indexX, const Statistic<Value> & stat );
247 
248 
249 
267  void stopStatsSaving() ;
268 
269 
270 
271 
272  // ----------------------- Profile services --------------------------------
273  public:
274 
281  void setType(const ProfileType type);
282 
283 
284 
292  void getProfile( std::vector<Value> & x,
293  std::vector<Value> & y ) const;
294 
295 
296 
297 
298 
299 
300  // ----------------------- Interface --------------------------------------
301  public:
302 
307  void selfDisplay ( std::ostream & out ) const;
308 
313  bool isValid() const;
314 
315  // ------------------------- Protected Datas ------------------------------
316  private:
317  // ------------------------- Private Datas --------------------------------
318  private:
319 
321 
325  std::vector<Value>* myXsamples;
326 
330  std::vector< Statistic<Value> >* myStats;
331 
337 
338 
339 
347 
348 
349 
350  // ------------------------- Hidden services ------------------------------
351  protected:
352 
353 
354  private:
355 
356 
357 
358 
359  // ------------------------- Internals ------------------------------------
360  private:
361 
362  }; // end of class Profile
363 
364 
371  template< typename TValueFunctor, typename TValue >
372  std::ostream&
373  operator<< ( std::ostream & out, const Profile<TValueFunctor, TValue> & object );
374 
375 
376 } // namespace DGtal
377 
378 
380 // Includes inline functions.
381 #if !defined(BUILD_INLINE)
382 #include "DGtal/math/Profile.ih"
383 #endif
384 
385 
386 // //
388 
389 #endif // !defined Profile_h
390 
391 #undef Profile_RECURSES
392 #endif // else defined(Profile_RECURSES)
DGtal::Profile::myXsamples
std::vector< Value > * myXsamples
Definition: Profile.h:325
DGtal::Profile
Aim: This class can be used to represent a profile (PX, PY) defined from an input set of samples (Xi,...
Definition: Profile.h:137
DGtal::Profile::MEAN
@ MEAN
Definition: Profile.h:146
DGtal::Profile::MAX
@ MAX
Definition: Profile.h:146
DGtal::Profile::MIN
@ MIN
Definition: Profile.h:146
DGtal::Profile::myProfileDef
ProfileType myProfileDef
Definition: Profile.h:336
DGtal::Profile::clear
void clear()
DGtal::Statistic< Value >
DGtal::Profile::MEDIAN
@ MEDIAN
Definition: Profile.h:146
DGtal::Profile::Profile
Profile(const Profile &other)
DGtal::Profile::isValid
bool isValid() const
DGtal::Profile::addValue
void addValue(const unsigned int indexX, const TValue value)
DGtal::Profile::setType
void setType(const ProfileType type)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::Profile::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< Functor, Value, Value >))
DGtal::Profile::myStoreValInStats
bool myStoreValInStats
Definition: Profile.h:346
DGtal::Profile::init
void init(const unsigned int nb, const bool storeValsInStats=false)
DGtal::Profile::~Profile
~Profile()
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::Profile::stopStatsSaving
void stopStatsSaving()
DGtal::Profile::addStatistic
void addStatistic(const unsigned int indexX, const Statistic< Value > &stat)
DGtal::Profile::operator=
Profile & operator=(const Profile &other)
DGtal::Profile::ProfileType
ProfileType
Definition: Profile.h:146
DGtal::Profile::getProfile
void getProfile(std::vector< Value > &x, std::vector< Value > &y) const
DGtal::Profile::Profile
Profile()
DGtal::Profile::myStats
std::vector< Statistic< Value > > * myStats
Definition: Profile.h:330
DGtal::Profile::myFunctor
Functor myFunctor
Definition: Profile.h:320
DGtal::Profile::Functor
TValueFunctor Functor
Definition: Profile.h:151
DGtal::Profile::init
void init(Iterator beginXvalues, Iterator endXvalues, const bool storeValsInStats=false)
DGtal::Profile::Value
TValue Value
Definition: Profile.h:156
DGtal::Profile::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Profile::Profile
Profile(ProfileType type)
DGtal::concepts::CUnaryFunctor
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90