@Override public TMACoreObject getTMACoreForPixel(double x, double y) { // TODO: Consider overlapping cores - would be slightly nicer to return core with closest centroid for (TMACoreObject core : cores) { if (ROIHelpers.areaContains(core.getROI(), x, y)) return core; } return null; }
public static Collection<PathObject> getObjectsForLocation(final PathObjectHierarchy hierarchy, final double x, final double y, final int zPos, final int tPos) { if (hierarchy == null) return Collections.emptyList(); Set<PathObject> pathObjects = new HashSet<>(8); hierarchy.getObjectsForRegion(PathObject.class, ImageRegion.createInstance((int)x, (int)y, 1, 1, zPos, tPos), pathObjects); removePoints(pathObjects); // Ensure we don't have any PointROIs // Ensure the ROI contains the click Iterator<PathObject> iter = pathObjects.iterator(); while (iter.hasNext()) { PathObject temp = iter.next(); // if ((temp.isHidden() && temp.hasChildren()) || !PathROIHelpers.areaContains(temp.getROI(), x, y)) if (!ROIHelpers.areaContains(temp.getROI(), x, y)) iter.remove(); } if (pathObjects.isEmpty()) { return Collections.emptyList(); } return pathObjects; }