Structural deformable models
analysis.cpp
Go to the documentation of this file.
1 //this is a dump of different analysis sources
2 
3 //springconst tuning evaluation
4 
5 {
6  ofstream os("refinestat.txt",ios::app);
7  os << "statistics for shape refinement" << endl;
8  os << "model\tpoint dist\tchamfer\thausdorff" << endl;
9  do{
10  loadSpecies(m_DBSelector.getCurSpecies());
11  CHECK_THREAD(DO_ANALYSIS);
12  cout << "hello" << endl;
13  //do analysis here (anahere)
14  Model refmod(*m_Geom);
15  Model omod(*m_Geom);
16  m_GeomMutex.lock();
17  if(st.getRefModel(m_CSpecies.id, refmod)) {
18  attachBrowseData();
19  refmod.attachDataset(&m_Data);
20  omod.attachDataset(&m_Data);
21  m_GeomMutex.unlock();
22  os << "species id: " << m_CSpecies.id
23  << " ppmm = " << m_Data.getPPMM() << endl;
24  cout << "original model" << endl;
25  *m_Geom = omod;
26  m_Geom->adaptProperties(refmod.getProperties());
27  unsigned long nowticks = getMilliSeconds();
28  while(getMilliSeconds()-nowticks < 5*1000)
29  CHECK_THREAD(DO_ANALYSIS); // sleep
30  DUMP(refmod.distance(*m_Geom, Model::DIST_POINTS));
31  DUMP(refmod.distance(*m_Geom, Model::DIST_CPOINTS));
32  DUMP(refmod.distance(*m_Geom, Model::DIST_HPOINTS));
33  os << "orig\t"
34  << refmod.distance(*m_Geom, Model::DIST_POINTS)
35  /m_Data.getPPMM()<<"\t"
36  << refmod.distance(*m_Geom, Model::DIST_CPOINTS)
37  /m_Data.getPPMM()<<"\t"
38  << refmod.distance(*m_Geom, Model::DIST_HPOINTS)
39  /m_Data.getPPMM()
40  << endl;
41  cout << "reference model" << endl;
42  *m_Geom = refmod;
43  m_Geom->adaptProperties(refmod.getProperties());
44  nowticks = getMilliSeconds();
45  while(getMilliSeconds()-nowticks < 5*1000)
46  CHECK_THREAD(DO_ANALYSIS); // sleep
47  DUMP(refmod.distance(*m_Geom, Model::DIST_POINTS));
48  DUMP(refmod.distance(*m_Geom, Model::DIST_CPOINTS));
49  DUMP(refmod.distance(*m_Geom, Model::DIST_HPOINTS));
50  os << "ref\t"
51  << refmod.distance(*m_Geom, Model::DIST_POINTS)
52  /m_Data.getPPMM()<<"\t"
53  << refmod.distance(*m_Geom, Model::DIST_CPOINTS)
54  /m_Data.getPPMM()<<"\t"
55  << refmod.distance(*m_Geom, Model::DIST_HPOINTS)
56  /m_Data.getPPMM()
57  << endl;
58 
59  static float sscs[] = {0.05, 0.1, 0.2, 0.4, 0.8,
60  1, 1.3, 1.5, 1.8, 2, 2.5, 3,
61  4, 5, 7, 10,-1};
62  for(int ssi = 0; sscs[ssi]>0; ssi++)
63  {
64  float scscale = sscs[ssi];
65  cout << "master model scscale = "<<scscale<< endl;
66  st.buildMasterModel(scscale);
67  *m_Geom = st.getModel();
68  m_Geom->adaptProperties(refmod.getProperties());
69  nowticks = getMilliSeconds();
70  while(getMilliSeconds()-nowticks < 5*1000)
71  CHECK_THREAD(DO_ANALYSIS); // sleep
72  DUMP(refmod.distance(*m_Geom,Model::DIST_POINTS));
73  DUMP(refmod.distance(*m_Geom,Model::DIST_CPOINTS));
74  DUMP(refmod.distance(*m_Geom,Model::DIST_HPOINTS));
75  os << scscale<<"\t"
76  << refmod.distance(*m_Geom, Model::DIST_POINTS)
77  /m_Data.getPPMM()<<"\t"
78  << refmod.distance(*m_Geom, Model::DIST_CPOINTS)
79  /m_Data.getPPMM()<<"\t"
80  << refmod.distance(*m_Geom, Model::DIST_HPOINTS)
81  /m_Data.getPPMM()
82  << endl;
83 
84  }
85  m_GeomMutex.lock();
86  }
87  m_GeomMutex.unlock();
88  if(anastate == -1) { EXIT_THREAD(DO_ANALYSIS); break; }
89  }
90  EXIT_THREAD(DO_ANALYSIS);
91  cout << "analysis terminated" << endl;
92  break;
93 }
94 
95 
#define EXIT_THREAD(t)
Definition: Brain.cpp:318
unsigned long getMilliSeconds()
Definition: utils.h:41
Definition: Model.h:33
unsigned long nowticks
Definition: analysis.cpp:27
#define CHECK_THREAD(t)
Definition: Brain.cpp:324
DUMP(refmod.distance(*m_Geom, Model::DIST_POINTS))