Exemple #1
0
int momentThresholdingAtPoint(intVectorType point ,densityDataType *sourceData, densityDataType *targetData, float structuresignal, float absMin, float deltaEpsilon, float absMax,int scanningRange)
{
float datum=ACCESSDATAATPOINT((*sourceData), point.x, point.y);  
	if(datum<absMin) 
	{
	ACCESSDATAATPOINT((*targetData), point.x, point.y)=0.0;
	return 0;
	}

	if(datum>absMax) 
	{
	ACCESSDATAATPOINT((*targetData), point.x, point.y)=1.0;
	return 0;
	}
	float alpha, structure;
	momentOfInertiaType Inertia; 
	evaluateDirectionAndStructure(&alpha, &structure, &Inertia, *sourceData, point, 4);
	
	float massAroundPoint=calculateMassArroundPoint(*sourceData,  point, scanningRange);
	float volume=(scanningRange-1)*(scanningRange-1);
	float meanSignal=massAroundPoint/volume;


	
	if (structure>structuresignal && (datum)>(meanSignal+deltaEpsilon))
	{
	ACCESSDATAATPOINT((*targetData), point.x, point.y)=structure;
	return 0;

	}
	
	ACCESSDATAATPOINT((*targetData), point.x, point.y)=0.0;
	return 0;

}
Exemple #2
0
int calcDiffusionTensorAtPoint(floatMatrixType *Tensor, int x, int y, densityDataType *densityData, int scanningRange)
{
/*
	//Diagonal
	//Debug 
	(*Tensor).a11=0.0; 		(*Tensor).a12=1.0; 
	(*Tensor).a21=1.0;		(*Tensor).a22=0.0;
	return 0;
*/

	intVectorType point;
	point.x=x;
	point.y=y; 
	momentOfInertiaType Inertia;
	floatMatrixType BT, B, Diag, Help;//, Diffusion;
	float a, structure;
	evaluateDirectionAndStructure(&a, &structure ,&Inertia, *densityData, point, scanningRange);
	
	//BTransposed
	float magV1=FLOATVECNORM((Inertia).v1)+EPS;
	float magV2=FLOATVECNORM((Inertia).v2)+EPS;
	
	BT.a11=(Inertia).v1.x/magV1; BT.a12=(Inertia).v1.y/magV1; 
	BT.a21=(Inertia).v2.x/magV2; BT.a22=(Inertia).v2.y/magV2; 
	
	//Diagonal 
	Diag.a11=1.0; 		Diag.a12=0.0; 
	Diag.a21=0.0;		Diag.a22=EPS; 
	
	//B
	B.a11=BT.a11; B.a12=BT.a21; 
	B.a21=BT.a12; B.a22=BT.a22; 
		
	//Create Diffusion Matrix
	MultiplyMatrix(&Help, &Diag, &BT); 
	MultiplyMatrix(Tensor, &B, &Help); 
	return 0;
}