private static int[] getNeighbours(ImageData imageData, int mx, int my, int y, int x) {
		int x0 = x - 1;
		int y0 = y - 1;
		int x2 = x + 1;
		int y2 = y + 1;
		x0 = x0 < 0 ? 0 : x0;
		x2 = x2 > mx ? mx : x2;
		y0 = y0 < 0 ? 0 : y0;
		y2 = y2 > my ? my : y2;
		int[] pixels = new int[9];
		pixels[0] = imageData.getPixel(x0, y0);
		pixels[1] = imageData.getPixel(x, y0);
		pixels[2] = imageData.getPixel(x2, y0);

		pixels[3] = imageData.getPixel(x0, y);
		pixels[4] = imageData.getPixel(x, y);
		pixels[5] = imageData.getPixel(x2, y);

		pixels[6] = imageData.getPixel(x0, y2);
		pixels[7] = imageData.getPixel(x, y2);
		pixels[8] = imageData.getPixel(x0, y2);
		return pixels;
	}