DGtal  1.2.0
labelledMapBestParameters.cpp
Go to the documentation of this file.
1 
30 #include <iostream>
31 #include "DGtal/base/Common.h"
32 #include "DGtal/base/LabelledMap.h"
33 
35 
36 using namespace std;
37 using namespace DGtal;
38 
40 void usage()
41 {
42  cerr << "Usage: ./labelledMapBestParameters <L> <p> <q>" << endl
43  << " Tries to find the best values N and M which will minimized" << endl
44  << " the memory usage of a LabelledMap, for the distribution" << endl
45  << " specified by the parameters." << endl
46  << " - L: max number of labels." << endl
47  << " - p: If there is a possibility to have a data, this probability is used to define a geometric distribution that defines the number of data (ie valid labels) at this place. The smaller, the higher is the expectation. 0.5 means E(X) = 1.." << endl
48  << " - q: probability that there is no data at this location." << endl;
49 }
50 int main( int argc, char** argv )
51 {
52  typedef double Data;
53  if ( argc < 4 )
54  {
55  usage();
56  return 1;
57  }
58 
59  std::pair< unsigned int, unsigned int > res =
60  DGtal::detail::argminLabelledMapMemoryUsageForGeometricDistribution<Data>
61  ( atoi( argv[ 1 ] ), atof( argv[ 3 ] ), atof( argv[ 2 ] ) );
62  cout << res.first << " " << res.second << endl;
63  return 0;
64 }
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.