|
21 | 21 | import com.github.celldynamics.quimp.plugin.qanalysis.STmap;
|
22 | 22 | import com.github.celldynamics.quimp.utils.QuimPArrayUtils;
|
23 | 23 |
|
| 24 | +import ij.ImagePlus; |
24 | 25 | import ij.process.FloatProcessor;
|
25 | 26 | import ij.process.ImageProcessor;
|
26 | 27 |
|
@@ -104,20 +105,24 @@ public void tearDown() throws Exception {
|
104 | 105 | */
|
105 | 106 | @Test
|
106 | 107 | public void testMaximaFinder() throws Exception {
|
107 |
| - int[] expectedX = { 160, 110, 134, 266, 40, 359, 79, 236, 288, 273, 212, 127, 73, 8, 331, 70, |
108 |
| - 270, 147, 368, 13 }; |
| 108 | + int[] expectedX = { 8, 13, 40, 70, 73, 79, 110, 127, 134, 147, 160, 212, 236, 266, 270, 273, |
| 109 | + 288, 331, 359, 368 }; |
109 | 110 | int[] expectedY =
|
110 |
| - { 20, 89, 129, 62, 63, 97, 50, 77, 31, 126, 80, 132, 57, 42, 58, 15, 102, 31, 103, 40 }; |
| 111 | + { 42, 40, 63, 15, 57, 50, 89, 132, 129, 31, 20, 80, 77, 62, 102, 126, 31, 58, 97, 103 }; |
111 | 112 | // these values have been read from matlab using above points
|
112 |
| - double[] expectedVal = { 21.00, 15.15, 15.06, 15.05, 14.58, 14.52, 14.48, 14.34, 14.14, 13.28, |
113 |
| - 13.03, 12.44, 11.83, 11.75, 11.55, 11.08, 11.07, 10.90, 10.64, 10.43 }; |
| 113 | + double[] expectedVal = { 11.75, 10.43, 14.58, 11.08, 11.83, 14.48, 15.15, 12.44, 15.06, 10.90, |
| 114 | + 21.00, 13.03, 14.34, 15.05, 11.07, 13.28, 14.14, 11.55, 14.52, 10.64 }; |
114 | 115 | MaximaFinder mf = new MaximaFinder(imp);
|
| 116 | + new ImagePlus("", imp).show(); |
115 | 117 | mf.computeMaximaIJ(10);
|
116 | 118 | Polygon ret = mf.getMaxima();
|
117 | 119 | double[] val = mf.getMaxValues();
|
118 | 120 | LOGGER.debug(Arrays.toString(val));
|
119 |
| - assertThat(ret.xpoints, is(expectedX)); |
120 |
| - assertThat(ret.ypoints, is(expectedY)); |
| 121 | + assertThat(ret.npoints, is(20)); |
| 122 | + for (int i = 0; i < 20; i++) { |
| 123 | + assertThat(ret.xpoints[i], is(expectedX[i])); |
| 124 | + assertThat(ret.ypoints[i], is(expectedY[i])); |
| 125 | + } |
121 | 126 | assertArrayEquals(expectedVal, val, 1e-2);
|
122 | 127 | }
|
123 | 128 |
|
|
0 commit comments