Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.janelia.alignment;

import ij.process.ImageProcessor;

import mpicbg.trakem2.transform.TransformMeshMappingWithMasks;

import org.janelia.alignment.util.ImageProcessorCache;
import org.junit.Assert;
import org.junit.Test;

import static org.janelia.alignment.Renderer.renderImageProcessorWithMasks;

/**
* Tests the {@link RenderTransformMeshMappingWithMasks} class.
*/
public class RenderTransformMeshMappingWithMasksTest {

@Test
public void testMap() {
// TODO: uncomment below to run test
// renderProblemArea();

// one way to "solve" problem is to revert RenderTransformMeshMappingWithMasks to commit just before
// Tobias' December 2024 / January 2025 changes: 25bcdd4cecac5baace30997d950793c82a65e832
}

@SuppressWarnings("unused")
private static void renderProblemArea() {

// notes:
// a) w61_s109_z12_problem_a.json has the tile order flipped in descending tileId order
// because I noticed a black line when I was working on something else.
// I don't think the descending order has anything to do with the source problem,
// other than where it shows up.
// b) repo path is render-app/src/test/resources/stitch-test/w61_s109_z12_problem_a.json

final RenderParameters renderParameters =
RenderParameters.loadFromUrl("src/test/resources/stitch-test/w61_s109_z12_problem_a.json");

final TransformMeshMappingWithMasks.ImageProcessorWithMasks worldTarget =
renderImageProcessorWithMasks(renderParameters, ImageProcessorCache.DISABLED_CACHE);
final ImageProcessor ip = worldTarget.ip;

boolean foundZeroPixel = false;
for (int y = 0; y < ip.getHeight(); y++) {
for (int x = 0; x < ip.getWidth(); x++) {
final int pixel = ip.getPixel(x, y);
if (pixel == 0) {
foundZeroPixel = true;
}
System.out.printf("%4d", pixel);
}
System.out.println();
}

if (foundZeroPixel) {
// TODO: uncomment below and break on Assert.fail call to see pixels in IDE
// final BufferedImage bi = ip.getBufferedImage();
Assert.fail("found zero pixel in rendered image");
}

}
}
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.
102 changes: 102 additions & 0 deletions render-app/src/test/resources/stitch-test/w61_s109_z12_problem_a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"meshCellSize": 64,
"minMeshCellSize": 0,
"x": 48200,
"y": 59300,
"width": 4,
"height": 5,
"scale": 1,
"areaOffset": false,
"convertToGray": false,
"quality": 0.85,
"numberOfThreads": 1,
"skipInterpolation": false,
"binaryMask": false,
"excludeMask": false,
"doFilter": false,
"addWarpFieldDebugOverlay": false,
"fillWithNoise": false,
"tileSpecs": [
{
"tileId": "w61_magc0145_scan015_m0015_r14_s74",
"layout": {
"sectionId": "12.0",
"imageRow": 51,
"imageCol": 51,
"stageX": -36545.27105209528,
"stageY": -13410.214592926066
},
"z": 12,
"minX": 48103,
"minY": 58051,
"maxX": 50107,
"maxY": 59799,
"width": 2000,
"height": 1748,
"minIntensity": 0,
"maxIntensity": 255,
"mipmapLevels": {
"0": {
"imageUrl": "src/test/resources/stitch-test/w61_s109_z12_m0015_sfov_074.png"
}
},
"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.0 0.0 0.0 1.0 48106.65601272403 58051.74176269165"
}
]
},
"meshCellSize": 64
},
{
"tileId": "w61_magc0145_scan015_m0009_r70_s90",
"layout": {
"sectionId": "12.0",
"imageRow": 50,
"imageCol": 50,
"stageX": -36840.73885339055,
"stageY": -14313.184546360093
},
"z": 12,
"minX": 47842,
"minY": 57554,
"maxX": 49846,
"maxY": 59302,
"width": 2000,
"height": 1748,
"minIntensity": 0,
"maxIntensity": 255,
"mipmapLevels": {
"0": {
"imageUrl": "src/test/resources/stitch-test/w61_s109_z12_m0009_sfov_090.png"
}
},
"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.0 0.0 0.0 1.0 47845.959522659396 57554.743480678524"
}
]
},
"meshCellSize": 64
}
],
"minBoundsMeshCellSize": 64
}