BipartiteMatcher

Implements bipartite matching using LEDA. Given a model, a target, edges of possible matches, and a transformation, it will find the best bipartite match. NOTE: HausdorffExtension proves faster and better then BipartiteMatcher.

[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

AUTHORS
CHANGES LOG
GOALS
USAGE
END

Class Summary

class BipartiteMatcher

{
public:
BipartiteMatcher(unsigned int m, unsigned int n) ;
void addEdge(unsigned int ai, unsigned int bj);
template<class MatchT> void calculateMatch(MatchT& match);
void update();
protected:
BipartiteGraph bipartiteGraph_;
::list< leda::node> setA_, setB_;
vector< leda::node> id2nodeSetA_, id2nodeSetB_;
unsigned int sizeA_, sizeB_;
::list< leda::edge> matchEdges_;
bool isMatchUpdated_;
}; // BipartiteMatcher

Back to the top of BipartiteMatcher


AUTHORS

Ofer Chay (oferchay@yahoo.com). Copyright: Structural Bioinfo group, Tel-Aviv Univ. Israel, 2009.

Back to the top of BipartiteMatcher


CHANGES LOG

Back to the top of BipartiteMatcher


GOALS

Implements bipartite matching using LEDA. Given a model, a target, edges of possible matches, and a transformation, it will find the best bipartitem match.

Back to the top of BipartiteMatcher


USAGE

here are 2 usage examples taken from the TriangleMatch program:

 void TriangleMatch::BipartiteMatchExtension(	const float 			maxAtomDistance,
												const RigidTrans3& 		rigidTrans3,
												Match& 					newMatch)
{
	const register  float maxAtomDistanceSquare = maxAtomDistance*maxAtomDistance;
	BipartiteMatcher bpm(m_sizeModel,m_sizeTarget);
	
	// copy and transform the scene
	Molecule<Atom> transformedScene = m_molTarget;  
	transformedScene.rigidTrans(rigidTrans3);
	
	for(register unsigned int i = 0 ; i < m_sizeModel ; i++)
		for(register unsigned int j = 0 ; j <  transformedScene.size(); j++)
		{
			if (m_molModel[i].dist2(transformedScene[j]) < maxAtomDistanceSquare)
				bpm.addEdge(i,j);
		}

	bpm.update();
	bpm.calculateMatch(newMatch);

	if (newMatch.size() == 0)
	{
		//cout << "BipartiteMatchExtension: Match.size(): == 0; break"<< endl;
		return;
	}
		
	// Implementation Note: Calculating the best fit is necessary for setting the rigid transformation and the rmsd of the match
	newMatch.calculateBestFit(m_molModel,m_molTarget);//newMatch.calculateBestFit(*model, *scene);
#ifdef dbgConsistency
  CheckConsistencyOfMatch(newMatch);
#endif
} 

void TriangleMatch::BipartiteMatchOneVoteList(	const TVectVotes& vVotes ,const RigidTrans3& rigidTrans3,Match& newMatch)
{
	BipartiteMatcher bpm(m_sizeModel,m_sizeTarget);
	
	// copy and transform the scene
	Molecule<Atom> transformedScene = m_molTarget;  
	transformedScene.rigidTrans(rigidTrans3);
	
	TVectVotes::const_iterator it, itend = vVotes.end();
	for(it = vVotes.begin(); it != itend ; it++)
		bpm.addEdge((*it).iModel,(*it).iTarget);

	bpm.update();
	bpm.calculateMatch(newMatch);

	if (newMatch.size() == 0)
		return;
		
	// Implementation Note: Calculating the best fit is necessary for setting the rigid transformation and the rmsd of the match
	newMatch.calculateBestFit(m_molModel,m_molTarget);//newMatch.calculateBestFit(*model, *scene);		
#ifdef dbgConsistency
  CheckConsistencyOfMatch(newMatch);
#endif	
}

Back to the top of BipartiteMatcher

Back to the top of BipartiteMatcher


END

Back to the top of BipartiteMatcher


BipartiteMatcher(unsigned int m, unsigned int n) ;

m,n are the sizes of each set

	BipartiteMatcher(unsigned int m, unsigned int n) ;

Function is currently defined inline.


Back to the top of BipartiteMatcher


void addEdge(unsigned int ai, unsigned int bj);

	inline void addEdge(unsigned int ai, unsigned int bj);

Function is currently defined inline.


Back to the top of BipartiteMatcher


template<class MatchT> void calculateMatch(MatchT& match);

	template<class MatchT> 
	inline void calculateMatch(MatchT& match);

Function is currently defined inline.


Back to the top of BipartiteMatcher


void update();

	inline void update();

Function is currently defined inline.


Back to the top of BipartiteMatcher


BipartiteGraph bipartiteGraph_;

  BipartiteGraph			bipartiteGraph_;

Back to the top of BipartiteMatcher


::list< leda::node> setA_, setB_;

  leda::list< leda::node>	setA_, setB_;

Back to the top of BipartiteMatcher


vector< leda::node> id2nodeSetA_, id2nodeSetB_;

  vector< leda::node>		id2nodeSetA_, id2nodeSetB_;

Back to the top of BipartiteMatcher


unsigned int sizeA_, sizeB_;

  unsigned int				sizeA_, sizeB_;

Back to the top of BipartiteMatcher


::list< leda::edge> matchEdges_;

  leda::list< leda::edge>	matchEdges_;

Back to the top of BipartiteMatcher


bool isMatchUpdated_;

  bool 						isMatchUpdated_;

Back to the top of BipartiteMatcher


All Members

public:
void addEdge(unsigned int ai, unsigned int bj);
template<class MatchT> void calculateMatch(MatchT& match);
void update();
protected:
BipartiteGraph bipartiteGraph_;
::list< leda::node> setA_, setB_;
vector< leda::node> id2nodeSetA_, id2nodeSetB_;
unsigned int sizeA_, sizeB_;
::list< leda::edge> matchEdges_;
bool isMatchUpdated_;

Back to the top of BipartiteMatcher


Ancestors

Class does not inherit from any other class.

Back to the top of BipartiteMatcher


Descendants

Class is not inherited by any others.

Back to the top of BipartiteMatcher


Generated from source by the Cocoon utilities on Sun Nov 15 13:35:25 2009 .

Report problems to jkotula@unimax.com