Skip to content

Commit

Permalink
add testSfovStitchForSinglePixelGap to help debug issue in newexport …
Browse files Browse the repository at this point in the history
…branch
  • Loading branch information
trautmane committed Jan 17, 2025
1 parent 2c574ad commit c28048f
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.janelia.alignment;

import ij.ImagePlus;
import ij.process.ImageProcessor;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
* Tests the {@link ByteRenderer} class.
*/
public class ByteRendererTest {

private File outputFile;

@Before
public void setup() throws Exception {
final SimpleDateFormat TIMESTAMP = new SimpleDateFormat("yyyyMMddHHmmssSSS");
final String timestamp = TIMESTAMP.format(new Date());
outputFile = new File("test-render-" + timestamp +".jpg").getCanonicalFile();
}

@After
public void tearDown() {
ArgbRendererTest.deleteTestFile(outputFile);
}

@Test
public void testSfovStitchForSinglePixelGap() throws Exception {

final String[] args = {
"--tile_spec_url", "src/test/resources/stitch-test/sfov_stitch_test.json",
"--out", outputFile.getAbsolutePath(),
"--x", "40000",
"--y", "71800",
"--width", "200",
"--height", "1600",
"--scale", "1.0"
};

ByteRenderer.renderUsingCommandLineArguments(args);

Assert.assertTrue("stitched file " + outputFile.getAbsolutePath() + " not created", outputFile.exists());

final ImageProcessor renderedIp = new ImagePlus(outputFile.getAbsolutePath()).getProcessor();
for (int y = 0; y < renderedIp.getHeight(); y++) {
for (int x = 0; x < renderedIp.getWidth(); x++) {
final int pixel = renderedIp.get(x, y);
if (pixel == 0) {
Assert.fail("pixel at " + x + ", " + y + " is 0");
}
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions render-app/src/test/resources/stitch-test/sfov_stitch_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[
{
"tileId": "w60_magc0399_scan032_m0013_s032",
"layout": {
"sectionId": "27.0",
"imageRow": 52,
"imageCol": 39,
"stageX": -42969,
"stageY": 2421
},
"z": 27,
"minX": 39979,
"minY": 71722,
"maxX": 41986,
"maxY": 73475,
"width": 2000,
"height": 1748,
"minIntensity": 0,
"maxIntensity": 255,
"mipmapLevels": {
"0": {
"imageUrl": "src/test/resources/stitch-test/sfov_032.png"
}
},
"filterSpec": {
"className": "org.janelia.alignment.filter.LinearIntensityMap8BitFilter",
"parameters": {
"dataString": "4,4,2,1.0284811399868938,0.029346107192258688,1.023003296603754,0.03663639362344909,1.021907788146802,0.035048851639186474,1.0210199400422122,0.033760535759358404,1.0227874482594197,0.030373077221192632,1.020569279288468,0.0321604087923233,1.019676226282893,0.03169955537725808,1.019472606147438,0.03089711622703571,1.0189979930060649,0.03186246441106026,1.0184807047583027,0.03081228102412721,1.0183532599256808,0.02957112029919836,1.0186777068434212,0.0284266306612502,1.0178016865306736,0.032106451841777184,1.0175032194716653,0.03052295248290758,1.0180689838914496,0.02816628876464062,1.0191685881477346,0.025875590667384953"
}
},
"transforms": {
"type": "list",
"specList": [
{
"type": "leaf",
"className": "org.janelia.alignment.transform.ExponentialFunctionOffsetTransform",
"dataString": "3.164065083689898,0.010223592506552219,0.0,0"
},
{
"type": "leaf",
"className": "mpicbg.trakem2.transform.AffineModel2D",
"dataString": "1.0009509051913514 -5.040850755104299E-4 -9.192991608458097E-4 1.001892938678442 39984.329672107226 71723.0368157889"
}
]
},
"meshCellSize": 64
},
{
"tileId": "w60_magc0399_scan032_m0013_s053",
"layout": {
"sectionId": "27.0",
"imageRow": 52,
"imageCol": 37,
"stageX": -44844,
"stageY": 2418
},
"z": 27,
"minX": 38082,
"minY": 71720,
"maxX": 40090,
"maxY": 73474,
"width": 2000,
"height": 1748,
"minIntensity": 0,
"maxIntensity": 255,
"mipmapLevels": {
"0": {
"imageUrl": "src/test/resources/stitch-test/sfov_053.png"
}
},
"filterSpec": {
"className": "org.janelia.alignment.filter.LinearIntensityMap8BitFilter",
"parameters": {
"dataString": "4,4,2,0.9868704254148127,-0.006959740351722811,0.986046315474171,-0.006405214344341661,0.9851386650740306,-0.007073839421573837,0.9824143338915927,-0.006534357478219284,0.9862019889097078,-0.005924635026674959,0.9859732550832011,-0.006308722814153114,0.9853973791971904,-0.007206494286178981,0.9840303154293883,-0.007510954163011714,0.9852805441771888,-0.0050535654033397985,0.9851081377971626,-0.005667214597788405,0.9852613117950361,-0.007925649969195534,0.9849821985494925,-0.010197616684699182,0.9827460902276816,-0.0015559823323283563,0.9827079796380237,-0.003306014025519244,0.9843605113515159,-0.00865074372417586,0.9845488420496232,-0.012406446695880695"
}
},
"transforms": {
"type": "list",
"specList": [
{
"type": "leaf",
"className": "org.janelia.alignment.transform.ExponentialFunctionOffsetTransform",
"dataString": "3.164065083689898,0.010223592506552219,0.0,0"
},
{
"type": "leaf",
"className": "mpicbg.trakem2.transform.AffineModel2D",
"dataString": "1.0014295214519409 -3.05675382552633E-4 -9.223349366686741E-4 1.0027697487274574 38087.33559327713 71721.56802309508"
}
]
},
"meshCellSize": 64
}
]

0 comments on commit c28048f

Please sign in to comment.