use of com.geophile.z.spatialobject.d2.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;
}
use of com.geophile.z.spatialobject.d2.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);
}
use of com.geophile.z.spatialobject.d2.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());
}
}
use of com.geophile.z.spatialobject.d2.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);
}
use of com.geophile.z.spatialobject.d2.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));
}
Aggregations