Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Main.h

Go to the documentation of this file.
00001 
00049 #include <stdio.h>
00050 #include <stdlib.h>
00051 #include <time.h>
00052 
00053 #include <DAG.h>
00054 #include <DAGDatabase.h>
00055 #include <ShockGraph.h>
00056 #include <GestureGraph.h>
00057 #include <VisualDAG.h>
00058 #include <LEDA/window.h>
00059 
00060 #include <Exceptions.h>
00061 #include <HelperFunctions.h>
00062 #include <Debug.h>
00063 #include <DirWalker.h>
00064 #include <UnixFuncPrototypes.h>
00065 
00066 #include <algorithm>
00067 #include <string>
00068 
00069 #include "CmdLineParser.h"
00070 #include "ViewSubsampler.h"
00071 #include "Stats.h"
00072 
00073 struct MATCHINFO
00074 {
00075         double idxtau, matchtau, idxrange, modelSimWeight;
00076         int idxKBest, computeStats, asyncCompu, showResults, saveResults;
00077 };
00078 
00079 struct SGRECINFO
00080 {
00081         SGCP sgparams;
00082         int usenewcode, timeout;
00083 };
00084 
00085 class DAGCmdLineParser : public CmdLineParser
00086 {
00087         typedef bool (DAGCmdLineParser::*DAG_ACTION)();
00088 
00089         MATCHINFO m_matchInfo;
00090         SGRECINFO m_sgInfo;
00091 
00092         double m_maxOcclusionRate, m_dNeigRange;
00093         int m_iterations, m_maxdags, m_imgstep, m_from, m_to;
00094         int m_nVerbose, m_saveSubsamplingInfo, m_nSplitProportion, m_nSplitByObject;
00095 
00096         LPCSTR m_target, m_objName, m_delobj, 
00097                 m_createObj, m_viewDag, m_szMatrixFileName;
00098                 
00099 public:         
00100         DAG::MatchParams m_matchParams;
00101 
00102 public:
00103         DAGDatabase dagDB;
00104 
00105 public:
00106         bool AddObjsToDB();
00107         bool CreateDBIndex();
00108         bool Match();
00109         bool CreateMatrix();
00110         bool ViewDAGs();
00111         bool ViewDAG();
00112         bool ListDAGs();
00113         bool ShowDBSize();
00114         bool CreateAffinityMatrix();
00115         bool PlotNodeInfo();
00116         bool SplitDB();
00117         bool MergeDB();
00118         bool UpdateDB();
00119         bool RecomputeSG();
00120         bool Test();
00121         bool ListObjectNames();
00122         bool DeleteObj();
00123         bool EnterDbgMode();
00124         bool DeleteDAG();
00125         bool DeleteObjects();
00126         bool ClosestNeigList();
00127         bool GetNeig();
00128         bool ShowHelp();
00129 
00130         bool Verbose() { return m_nVerbose != 0; }
00131 
00132         virtual void InitOptions();
00133         virtual void ShowUsageExamples();
00134 
00135         virtual bool ExecAction(CLP_ACTION pAction)
00136         {
00137                 DAG_ACTION action = (DAG_ACTION) pAction;
00138                 return (this->*action)();
00139         }
00140         
00141         void SetSGComputationSyncMode() { m_matchInfo.asyncCompu = 0; }
00142         bool IsSGComputationSyncMode() const { return m_matchInfo.asyncCompu == 0; }
00143 };
00144 
00145 // Functions defined in Matching.cpp
00146 int AsyncIndexDAG(const DAG* pQueryDag, DAGDatabase& dagDB, MATCHINFO& info, STATINFO& idxSt);
00147 double AsyncMatchDAG(const DAG* pQueryDag, const DAG* pModelDag, DAGNodeMap& nodeMap);
00148 time_t MatchDAG(const DAG* pTargetDag, DAGDatabase& dagDB, MATCHINFO& info, STATINFO& idxSt, STATINFO& matSt);
00149 void MatchDAG(const DAG* pImgDag, DAGDatabase& dagDB, MATCHINFO& info, streamoff nModelDagOffset, STATINFO& matSt);
00150 void ProcessFile(const char* szFileName, DAGDatabase& dagDB, fstream& logFile, SGRECINFO& info, bool bAsyncProcessing);
00151 void SaveResults(const DAG* pTarget, DAGDatabase& dagDB, STATINFO& idxSt, STATINFO& matSt, ostream& os);
00152 bool ShowResults(const DAG* pTarget, STATINFO& matSt, DAGDatabase& queryDB, DAGDatabase& modelDB, int nTgtID =-1);
00153 double OccludeDAG(DAGPtr& ptrDag, double dMaxOcclusionRate);
00154 //double SGNodeDistance(const SGNode& n1, const SGNode& n2);
00155 bool AskBool(const char* szQuestion);
00156 int AskInt(const char* szQuestion);
00157 void OnAlarm(int param);
00158 void MakeSquare(const char* szPPMFileName);
00159 void ShowMatch(const DAG* pDag1, const DAG* pDag2);
00160 void ShowMatch(DAGDatabase& dagDB1, int nDag1Id, DAGDatabase& dagDB2, int nDag2Id);
00161 void ShowSkeletonMatch(const DAG* pDag1, const DAG* pDag2, DAGNodeMap& nodeMap);
00162 void ShowSkeleton(const DAG* pDag);
00163 void AddSubsamplingInfo(ViewSubsampler& vs, const DAG* pTarget, STATINFO& matSt, int kBest);
00164 void SaveSubsamplingInfo(ViewSubsampler& vs, String strDBFileName);
00165 SmartArray<int> GetFarthestViews(int i, int res, double deg);
00166 SmartArray<int> Complement128(int tgt, const int* views, int n);

Generated on Sat Nov 13 11:21:24 2004 for Noisy DAG Matcher by doxygen1.2.18