Search in sources :

Example 26 with Point

use of com.forstudy.efjava.ch03.item10.Point in project imagej-ops by imagej.

the class NonCirculantNormalizationFactor method createNormalizationImageSemiNonCirculant.

protected void createNormalizationImageSemiNonCirculant(Interval fastFFTInterval) {
    // k is the window size (valid image region)
    final int length = k.numDimensions();
    final long[] n = new long[length];
    final long[] nFFT = new long[length];
    // also referred to as object space size
    for (int d = 0; d < length; d++) {
        n[d] = k.dimension(d) + l.dimension(d) - 1;
    }
    // to a fast FFT size
    for (int d = 0; d < length; d++) {
        nFFT[d] = fastFFTInterval.dimension(d);
    }
    FinalDimensions fd = new FinalDimensions(nFFT);
    // create the normalization image
    normalization = create.calculate(fd);
    // size of the measurement window
    final Point size = new Point(length);
    final long[] sizel = new long[length];
    for (int d = 0; d < length; d++) {
        size.setPosition(k.dimension(d), d);
        sizel[d] = k.dimension(d);
    }
    // starting point of the measurement window when it is centered in fft space
    final Point start = new Point(length);
    final long[] startl = new long[length];
    final long[] endl = new long[length];
    for (int d = 0; d < length; d++) {
        start.setPosition((nFFT[d] - k.dimension(d)) / 2, d);
        startl[d] = (nFFT[d] - k.dimension(d)) / 2;
        endl[d] = startl[d] + sizel[d] - 1;
    }
    // size of the object space
    final Point maskSize = new Point(length);
    final long[] maskSizel = new long[length];
    for (int d = 0; d < length; d++) {
        maskSize.setPosition(Math.min(n[d], nFFT[d]), d);
        maskSizel[d] = Math.min(n[d], nFFT[d]);
    }
    // starting point of the object space within the fft space
    final Point maskStart = new Point(length);
    final long[] maskStartl = new long[length];
    for (int d = 0; d < length; d++) {
        maskStart.setPosition((Math.max(0, nFFT[d] - n[d]) / 2), d);
        maskStartl[d] = (Math.max(0, nFFT[d] - n[d]) / 2);
    }
    final RandomAccessibleInterval<O> temp = Views.interval(normalization, new FinalInterval(startl, endl));
    final Cursor<O> normCursor = Views.iterable(temp).cursor();
    // draw a cube the size of the measurement space
    while (normCursor.hasNext()) {
        normCursor.fwd();
        normCursor.get().setReal(1.0);
    }
    final Img<O> tempImg = create.calculate(fd);
    // 3. correlate psf with the output of step 2.
    correlater.compute(normalization, tempImg);
    normalization = tempImg;
    final Cursor<O> cursorN = normalization.cursor();
    while (cursorN.hasNext()) {
        cursorN.fwd();
        if (cursorN.get().getRealFloat() <= 1e-3f) {
            cursorN.get().setReal(1.0f);
        }
    }
}
Also used : FinalDimensions(net.imglib2.FinalDimensions) FinalInterval(net.imglib2.FinalInterval) Point(net.imglib2.Point) Point(net.imglib2.Point)

Example 27 with Point

use of com.forstudy.efjava.ch03.item10.Point in project imagej-ops by imagej.

the class ConvolveTest 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) ComplexFloatType(net.imglib2.type.numeric.complex.ComplexFloatType)

Example 28 with Point

use of com.forstudy.efjava.ch03.item10.Point in project ddf by codice.

the class KmlToJtsPointConverterTest method setupClass.

@BeforeClass
public static void setupClass() {
    InputStream stream = KmlToJtsPointConverterTest.class.getResourceAsStream("/kmlPoint.kml");
    Kml kml = Kml.unmarshal(stream);
    testKmlPoint = ((Point) ((Placemark) kml.getFeature()).getGeometry());
}
Also used : InputStream(java.io.InputStream) Kml(de.micromata.opengis.kml.v_2_2_0.Kml) Point(de.micromata.opengis.kml.v_2_2_0.Point) BeforeClass(org.junit.BeforeClass)

Example 29 with Point

use of com.forstudy.efjava.ch03.item10.Point in project ddf by codice.

the class MetacardToKmlTest method getKmlPointGeoFromWkt.

@Test
public void getKmlPointGeoFromWkt() throws CatalogTransformerException {
    final Point kmlGeoFromWkt = (Point) MetacardToKml.getKmlGeoFromWkt("POINT (2 3)");
    final List<Coordinate> coordinates = kmlGeoFromWkt.getCoordinates();
    assertThat(coordinates, hasSize(1));
    assertThat(coordinates.get(0).getLatitude(), is(3.0));
    assertThat(coordinates.get(0).getLongitude(), is(2.0));
}
Also used : Coordinate(de.micromata.opengis.kml.v_2_2_0.Coordinate) Point(de.micromata.opengis.kml.v_2_2_0.Point) Test(org.junit.Test)

Example 30 with Point

use of com.forstudy.efjava.ch03.item10.Point in project ddf by codice.

the class MetacardToKmlTest method getKmlGeoFromJtsGeo.

@Test
public void getKmlGeoFromJtsGeo() throws CatalogTransformerException {
    final org.locationtech.jts.geom.Geometry jtsGeo = new GeometryFactory().createPoint(new org.locationtech.jts.geom.Coordinate(1.0, 2.0));
    final Geometry kmlGeo = MetacardToKml.getKmlGeoFromJtsGeo(jtsGeo);
    assertTrue(kmlGeo instanceof Point);
    final Point kmlPoint = (Point) kmlGeo;
    assertThat(kmlPoint.getCoordinates(), hasSize(1));
    assertThat(kmlPoint.getCoordinates().get(0).getLongitude(), is(1.0));
    assertThat(kmlPoint.getCoordinates().get(0).getLatitude(), is(2.0));
}
Also used : Geometry(de.micromata.opengis.kml.v_2_2_0.Geometry) MultiGeometry(de.micromata.opengis.kml.v_2_2_0.MultiGeometry) GeometryFactory(org.locationtech.jts.geom.GeometryFactory) Point(de.micromata.opengis.kml.v_2_2_0.Point) Test(org.junit.Test)

Aggregations

Point (net.imglib2.Point)33 ArrayList (java.util.ArrayList)16 FloatType (net.imglib2.type.numeric.real.FloatType)11 Test (org.junit.Test)9 List (java.util.List)8 Point (com.google.monitoring.v3.Point)7 Point (hr.fer.oop.recap2.task2.Point)7 FinalInterval (net.imglib2.FinalInterval)7 RealPoint (net.imglib2.RealPoint)7 TimeSeries (com.google.monitoring.v3.TimeSeries)6 Point (de.micromata.opengis.kml.v_2_2_0.Point)6 Interval (net.imglib2.Interval)6 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)6 HyperSphere (net.imglib2.algorithm.region.hypersphere.HyperSphere)6 AffineTransform3D (net.imglib2.realtransform.AffineTransform3D)6 HashMap (java.util.HashMap)5 Metric (com.google.api.Metric)4 TimeInterval (com.google.monitoring.v3.TimeInterval)4 TypedValue (com.google.monitoring.v3.TypedValue)4 Map (java.util.Map)4