use of net.imglib2.Point in project imagej-ops by imagej.
the class PolygonFeatureTests method boundingBox.
@Test
public void boundingBox() {
// ground truth verified with matlab
final List<? extends RealLocalizable> received = GeomUtils.vertices(((Polygon2D) ops.run(DefaultBoundingBox.class, contour)));
final RealPoint[] expected = new RealPoint[] { new RealPoint(1, 6), new RealPoint(1, 109), new RealPoint(78, 109), new RealPoint(78, 6) };
assertEquals("Number of polygon points differs.", expected.length, received.size());
for (int i = 0; i < expected.length; i++) {
assertEquals("Polygon point " + i + " differs in x-coordinate.", expected[i].getDoublePosition(0), received.get(i).getDoublePosition(0), EPSILON);
assertEquals("Polygon point " + i + " differs in y-coordinate.", expected[i].getDoublePosition(1), received.get(i).getDoublePosition(1), EPSILON);
}
}
use of net.imglib2.Point in project imagej-ops by imagej.
the class DeconvolveTest method placeSphereInCenter.
// utility to place a small sphere at the center of the image
private void placeSphereInCenter(Img<FloatType> img) {
final Point center = new Point(img.numDimensions());
for (int d = 0; d < img.numDimensions(); d++) center.setPosition(img.dimension(d) / 2, d);
HyperSphere<FloatType> hyperSphere = new HyperSphere<>(img, center, 2);
for (final FloatType value : hyperSphere) {
value.setReal(1);
}
}
Aggregations