示例#1
0
	vector<SubMatrix> matrix3DFinder(int*** matrix, int sizeX,int sizeY, int sizeZ, int ignValue, int radius)
	{
		VectorQueue vctQ,tmpQ;
		SubMatrix sb;
		int xMax,yMax,zMax,xMin,yMin,zMin;
		vector<SubMatrix> subMatrixVect;
		int i,j,k;
		i=j=k=0;
		int subSizeX;
		int subSizeY;
		int subSizeZ;
		while (k<sizeZ)
		{
			while(i<sizeY)
			{
				while(j<sizeX)
				{
					if((matrix[j][i][k]!= ignValue) && (matrix[j][i][k]>0))
					{
						while(!vctQ.isEmpty())
							vctQ.pop();
						vctQ.push(j,i,k);

						matrix[j][i][k]-=2*matrix[j][i][k];
						tmpQ=neighbour3D(matrix,ignValue, radius,vctQ);
						xMax=sb.getMax(tmpQ.x);
						yMax=sb.getMax(tmpQ.y);
						zMax=sb.getMax(tmpQ.z);
						xMin=sb.getMin(tmpQ.x);
						yMin=sb.getMin(tmpQ.y);
						zMin=sb.getMin(tmpQ.z);
						sb.xPos=xMin;
						sb.yPos=yMin;
						sb.zPos=zMin;
						subSizeX=xMax-xMin+1+2*radius;
						subSizeY=yMax-yMin+1+2*radius;
						subSizeZ=zMax-zMin+1+2*radius;
						sb.size=subSizeX*subSizeY*subSizeZ;
						sb.xSize=subSizeX;
						sb.ySize=subSizeY;
						sb.zSize=subSizeZ;
						sb.subMatrixCreation3D(matrix,subSizeX,subSizeY,subSizeZ,xMin,yMin,zMin,tmpQ,ignValue,radius);
						subMatrixVect.push_back(sb);
					}
					++j;
				}
				j=0;
				++i;
			}
			i=0;
			k++;
		}
		return subMatrixVect;
	}
示例#2
0
	BorderMatrix matrix2DFinder(int** matrix, int sizeX,int sizeY, int ignValue, int radius)
	{
		BorderMatrix bm;
		VectorQueue vctQ,tmpQ;
		SubMatrix sb;
		sb.radius=radius;
		int xMax,yMax,xMin,yMin;
		vector<SubMatrix> subMatrixVect;
		int i,j,k;
		i=j=k=0;
		while(i<sizeY)
		{
			while(j<sizeX)
			{
				if((matrix[j][i]!= ignValue) && (matrix[j][i]>0))
				{
					while(!vctQ.isEmpty())
						vctQ.pop();
					vctQ.push(j,i,0);

					matrix[j][i]-=2*matrix[j][i];
					tmpQ=neighbour2D(matrix,ignValue, radius,vctQ, sizeX,sizeY);
					xMax=sb.getMax(tmpQ.x);
					yMax=sb.getMax(tmpQ.y);
					xMin=sb.getMin(tmpQ.x);
					yMin=sb.getMin(tmpQ.y);
					bm.push(xMax,xMin,yMax,yMin,0,0);	
					k++;
				}
				++j;
			}
			j=0;
			++i;
		}
		BorderMatrix tmp;
		for(int l=0;l<k;l++)
		{
			tmp.push(bm.xMax.front(),bm.xMin.front(),bm.yMax.front(),bm.yMin.front(),0,0);
			matrixAbs2D(matrix,bm.xMax.front(),bm.xMin.front(),bm.yMax.front(),bm.yMin.front(), 2*radius);
			bm.pop();

		}
		return tmp;
	}