private void executeIteration(int[] rgb, Mask mask, int width, int height) {
		int[][] offsets = { { -1, -1 }, { 0, -1 }, { 1, -1 }, { -1, 0 }, { 1, 0 }, { -1, 1 }, { 0, 1 }, { 1, 1 } };

		MaskIterator iterator = mask.iterator();
		while (iterator.hasNext()) {
			int pixelIndex = iterator.next();

			int x = pixelIndex % width;
			int y = pixelIndex / width;

			int r = 0;
			int g = 0;
			int b = 0;
			int cant = 0;

			for (int i = 0; i < offsets.length; i++) {
				int[] offset = offsets[i];
				int column = x + offset[0];
				int row = y + offset[1];

				if (column < 0 || column >= width || row < 0 || row >= height)
					continue;

				int currentPixelIndes = getPixelIndex(width, column, row);
				// System.out.println("" + column + "," + row);
				int pixelData = rgb[currentPixelIndes];
				simpleColor.setRGB(pixelData);
				if (mask.getMask(currentPixelIndes) == REALDATA) {
					r += simpleColor.getRed();
					g += simpleColor.getGreen();
					b += simpleColor.getBlue();
					cant++;
				}
			}

			if (cant != 0) {
				simpleColor.setRGB(r / cant, g / cant, b / cant, 0);
				rgb[pixelIndex] = simpleColor.getRGB();
				iterator.markAsInProgress();
			}
		}

		iterator.reset();
	}