Beispiel #1
0
	VectorQueue neighbour2D(int** matrix,int ignValue, int radius, VectorQueue vctQ,int sizeX, int sizeY)
	{
		int xLimitSup,xLimitInf,yLimitSup,yLimitInf;
		VectorQueue tmpQ;
		tmpQ.push(vctQ.x.front(),vctQ.y.front(),0);
		while(!vctQ.isEmpty())
		{
			xLimitSup=vctQ.x.front()+2*radius+1;
			xLimitInf= vctQ.x.front()-2*radius-1;
			if(xLimitInf<1)xLimitInf=1;
			if (xLimitSup>=sizeX-1) xLimitSup=sizeX-1;
			for(int i=xLimitInf;i<=xLimitSup;i++)
			{
				yLimitSup=vctQ.y.front()+2*radius+1;
				yLimitInf= vctQ.y.front()-2*radius-1;
				if(yLimitInf<1) yLimitInf=1;
				yLimitSup=vctQ.y.front()+2*radius;
				if (yLimitSup>=sizeY-1) yLimitSup=sizeY-1;
				for(int j=yLimitInf;j<=yLimitSup;j++)
				{
					if((matrix[i][j]!=ignValue)&&(matrix[i][j]>0))
					{
						vctQ.push(i,j,0);
						tmpQ.push(i,j,0);
						matrix[i][j]-=2*matrix[i][j];
					}
				}
			}
			vctQ.pop();
		}

		return tmpQ;
	}
Beispiel #2
0
	void SubMatrix::subMatrixCreation2D(int** mtr,int xMin,int yMin,VectorQueue point,int ignValue)
	{

		int** sMatrix=new int* [xSize];
		for(int i=0;i<xSize;i++)
		{
			sMatrix[i]=new int[ySize];
			for(int j=0;j<ySize;j++)
				sMatrix[i][j]=ignValue;
		}
		while(!point.isEmpty())
		{
			sMatrix[point.x.front()-xPos+2*radius][point.y.front()-yPos+2*radius]=mtr[point.x.front()][point.y.front()];
			point.pop();
		}
		matrix2D=sMatrix;
		matrixAbs2D();
	}
Beispiel #3
0
	void SubMatrix::subMatrixCreation3D(int*** mtr,int sizeX,int sizeY,int sizeZ,int xMin,int yMin, int zMin,VectorQueue point,int ignValue, int radius)
	{

		int*** sMatrix=new int**[sizeX];
		for(int i=0;i<sizeX;i++)
		{
			sMatrix[i]=new int*[sizeY];
			for(int j=0;j<sizeY;j++)
			{
				sMatrix[i][j]=new int[sizeZ];
				for(int k=0;k<sizeZ;k++)
					sMatrix[i][j][k]=ignValue;
			}
		}
		while(!point.isEmpty())
		{
			sMatrix[point.x.front()-xMin+radius][point.y.front()-yMin+radius][point.z.front()-zMin+radius]=mtr[point.x.front()][point.y.front()][point.z.front()];
			point.pop();
		}
		matrix3D=sMatrix;
		matrixAbs3D();
	}
Beispiel #4
0
	VectorQueue neighbour3D(int*** matrix,int ignValue, int radius, VectorQueue vctQ)
	{
		VectorQueue tmpQ;
		tmpQ.push(vctQ.x.front(),vctQ.y.front(),vctQ.z.front());
		while(!vctQ.isEmpty())
		{
			for(int k=vctQ.z.front()-radius;k<=vctQ.z.front()+radius;k++)
			{
				for(int i=vctQ.y.front()-radius;i<=vctQ.y.front()+radius;i++)
				{
					for(int j=vctQ.x.front()-radius;j<=vctQ.x.front()+radius;j++)
						if((matrix[j][i][k]!=ignValue)&&(matrix[j][i][k]>0))
						{
							vctQ.push(j,i,k);
							tmpQ.push(j,i,k);
							matrix[j][i][k]-=2*matrix[j][i][k];
						}
				}
			}
			vctQ.pop();
		}

		return tmpQ;
	}