Search in sources :

Example 26 with Point

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);
    }
}
Also used : RealPoint(net.imglib2.RealPoint) Polygon2D(net.imglib2.roi.geom.real.Polygon2D) RealPoint(net.imglib2.RealPoint) DefaultBoundingBox(net.imagej.ops.geom.geom2d.DefaultBoundingBox) Test(org.junit.Test) AbstractFeatureTest(net.imagej.ops.features.AbstractFeatureTest)

Example 27 with Point

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);
    }
}
Also used : HyperSphere(net.imglib2.algorithm.region.hypersphere.HyperSphere) Point(net.imglib2.Point) Point(net.imglib2.Point) FloatType(net.imglib2.type.numeric.real.FloatType)

Aggregations

ArrayList (java.util.ArrayList)10 RealPoint (net.imglib2.RealPoint)10 Point (net.imglib2.Point)8 Test (org.junit.Test)7 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)5 DoubleType (net.imglib2.type.numeric.real.DoubleType)5 Point (com.google.monitoring.v3.Point)4 AbstractFeatureTest (net.imagej.ops.features.AbstractFeatureTest)4 HyperSphere (net.imglib2.algorithm.region.hypersphere.HyperSphere)4 Polygon2D (net.imglib2.roi.geom.real.Polygon2D)4 FloatType (net.imglib2.type.numeric.real.FloatType)4 Metric (com.google.api.Metric)3 TimeInterval (com.google.monitoring.v3.TimeInterval)3 TimeSeries (com.google.monitoring.v3.TimeSeries)3 TypedValue (com.google.monitoring.v3.TypedValue)3 List (java.util.List)3 Interval (net.imglib2.Interval)3 MonitoredResource (com.google.api.MonitoredResource)2 MetricServiceClient (com.google.cloud.monitoring.v3.MetricServiceClient)2 CreateTimeSeriesRequest (com.google.monitoring.v3.CreateTimeSeriesRequest)2