Search in sources :

Example 51 with Point

use of com.forstudy.efjava.ch03.item10.Point in project flow.service.workflow by boomerang-io.

the class ModelConverterV5 method createDependency.

private static Dependency createDependency(Link link, String source) {
    Dependency dependency = new Dependency();
    dependency.setTaskId(source);
    dependency.setConditionalExecution(false);
    if (link.getExecutionCondition() != null) {
        dependency.setExecutionCondition(WorkflowExecutionCondition.valueOf(link.getExecutionCondition()));
    } else {
        dependency.setExecutionCondition(WorkflowExecutionCondition.always);
    }
    if (DECISIONKEY.equals(link.getType())) {
        dependency.setConditionalExecution(true);
    }
    Map<String, Object> metadata = new HashMap<>();
    dependency.setMetadata(metadata);
    dependency.setSwitchCondition(link.getSwitchCondition());
    List<Point> points = link.getPoints();
    metadata.put(POINTSKEY, points);
    return dependency;
}
Also used : HashMap(java.util.HashMap) Dependency(io.boomerang.mongo.model.next.Dependency) Point(io.boomerang.model.projectstormv5.Point)

Example 52 with Point

use of com.forstudy.efjava.ch03.item10.Point in project flow.service.workflow by boomerang-io.

the class ModelConverterV5 method createMetadata.

private static void createMetadata(Link link, Map<String, Object> metadata) {
    // NOSONAR
    List<Point> points = new LinkedList<>();
    Object pointsObject = metadata.get(POINTSKEY);
    if (pointsObject instanceof List) {
        List<Point> positionMap = (List<Point>) metadata.get(POINTSKEY);
        if (positionMap.get(0) instanceof Point) {
            for (Point newPoint : positionMap) {
                if (newPoint instanceof Point) {
                    Point castPoint = newPoint;
                    Point point = new Point();
                    point.setX(castPoint.getX());
                    point.setY(castPoint.getY());
                    point.setSelected(false);
                    point.setId(generateUniqueID());
                    points.add(point);
                }
            }
        } else {
            @SuppressWarnings("unchecked") List<Map<String, Object>> pontsDictionary = (List<Map<String, Object>>) metadata.get(POINTSKEY);
            for (Map<String, Object> newPoint : pontsDictionary) {
                Point point = new Point();
                if (newPoint.get("x") instanceof Integer) {
                    point.setX(((Integer) newPoint.get("x")).doubleValue());
                } else if (newPoint.get("x") instanceof Double) {
                    point.setX(((Double) newPoint.get("x")));
                } else if (newPoint.get("x") instanceof String) {
                    point.setX(Double.valueOf((String) newPoint.get("x")));
                }
                if (newPoint.get("y") instanceof Integer) {
                    point.setY(((Integer) newPoint.get("y")).doubleValue());
                } else if (newPoint.get("y") instanceof Double) {
                    point.setY(((Double) newPoint.get("y")));
                } else if (newPoint.get("y") instanceof String) {
                    point.setY(Double.valueOf((String) newPoint.get("y")));
                }
                point.setSelected(false);
                point.setId(generateUniqueID());
                points.add(point);
            }
        }
    }
    link.setPoints(points);
}
Also used : LinkedList(java.util.LinkedList) List(java.util.List) Point(io.boomerang.model.projectstormv5.Point) HashMap(java.util.HashMap) Map(java.util.Map) LinkedList(java.util.LinkedList)

Example 53 with Point

use of com.forstudy.efjava.ch03.item10.Point in project bacmman by jeanollion.

the class SubPixelLocalizator method setSubPixelCenter.

public static void setSubPixelCenter(Image img, List<Region> objects, boolean setQuality) {
    if (objects.isEmpty())
        return;
    List<Point> peaks = getPeaks(img, objects);
    List<RefinedPeak<Point>> refined = getSubLocPeaks(img, peaks);
    if (debug) {
        logger.debug("num peaks: {}, refined: {}", peaks.size(), refined.size());
        logger.debug("peaks: {}", Utils.toStringList(peaks, p -> p.toString()));
        logger.debug("refined: {}", Utils.toStringList(refined, p -> p.getValue() == 0 ? "NaN" : p.toString()));
    // logger.debug("refined: {}", Utils.toStringList(refined, p->"["+p.getDoublePosition(0)+"; "+p.getDoublePosition(1)+(img.getSizeZ()>1? ";"+p.getDoublePosition(2): "")+"]"));
    }
    for (RefinedPeak<Point> r : refined) {
        Region o = objects.get(peaks.indexOf(r.getOriginalPeak()));
        float[] position = new float[img.sizeZ() > 1 ? 3 : 2];
        position[0] = r.getFloatPosition(0);
        position[1] = r.getFloatPosition(1);
        if (img.sizeZ() > 1)
            position[2] = r.getFloatPosition(2);
        o.setCenter(new bacmman.utils.geom.Point(position));
        if (setQuality)
            o.setQuality(r.getValue());
    }
}
Also used : Logger(org.slf4j.Logger) Point(net.imglib2.Point) LoggerFactory(org.slf4j.LoggerFactory) Image(bacmman.image.Image) ArrayList(java.util.ArrayList) Utils(bacmman.utils.Utils) Voxel(bacmman.data_structure.Voxel) List(java.util.List) RefinedPeak(net.imglib2.algorithm.localextrema.RefinedPeak) SubpixelLocalization(net.imglib2.algorithm.localextrema.SubpixelLocalization) RealType(net.imglib2.type.numeric.RealType) Region(bacmman.data_structure.Region) ImgLib2ImageWrapper(bacmman.image.wrappers.ImgLib2ImageWrapper) Img(net.imglib2.img.Img) Region(bacmman.data_structure.Region) Point(net.imglib2.Point) RefinedPeak(net.imglib2.algorithm.localextrema.RefinedPeak)

Example 54 with Point

use of com.forstudy.efjava.ch03.item10.Point in project bacmman by jeanollion.

the class SubPixelLocalizator method getSubLocPeaks.

public static ArrayList<RefinedPeak<Point>> getSubLocPeaks(Image img, List<Point> peaks) {
    Img source = ImgLib2ImageWrapper.getImage(img);
    final SubpixelLocalization<Point, ? extends RealType> spl = new SubpixelLocalization<>(source.numDimensions());
    // logger.debug("source sizeZ: {}, numDim: {}", img.getSizeZ(), source.numDimensions());
    spl.setNumThreads(1);
    spl.setReturnInvalidPeaks(true);
    spl.setCanMoveOutside(true);
    spl.setAllowMaximaTolerance(true);
    spl.setMaxNumMoves(10);
    return spl.process(peaks, source, source);
}
Also used : Img(net.imglib2.img.Img) SubpixelLocalization(net.imglib2.algorithm.localextrema.SubpixelLocalization) Point(net.imglib2.Point)

Example 55 with Point

use of com.forstudy.efjava.ch03.item10.Point in project effective-java by whiteship.

the class CounterPointTest method main.

public static void main(String[] args) {
    Point p1 = new Point(1, 0);
    Point p2 = new CounterPoint(1, 0);
    // true를 출력한다.
    System.out.println(onUnitCircle(p1));
    // true를 출력해야 하지만, Point의 equals가 getClass를 사용해 작성되었다면 그렇지 않다.
    System.out.println(onUnitCircle(p2));
}
Also used : Point(me.whiteship.chapter02.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