public synchronized void setHierarchy(PathObjectHierarchy hierarchy) { if (this == hierarchy) return; rootObject = hierarchy.getRootObject(); tmaGrid = hierarchy.tmaGrid; fireHierarchyChangedEvent(rootObject); }
/** * Trigger an update for the specified hierarchy. * * This should be called after any (non-standard) modifications are made to the hierarchy * to ensure that all listeners are notified (including for any GUI). * * @param hierarchy */ public static void fireHierarchyUpdate(final PathObjectHierarchy hierarchy) { if (hierarchy != null) hierarchy.fireHierarchyChangedEvent(QP.class); }
/** * Only objects with ROIs can be added. * TODO: Consider relaxing this requirement. * * @param pathObject * @param avoidDuplicates * @return */ public synchronized boolean addPathObject(PathObject pathObject, boolean avoidDuplicates) { return addPathObject(pathObject, avoidDuplicates, true); }
synchronized void clearTMAGrid() { if (tmaGrid == null) return; removeObjects(new ArrayList<>(tmaGrid.getTMACoreList()), true); // for (TMACoreObject core : tmaGrid.getTMACoreList()) // removeObject(core, true); // this.tmaGrid = null; // Notify listeners of changes fireHierarchyChangedEvent(getRootObject()); }
public static List<TMACoreObject> getTMACoreList() { PathObjectHierarchy hierarchy = getCurrentHierarchy(); if (hierarchy == null || hierarchy.getTMAGrid() == null) return Collections.emptyList(); return hierarchy.getTMAGrid().getTMACoreList(); }
@Override public String toString() { return "TMA Grid: " + nCores() + " cores ("+ getGridWidth() + " x " + getGridHeight() + "), " + getNMissingCores() + " missing"; }
/** * Add path object as descendant of the requested parent. * * @param pathObjectParent * @param pathObject * @param avoidDuplicates * @param fireUpdate * @return */ public synchronized boolean addPathObjectBelowParent(PathObject pathObjectParent, PathObject pathObject, boolean avoidDuplicates, boolean fireUpdate) { if (pathObjectParent == null) return addPathObject(pathObject, avoidDuplicates, fireUpdate); else return addPathObjectToList(pathObjectParent, pathObject, avoidDuplicates, fireUpdate); }
/** * Get the TMA core that contains the specified x & y coordinate, or null if no core is available for the coordinates give. * * @param hierarchy * @param x * @param y * @return */ public static TMACoreObject getTMACoreForLocation(final PathObjectHierarchy hierarchy, final double x, final double y) { TMAGrid tmaGrid = hierarchy.getTMAGrid(); if (tmaGrid == null) return null; return tmaGrid.getTMACoreForPixel(x, y); }
public synchronized void fireObjectsChangedEvent(Object source, Collection<? extends PathObject> pathObjects) { fireObjectsChangedEvent(source, pathObjects, false); }
public synchronized boolean removeObject(PathObject pathObject, boolean keepChildren) { return removeObject(pathObject, keepChildren, true); }
/** * Create a new ImageData with ImageType.UNKNOWN and a new PathObjectHierarchy. * * @param server * @param hierarchy */ public ImageData(ImageServer<T> server) { this(server, new PathObjectHierarchy()); }
public synchronized void setTMAGrid(TMAGrid tmaGrid) { clearTMAGrid(); if (tmaGrid == null) return; this.tmaGrid = tmaGrid; updateTMAHierarchy(); }
private void ensureCacheConstructed() { if (!isActive()) constructCache(); }
@Override public String toString() { return "Hierarchy: " + nObjects() + " objects"; }
public PathObjectTileCache(PathObjectHierarchy hierarchy, int tileSize) { this.hierarchy = hierarchy; this.tileSize = tileSize; if (hierarchy != null) hierarchy.addPathObjectListener(this); }
public Collection<PathObject> getObjectsForRegion(Class<? extends PathObject> cls, ImageRegion region, Collection<PathObject> pathObjects) { return tileCache.getObjectsForRegion(cls, region, pathObjects, true); }
public boolean hasObjectsForRegion(Class<? extends PathObject> cls, ImageRegion region) { return tileCache.hasObjectsForRegion(cls, region, true); }
public synchronized void fireHierarchyChangedEvent(Object source) { fireHierarchyChangedEvent(source, getRootObject()); }
@Override protected Collection<? extends PathObject> getParentObjects(PluginRunner<T> runner) { PathObject selected = runner.getSelectedObject(); if (selected instanceof TMACoreObject) return Collections.singleton(selected); if (runner.getHierarchy().getTMAGrid() != null) return runner.getHierarchy().getTMAGrid().getTMACoreList(); else return Collections.emptyList(); }
public ImageData(ImageServer<T> server, ImageType type) { this(server, new PathObjectHierarchy(), type); }