private void getPatternCross3x3(int x, int y, double neigh[]) {
	 	if (x >= 1)
	 	if (y >= 1)
	 	if (x < nx-1)
	 	if (y < ny-1) { 
			int index = (y-1)*nx + x;
			neigh[0] = pixels[index];
			index += (nx - 1);
			neigh[1] = pixels[index++];
			neigh[2] = pixels[index++];
			neigh[3] = pixels[index];
			index += (nx - 1);
			neigh[4] = pixels[index];
			return;
		}
		int x1 = x - 1;
		int x2 = x;
		int x3 = x + 1;
		int y1 = y - 1;
		int y2 = y;
		int y3 = y + 1;
		if ( x == 0)
			x1 = x3;
		if ( y == 0)
			y1 = y3;
		if ( x == nx-1)
			x3 = x1;
		if ( y == ny-1)
			y3 = y1;
	 	int offset = y1*nx;
		neigh[0] = pixels[offset+x2];
	 	offset = y2*nx;
		neigh[1] = pixels[offset+x1];
		neigh[2] = pixels[offset+x2];
		neigh[3] = pixels[offset+x3];
	 	offset = y3*nx;
		neigh[4] = pixels[offset+x2];
	}