Beispiel #1
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Set up the dialog box to reflect the appropriate processing function
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//! \brief set up the dialog box to reflect the appropriate processing function
//! \param[in] f	enum that indicates which operation to perform
//! \param[in] img	target image
void IPDialog::setup(IP_Function f, QImage img)
{
	m_retProcImg		= img;											// original unscaled copy; used when user is satisfied
	m_origImg			= img.scaled(128, 128,  Qt::KeepAspectRatio);	// for display purpose; show original
	m_resultImg			= img.scaled(128, 128,  Qt::KeepAspectRatio);	// for display purpose; show result
	m_currentFuct		= f;											// current processing function

	clearOptLay						();									// clear IP options layout
	m_dispResult		->setChecked(true);

	switch(m_currentFuct)
	{
		case COLOR:
			m_boxOpt->setTitle(tr("Color"));
			setupColor();												// set up layout
			m_ip	->processImg(IP::Red, m_resultImg);					// default is red
			break;
		case THRESHOLD:
			m_boxOpt->setTitle(tr("Threshold"));
			setupThres();
			m_ip	->lookUpTable(128);									// default threshold level is 128
			m_ip	->processImg(IP::IndThres, m_resultImg);			// default is threshold individual band
			break;
		case EDGE:
			m_boxOpt->setTitle(tr("Edge detection"));
			setupEdge();
			m_ip	->prewittMask(m_resultImg, m_origImg, 128);			// default is prewitt mask with threshold level = 128
			break;
		default:
			break;
	}
	m_ipDisplay		->storeImage(tr("Result"), m_resultImg);			// display the result
}
Beispiel #2
0
void createGraph5(Graph* g)
{
	int i, j;
	srand(9875);

	g->numVertices = 20;
	setupVertices(g);

	g->numEdges = 400;
	for(i = 0; i < g->numVertices; ++i)
		for(j = i + 1; j < g->numVertices; ++j)
			setupEdge(g, &g->vertexSet[i], &g->vertexSet[j]);
}
Beispiel #3
0
bool DlSatTester :: applyReflexiveRoles ( DlCompletionTree* node, const DepSet& dep )
{
	for ( TRole::const_iterator p = ReflexiveRoles.begin(), p_end = ReflexiveRoles.end(); p != p_end; ++p )
	{
		// create R-loop through the NODE
		DlCompletionTreeArc* pA = CGraph.addRoleLabel ( node, node, /*isPredEdge=*/false, *p, dep );
		if ( setupEdge ( pA, dep, 0 ) )
			return true;
	}

	// no clash found
	return false;
}
Beispiel #4
0
void createGraph1(Graph* g)
{
	Vertex* firstVert;
	Vertex* secondVert;
	int i;
	srand(3);

	g->numVertices = 3;
	setupVertices(g);

	g->numEdges = 3;
	for(i = 0; i < g->numEdges; ++i)
	{
		firstVert = &g->vertexSet[i];
		secondVert = &g->vertexSet[(i+1) % g->numVertices];
		setupEdge(g, firstVert, secondVert);
	}
}
Beispiel #5
0
bool
NominalReasoner :: initRelatedNominals ( const TRelated* rel )
{
	DlCompletionTree* from = resolveSynonym(rel->a)->node;
	DlCompletionTree* to = resolveSynonym(rel->b)->node;
	TRole* R = resolveSynonym(rel->R);
	DepSet dep;	// empty dep-set

	// check if merging will lead to clash because of disjoint roles
	if ( R->isDisjoint() && checkDisjointRoleClash ( from, to, R, dep ) )
		return true;

	// create new edge between FROM and TO
	DlCompletionTreeArc* pA =
		CGraph.addRoleLabel ( from, to, /*isPredEdge=*/false, R, dep );

	// return OK iff setup new enge didn't lead to clash
	// do NOT need to re-check anything: nothing was processed yet
	return setupEdge ( pA, dep, 0 );
}
Beispiel #6
0
void createGraph4(Graph* g)
{
	Vertex* firstVert;
	Vertex* secondVert;
	int i;
	srand(9875);

	g->numVertices = 26;
	setupVertices(g);

	g->numEdges = 100;
	for(i = 0; i < g->numEdges; ++i)
	{
		firstVert = &g->vertexSet[rand() % g->numVertices];
		secondVert = firstVert;
		while(firstVert == secondVert || isAdjacent(firstVert, secondVert))
			secondVert = &g->vertexSet[rand() % g->numVertices];

		setupEdge(g, firstVert, secondVert);
	}
}