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);
Iterator<PathObject> iter = pathObjects.iterator();
while (iter.hasNext()) {
PathObject temp = iter.next();
if (!ROIHelpers.areaContains(temp.getROI(), x, y))
iter.remove();
}
if (pathObjects.isEmpty()) {
return Collections.emptyList();
}
return pathObjects;
}