Search in sources :

Example 56 with Point

use of com.geophile.z.spatialobject.d2.Point in project flimj-ui by flimlib.

the class SettingsCtrl method IRFDatasetFromFile.

private FitParams<FloatType> IRFDatasetFromFile(String irfPath) throws IOException {
    FitParams<FloatType> irfParams = new FitParams<>();
    if (irfPath.endsWith(".asc")) {
        // read whitespace separated data
        ArrayList<Float> irfTrans = new ArrayList<>();
        Scanner sc = new Scanner(new File(irfPath));
        while (sc.hasNextBigDecimal()) irfTrans.add(sc.nextBigDecimal().floatValue());
        sc.close();
        // get origTrans' size and ltAxis
        int ltAxis = fp.getParams().ltAxis;
        long[] transDim = new long[3];
        fp.getOrigTrans().dimensions(transDim);
        float[] irfTransArr = new float[(int) transDim[ltAxis]];
        // place the data at the end so that the leading 0's can be used for shifting
        for (int i = Math.max(irfTransArr.length - irfTrans.size(), 0), j = 0; i < irfTransArr.length; i++, j++) irfTransArr[i] = irfTrans.get(j);
        // create a fake image out of a single array along the ltAxis
        irfParams.transMap = Views.interval(Views.extendBorder(ArrayImgs.floats(irfTransArr, new long[] { 1, 1, irfTransArr.length })), new long[] { 0, 0, 0 }, new long[] { transDim[0] - 1, transDim[1] - 1, transDim[2] - 1 });
        irfParams.ltAxis = ltAxis;
    } else if (getDss().canOpen(irfPath)) {
        final Dataset dataset = getDss().open(irfPath);
        final Localizable pos = new Point(Intervals.minAsLongArray(dataset));
        if (!FitParamsPrompter.populate(irfParams, dataset, pos))
            irfParams = null;
    }
    return irfParams;
}
Also used : Scanner(java.util.Scanner) FitParams(flimlib.flimj.FitParams) Dataset(net.imagej.Dataset) ArrayList(java.util.ArrayList) Point(net.imglib2.Point) Point(net.imglib2.Point) Localizable(net.imglib2.Localizable) FloatType(net.imglib2.type.numeric.real.FloatType) File(java.io.File)

Example 57 with Point

use of com.geophile.z.spatialobject.d2.Point in project Lectures by FER-OOP.

the class MainTreeSet method addToSet.

private static void addToSet(Set<Point> set) {
    set.add(new Point(-5, 12));
    set.add(new Point(3, -4));
    set.add(new Point(12, 9));
    set.add(new Point(3, 4));
    set.add(new Point(4, 3));
    set.add(new Point(-9, 12));
    set.add(new Point(-5, -12));
}
Also used : Point(hr.fer.oop.recap2.task2.Point)

Example 58 with Point

use of com.geophile.z.spatialobject.d2.Point in project Lectures by FER-OOP.

the class Main method addPoints.

private static void addPoints(List<Point> list) {
    list.add(new Point(-5, 12));
    list.add(new Point(3, -4));
    list.add(new Point(12, 9));
    list.add(new Point(3, 4));
    list.add(new Point(4, 3));
    list.add(new Point(-9, 12));
    list.add(new Point(-5, -12));
}
Also used : Point(hr.fer.oop.recap2.task2.Point)

Example 59 with Point

use of com.geophile.z.spatialobject.d2.Point in project Lectures by FER-OOP.

the class Main method center.

// public static <T extends Point<? extends Number>> Point<Double> center(MyList<T> list){
public static Point<Double> center(MyList<Point<? extends Number>> list) {
    double x = 0;
    double y = 0;
    int size = list.size();
    for (int i = 0; i < size; i++) {
        Point<? extends Number> p = list.elementAt(i);
        x += p.getX().doubleValue();
        y += p.getY().doubleValue();
    }
    Point<Double> point = new Point<>(x / size, y / size);
    return point;
}
Also used : Point(hr.fer.oop.generics.task2.Point) Point(hr.fer.oop.generics.task2.Point)

Example 60 with Point

use of com.geophile.z.spatialobject.d2.Point in project wiki by acktsap.

the class ColorPoint method main.

// // Broken - violates transitivity! (page 42)
// @Override public boolean equals(Object o) {
// if (!(o instanceof Point))
// return false;
// 
// // If o is a normal Point, do a color-blind comparison
// if (!(o instanceof ColorPoint))
// return o.equals(this);
// 
// // o is a ColorPoint; do a full comparison
// return super.equals(o) && ((ColorPoint) o).color == color;
// }
public static void main(String[] args) {
    // First equals function violates symmetry (Page 42)
    Point p = new Point(1, 2);
    ColorPoint cp = new ColorPoint(1, 2, Color.RED);
    System.out.println(p.equals(cp) + " " + cp.equals(p));
    // Second equals function violates transitivity (Page 42)
    ColorPoint p1 = new ColorPoint(1, 2, Color.RED);
    Point p2 = new Point(1, 2);
    ColorPoint p3 = new ColorPoint(1, 2, Color.BLUE);
    System.out.printf("%s %s %s%n", p1.equals(p2), p2.equals(p3), p1.equals(p3));
}
Also used : Point(effectivejava.chapter3.item10.Point)

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