@Test public final void testExtendedMaxima_CubeGraph_C6() { // load the reference image, and get its size ImageStack image = createLeveledCubeGraphImage(); int sizeX = image.getWidth(); int sizeY = image.getHeight(); int sizeZ = image.getSize(); // create test image: add a band with value 127 in the middle int zMid = sizeZ / 2; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { double val = image.getVoxel(x, y, zMid); if (val == 255) image.setVoxel(x, y, zMid, 127); } } ImageStack maxima = MinimaAndMaxima3D.extendedMaxima(image, 10, 6); for (int z = 0; z < sizeZ; z++) { for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int v0 = (int) image.getVoxel(x, y, z); int v = (int) maxima.getVoxel(x, y, z); if (v0 == 255) assertEquals(255, v); else assertEquals(0, v); } } } }