MeVisLab Toolbox Reference
AssocGraph.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ASSOC_GRAPH_H
14 #define ASSOC_GRAPH_H
15 
16 
18 
19 #include "mlVesselGraphSystem.h"
20 #include "mlMatrixTemplate.h"
21 
23 #include <list>
24 #include <vector>
25 #include <valarray>
27 
28 ML_START_NAMESPACE
29 
30 
33 typedef std::vector<double> CDouble1Vec;
34 typedef std::vector<CDouble1Vec> CDouble2Vec;
35 typedef std::vector<CDouble2Vec> CDoubleArray;
37 
38 #define N_XPPOS 0
39 #define N_YPPOS 1
40 #define N_ZPPOS 2
41 #define N_RL 3
42 
43 #define N_EDGEA 0
44 #define N_EDGEB 1
45 #define N_EDGENO 2
46 #define N_DIST 3
47 
48 #define DELTA_POS 0.1
49 
50 //------------------------------------------------------------------------------------------------------
52 //------------------------------------------------------------------------------------------------------
54 class PointMap
55 {
56 public:
57  int _nP1;
58  int _nP2;
59 
62  inline bool operator<(const PointMap& pm) const { if(_nP1 != pm._nP1){return _nP1 < pm._nP1;} else {return _nP2 < pm._nP2;} }
63  inline bool operator==(const PointMap& pm) const { return ((_nP1 == pm._nP1) && (_nP2 == pm._nP2)); }
65 };
66 
67 
68 //------------------------------------------------------------------------------------------------------
70 //------------------------------------------------------------------------------------------------------
72 class PathInfo
73 {
74 public:
75  std::valarray<bool> _vPath;
76  double _dLength;
77  int _nIdx;
78 
79  void * _pNode;
80 
81  PathInfo(void);
82  PathInfo(size_t size);
83 
84 };
85 
86 
87 
88 
89 //------------------------------------------------------------------------------------------------------
92 //------------------------------------------------------------------------------------------------------
95 {
96  size_t _N1;
97  size_t _N2;
98 
99 public:
100  std::valarray<bool> _w1;
101  std::valarray<bool> _w2;
102  std::list<PointMap> _LMap;
103 
107  IsomorphismMap(size_t N1, size_t N2);
108  IsomorphismMap(size_t N1, size_t N2, const PointMap&);
111 
115  bool operator==(const IsomorphismMap&) const;
116  bool operator<(const IsomorphismMap&) const;
118 
121  bool addPointMap (const PointMap& pm);
122  bool addPointMapAscending (const PointMap& pm, int n);
123  void removePointMap (const PointMap& pm);
124  void clear ();
125  void resize (size_t N1, size_t N2);
127 };
128 
129 
130 
131 //------------------------------------------------------------------------------------------------------
137 //------------------------------------------------------------------------------------------------------
140 {
142  std::list<PointMap> _LMapTable;
144  std::list<IsomorphismMap> _LIsoMap;
145 
146  size_t _N1;
147  size_t _N2;
148 
149 
150 public:
151  //--------------------------------------------------------------------------------------------
154  typedef std::list<PointMap>::iterator MapIterator;
155  typedef std::list<PointMap>::const_iterator constMapIterator;
156  typedef std::list<IsomorphismMap>::iterator IsoIterator;
157  typedef std::list<IsomorphismMap>::const_iterator constIsoIterator;
159  //--------------------------------------------------------------------------------------------
160 
161 
162  //--------------------------------------------------------------------------------------------
171  const MatrixTemplate<double>& mDist2,
172  double dSigma,
173  double dScale
174  );
175 
185  bool calcAssocMatrix(const CDoubleArray & AClass1,
186  const CDoubleArray & AClass2,
187  double dSigma,
188  double dScale
189  );
190 
192  bool calcMaxClique (double dAssocLevel);
193 
195  bool calcAutoMaxClique(double *pdAssocLevel, double dStep=0.1);
196 
198  bool expandMap(int nIdx);
199 
201  bool expandMap(int nIdx, double dAssocLevel);
203  //--------------------------------------------------------------------------------------------
204 
205 
206  //--------------------------------------------------------------------------------------------
209  std::string printMapInformation ();
210 
211  std::list<PointMap> * getPointMap () { return &_LMapTable; }
212  std::list<IsomorphismMap> * getIsoMap () { return &_LIsoMap; }
214  //--------------------------------------------------------------------------------------------
215 
216 };
217 
218 
219 
220 ML_END_NAMESPACE
221 
222 #endif
AssocGraph class provides a matrix representation of the association graph of two Graph objects.
Definition: AssocGraph.h:140
std::string printMapInformation()
print information of map to string
std::list< PointMap > * getPointMap()
supply pointer to list defining the max Clique
Definition: AssocGraph.h:211
bool calcAssocMatrix(const CDoubleArray &AClass1, const CDoubleArray &AClass2, double dSigma, double dScale)
calculate association graph by concatenation of classificator arrays of the to graphs
std::list< PointMap >::const_iterator constMapIterator
Definition: AssocGraph.h:155
bool calcMaxClique(double dAssocLevel)
brute force calculation of maximal clique of the association graph
std::list< IsomorphismMap >::const_iterator constIsoIterator
Definition: AssocGraph.h:157
std::list< PointMap >::iterator MapIterator
Definition: AssocGraph.h:154
bool calcAutoMaxClique(double *pdAssocLevel, double dStep=0.1)
simple attempt to calculate the maximal clique with an automatic estimation of the 'optimal' Associat...
bool expandMap(int nIdx, double dAssocLevel)
expand given isomorphism
bool expandMap(int nIdx)
expand given isomorphism
std::list< IsomorphismMap >::iterator IsoIterator
Definition: AssocGraph.h:156
std::list< IsomorphismMap > * getIsoMap()
supply pointer to list of isomorphisms
Definition: AssocGraph.h:212
bool calcAssocMatrix(const MatrixTemplate< double > &mDist1, const MatrixTemplate< double > &mDist2, double dSigma, double dScale)
IsomorphismMap class handles the information of the isomorphism between two Graph structures in form ...
Definition: AssocGraph.h:95
IsomorphismMap(const IsomorphismMap &)
IsomorphismMap & operator=(const IsomorphismMap &)
assignment operator
bool operator==(const IsomorphismMap &) const
comparison to induce order for unambiguous lists
std::list< PointMap > _LMap
list of PointMap defining the isomorphism
Definition: AssocGraph.h:102
std::valarray< bool > _w1
flag field to identify nodes of Graph 1 used in the isomorphism
Definition: AssocGraph.h:100
void removePointMap(const PointMap &pm)
remove PointMap from list
bool operator<(const IsomorphismMap &) const
comparison to induce order for unambiguous lists
bool addPointMap(const PointMap &pm)
add PointMap and check compatibility
IsomorphismMap(size_t N1, size_t N2, const PointMap &)
void resize(size_t N1, size_t N2)
set new size
bool addPointMapAscending(const PointMap &pm, int n)
add PointMap only, if of greater order then last PointMap in list
std::valarray< bool > _w2
flag field to identify nodes of Graph 2 used in the isomorphism
Definition: AssocGraph.h:101
void clear()
clear list
IsomorphismMap(size_t N1, size_t N2)
MatricTemplate implements general Matrix class based on valarray of objects with Template class type ...
class to store informations about connection path for use in calculation of distance matrices
Definition: AssocGraph.h:73
int _nIdx
path id
Definition: AssocGraph.h:77
PathInfo(size_t size)
constructor providing size information
double _dLength
length of path
Definition: AssocGraph.h:76
void * _pNode
end node of path
Definition: AssocGraph.h:79
PathInfo(void)
default constructor
std::valarray< bool > _vPath
bit-flag to store path information
Definition: AssocGraph.h:75
PointMap constitutes a lightweight object for storage of data of two nodes.
Definition: AssocGraph.h:55
bool operator==(const PointMap &pm) const
Definition: AssocGraph.h:63
bool operator<(const PointMap &pm) const
Definition: AssocGraph.h:62
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
std::vector< CDouble1Vec > CDouble2Vec
Definition: AssocGraph.h:34
std::vector< double > CDouble1Vec
Definition: AssocGraph.h:33
std::vector< CDouble2Vec > CDoubleArray
Definition: AssocGraph.h:35