private void interpretTile(BufferedImage bi, byte bytes[], int startX,
int startY) throws ImageReadException, IOException
{
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
BitInputStream bis = new BitInputStream(bais);
int pixelsPerTile = tileWidth * tileLength;
int tileX = 0, tileY = 0;
for (int i = 0; i < pixelsPerTile; i++)
{
int x = tileX + startX;
int y = tileY + startY;
int samples[] = getSamplesAsBytes(bis);
if ((x < width) && (y < height))
{
samples = applyPredictor(samples, x);
photometricInterpreter.interpretPixel(bi, samples, x, y);
}
tileX++;
if (tileX >= tileWidth)
{
tileX = 0;
tileY++;
bis.flushCache();
if (tileY >= tileLength)
break;
}
}