MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLVesselGraph/AssocGraph.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00003 
00008 // $Id: AssocGraph.h 50846 2007-02-13 17:59:51Z okonrad $
00009 // $Source$
00010 //--------------------------------------------------------------------------------------
00011 #ifndef __AssocGraph_h__
00012 #define __AssocGraph_h__
00013 
00014 
00015 #include "mlVesselGraphSystem.h"
00016 #include "mlMatrixTemplate.h"
00017 #include "mlSystemWarningsDisable.h"
00018 #include <list>
00019 
00020 #include <valarray>
00021 #include "mlSystemWarningsRestore.h"
00022 
00023 ML_START_NAMESPACE
00024 
00025 
00027 
00028 typedef std::vector<double>       CDouble1Vec;
00029 typedef std::vector<CDouble1Vec>  CDouble2Vec;
00030 typedef std::vector<CDouble2Vec>  CDoubleArray;  
00032 
00033 #define N_XPPOS   0
00034 #define N_YPPOS   1
00035 #define N_ZPPOS   2
00036 #define N_RL      3
00037 
00038 #define N_EDGEA   0
00039 #define N_EDGEB   1
00040 #define N_EDGENO  2
00041 #define N_DIST    3
00042 
00043 #define DELTA_POS 0.1
00044 
00045 //------------------------------------------------------------------------------------------------------
00047 //------------------------------------------------------------------------------------------------------
00049 class PointMap
00050 {
00051 public:
00052   int _nP1;                         
00053   int _nP2;                         
00054 
00056 
00057   inline bool operator<(const PointMap& pm) const { if(_nP1 != pm._nP1){return _nP1 < pm._nP1;} else {return _nP2 < pm._nP2;} }
00058   inline bool operator==(const PointMap& pm) const { return ((_nP1 == pm._nP1) && (_nP2 == pm._nP2)); }
00060 };
00061 
00062 
00063 //------------------------------------------------------------------------------------------------------
00065 //------------------------------------------------------------------------------------------------------
00067 class PathInfo
00068 {
00069 public:
00070   std::valarray<bool> _vPath;       
00071   double              _dLength;     
00072   int                 _nIdx;        
00073 
00074   void           *    _pNode;       
00075 
00076   PathInfo(void);                   
00077   PathInfo(size_t size);            
00078 
00079 };
00080 
00081 
00082 
00083 
00084 //------------------------------------------------------------------------------------------------------
00087 //------------------------------------------------------------------------------------------------------
00089 class IsomorphismMap
00090 {
00091   size_t _N1;                       
00092   size_t _N2;                       
00093 
00094 public:
00095   std::valarray<bool>  _w1;         
00096   std::valarray<bool>  _w2;         
00097   std::list<PointMap>  _LMap;       
00098 
00100 
00101   IsomorphismMap(void);
00102   IsomorphismMap(size_t N1, size_t N2);
00103   IsomorphismMap(size_t N1, size_t N2, const PointMap&);
00104   IsomorphismMap(const IsomorphismMap&);
00106 
00108 
00109   IsomorphismMap& operator=(const IsomorphismMap&);       
00110   bool operator==(const IsomorphismMap&) const;                 
00111   bool operator<(const IsomorphismMap&) const;                  
00112 
00113 
00115 
00116   bool addPointMap          (const PointMap& pm);         
00117   bool addPointMapAscending (const PointMap& pm, int n);  
00118   void removePointMap       (const PointMap& pm);         
00119   void clear ();                                          
00120   void resize (size_t N1, size_t N2);                     
00121 
00122 };
00123 
00124 
00125 
00126 //------------------------------------------------------------------------------------------------------
00132 //------------------------------------------------------------------------------------------------------
00134 class VESSELGRAPH_EXPORT AssocGraph
00135 {
00136   MatrixSizedTemplate<double, 0, 0> _mTAG;        
00137   std::list<PointMap>       _LMapTable;           
00138 
00139   std::list<IsomorphismMap> _LIsoMap;             
00140 
00141   size_t _N1;                                     
00142   size_t _N2;                                     
00143 
00144 
00145 public:
00146   //--------------------------------------------------------------------------------------------
00148 
00149   typedef std::list<PointMap>::iterator MapIterator;
00150   typedef std::list<PointMap>::const_iterator constMapIterator;
00151   typedef std::list<IsomorphismMap>::iterator IsoIterator;
00152   typedef std::list<IsomorphismMap>::const_iterator constIsoIterator;
00154   //--------------------------------------------------------------------------------------------
00155 
00156 
00157   //--------------------------------------------------------------------------------------------
00159 
00160 
00161 
00162 
00163 
00164 
00165   bool calcAssocMatrix(const MatrixTemplate<double>& mDist1,  
00166                        const MatrixTemplate<double>& mDist2,  
00167                        double dSigma,                         
00168                        double dScale                          
00169                        );
00170 
00180   bool calcAssocMatrix(const CDoubleArray & AClass1,  
00181                        const CDoubleArray & AClass2,  
00182                        double dSigma,                 
00183                        double dScale                  
00184                       );
00185 
00187   bool calcMaxClique (double dAssocLevel);
00188 
00190   bool calcAutoMaxClique(double *pdAssocLevel, double dStep=0.1);
00191 
00193   bool expandMap(int nIdx);
00194 
00196   bool expandMap(int nIdx, double dAssocLevel);
00198   //--------------------------------------------------------------------------------------------
00199 
00200 
00201   //--------------------------------------------------------------------------------------------
00203 
00204   std::string printMapInformation ();                                   
00205 
00206   std::list<PointMap>       * getPointMap () { return &_LMapTable; }    
00207   std::list<IsomorphismMap> * getIsoMap   () { return &_LIsoMap; }      
00208 
00209   //--------------------------------------------------------------------------------------------
00210 
00211 };
00212 
00213 
00214 
00215 ML_END_NAMESPACE
00216 
00217 #endif