Skip to content

Commit

Permalink
Forrest's tile spec example in #24 just had bad bounding box data. I …
Browse files Browse the repository at this point in the history
…misunderstood the true problem and made a hacky incorrect "fix". The sloppy bounding box derivation introduced by Saalfeld in ec46251 corrects Forrest's specific case but sloppy=false derivation still exposes the original problem.  This change removes my prior hack which was just wrong.  We still need to investigate the sloppy=false issue.
  • Loading branch information
trautmane committed Nov 21, 2019
1 parent 69692f7 commit 6aee2f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,14 @@ static RenderParameters getCoreTileRenderParameters(final Integer width,

final int tileRenderWidth;
if (width == null) {
tileRenderWidth = (int) (tileSpec.getMaxX() - tileSpec.getMinX() + 1);
tileRenderWidth = (int) (tileSpec.getMaxX() - tileSpec.getMinX());
} else {
tileRenderWidth = width;
}

final int tileRenderHeight;
if (height == null) {
tileRenderHeight = (int) (tileSpec.getMaxY() - tileSpec.getMinY() + 1);
tileRenderHeight = (int) (tileSpec.getMaxY() - tileSpec.getMinY());
} else {
tileRenderHeight = height;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
public class TileDataServiceTest {

@Test
public void testGetCoreTileRenderParameters() throws Exception {
public void testGetCoreTileRenderParameters() {

// from https://github.com/saalfeldlab/render/issues/24
final String json =
"{\n" +
" \"tileId\" : \"1,3484_aligned_0_1_flip\",\n" +
" \"z\" : 3484.0, \"minX\" : 1896.0, \"minY\" : 876.0, \"maxX\" : 2919.0, \"maxY\" : 1899.0,\n" +
" \"z\" : 3484.0,\n" +
" \"width\" : 1024.0, \"height\" : 1024.0,\n" +
" \"mipmapLevels\" : {\n" +
" \"0\" : {\n" +
Expand All @@ -42,6 +43,10 @@ public void testGetCoreTileRenderParameters() throws Exception {
"}";

TileSpec tileSpec = TileSpec.fromJson(json);

final boolean force = true;
final boolean sloppy = true; // TODO: fix 1-pixel clipped bounding box when sloppy = false
tileSpec.deriveBoundingBox(tileSpec.getMeshCellSize(), force, sloppy);

RenderParameters renderParameters =
TileDataService.getCoreTileRenderParameters(null, null, null,
Expand Down

0 comments on commit 6aee2f7

Please sign in to comment.