Skip to content

Commit 2f26c7b

Browse files
committed
Speed up EllipseTest
- remove EllipseTest.testIterateOnce - do not create String objects in innermost loop
1 parent 065f241 commit 2f26c7b

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

src/test/java/net/imglib2/algorithm/region/EllipseTest.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,10 @@
99
import net.imglib2.img.array.ArrayImgs;
1010
import net.imglib2.img.basictypeaccess.array.ShortArray;
1111
import net.imglib2.type.numeric.integer.UnsignedShortType;
12-
import net.imglib2.util.Util;
1312

1413
public 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

Comments
 (0)