99import net .imglib2 .img .array .ArrayImgs ;
1010import net .imglib2 .img .basictypeaccess .array .ShortArray ;
1111import net .imglib2 .type .numeric .integer .UnsignedShortType ;
12- import net .imglib2 .util .Util ;
1312
1413public class EllipseTest
1514{
1615
17- @ Test
18- public void testIterateOnce ()
19- {
20- final ArrayImg < UnsignedShortType , ShortArray > img = ArrayImgs .unsignedShorts ( 512l , 512l );
21-
22- final Point center = new Point ( 255l , 255l );
23-
24- for ( long rx = 1l ; rx < 56l ; rx ++ )
25- {
26- for ( long ry = 1l ; ry < 56l ; ry ++ )
27- {
28- Ellipses .inc ( img , center , rx , ry );
29- final EllipseCursor < UnsignedShortType > cursor = new EllipseCursor <>( img , center , rx , ry );
30- while ( cursor .hasNext () )
31- {
32- cursor .fwd ();
33- assertEquals ( "For radii (" + rx + ", " + ry + "), pixel at coordinates " +
34- Util .printCoordinates ( cursor ) + " has not been iterated one time." ,
35- 1 , cursor .get ().get () );
36- }
37- // Reset image to 0.
38- for ( final UnsignedShortType p : img )
39- p .setZero ();
40- }
41- }
42- }
43-
4416 @ Test
4517 public void testDistanceToCenter ()
4618 {
@@ -65,8 +37,7 @@ public void testDistanceToCenter()
6537 }
6638 final double dist = Math .sqrt ( d2 );
6739
68- assertEquals ( "Ellipse coordinates " + Util .printCoordinates ( cursor ) + " is too far from expected radius " + r + "." ,
69- r , dist , 0.5 );
40+ assertEquals ( r , dist , 0.5 );
7041 }
7142 }
7243 }
0 commit comments