Skip to content

Commit

Permalink
Adjust tile coordinates to account for overlap
Browse files Browse the repository at this point in the history
Closes #6616.
  • Loading branch information
melissalinkert committed Dec 28, 2011
1 parent 7297b83 commit 184f604
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/scifio/src/loci/formats/tiff/TiffParser.java
Expand Up @@ -799,11 +799,11 @@ public byte[] getSamples(IFD ifd, byte[] buf, int x, int y,

for (int row=0; row<numTileRows; row++) {
for (int col=0; col<numTileCols; col++) {
tileBounds.x = col * (int) (tileWidth);
tileBounds.y = row * (int) (tileLength);
tileBounds.x = col * (int) (tileWidth - overlapX);
tileBounds.y = row * (int) (tileLength - overlapY);

if (planarConfig == 2) {
tileBounds.y = (int) ((row % nrows) * tileLength);
tileBounds.y = (int) ((row % nrows) * (tileLength - overlapY));
}

if (!imageBounds.intersects(tileBounds)) continue;
Expand All @@ -823,8 +823,8 @@ public byte[] getSamples(IFD ifd, byte[] buf, int x, int y,

int tileX = (int) Math.max(tileBounds.x, x);
int tileY = (int) Math.max(tileBounds.y, y);
int realX = tileX % (int) tileWidth;
int realY = tileY % (int) tileLength;
int realX = tileX % (int) (tileWidth - overlapX);
int realY = tileY % (int) (tileLength - overlapY);

int twidth = (int) Math.min(endX - tileX, tileWidth - realX);
int theight = (int) Math.min(endY - tileY, tileLength - realY);
Expand Down

0 comments on commit 184f604

Please sign in to comment.