-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct stupid width and height calculation bug when deriving width a…
…nd height for tile render parameters. Refactor core logic into separate method to simplify testing. Add test to catch bug. This fixes #24.
- Loading branch information
Showing
2 changed files
with
123 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
render-ws/src/test/java/org/janelia/render/service/TileDataServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.janelia.render.service; | ||
|
||
import org.janelia.alignment.RenderParameters; | ||
import org.janelia.alignment.spec.TileSpec; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Tests the {@link TileDataService} class. | ||
* | ||
* @author Eric Trautman | ||
*/ | ||
public class TileDataServiceTest { | ||
|
||
@Test | ||
public void testGetCoreTileRenderParameters() throws Exception { | ||
|
||
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" + | ||
" \"width\" : 1024.0, \"height\" : 1024.0,\n" + | ||
" \"mipmapLevels\" : {\n" + | ||
" \"0\" : {\n" + | ||
" \"imageUrl\" : \"file:///data/nc-em/russelt/20170227_Princeton_Pinky40/4_aligned_tiled/1,3484_aligned_0_1_flip.png\"\n" + | ||
" }\n" + | ||
" },\n" + | ||
" \"transforms\" : {\n" + | ||
" \"type\" : \"list\",\n" + | ||
" \"specList\" : [ {\n" + | ||
" \"className\" : \"mpicbg.trakem2.transform.AffineModel2D\",\n" + | ||
" \"dataString\" : \"1.0000000000 0.0000000000 0.0000000000 1.0000000000 1896.0000000000 -876.0000000000\"\n" + | ||
" }, {\n" + | ||
" \"className\" : \"mpicbg.trakem2.transform.AffineModel2D\",\n" + | ||
" \"dataString\" : \"1.0000000000 0.0000000000 0.0000000000 1.0000000000 0.0000000000 1752.0000000000\"\n" + | ||
" } ]\n" + | ||
" }\n" + | ||
"}"; | ||
|
||
final TileSpec tileSpec = TileSpec.fromJson(json); | ||
|
||
final RenderParameters renderParameters = | ||
TileDataService.getCoreTileRenderParameters(null, null, null, null, tileSpec); | ||
|
||
Assert.assertEquals("invalid width for tile", 1024, renderParameters.getWidth()); | ||
Assert.assertEquals("invalid height for tile", 1024, renderParameters.getHeight()); | ||
} | ||
|
||
} |