Class PathObjectHierarchyEvent

java.lang.Object
qupath.lib.objects.hierarchy.events.PathObjectHierarchyEvent

public class PathObjectHierarchyEvent extends Object
An event class for passing on information about modifications to a PathObjectHierarchy.
Author:
Pete Bankhead
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createStructureChangeEvent

      public static PathObjectHierarchyEvent createStructureChangeEvent(Object source, PathObjectHierarchy hierarchy, PathObject parentObject)
      Create a hierarchy event indicating that the hierarchy structure has been changed.
      Parameters:
      source -
      hierarchy -
      parentObject -
      Returns:
    • createObjectAddedEvent

      public static PathObjectHierarchyEvent createObjectAddedEvent(Object source, PathObjectHierarchy hierarchy, PathObject parentObject, PathObject pathObjectAdded)
      Create a hierarchy event indicated objects were added.
      Parameters:
      source -
      hierarchy -
      parentObject -
      pathObjectAdded -
      Returns:
    • createObjectRemovedEvent

      public static PathObjectHierarchyEvent createObjectRemovedEvent(Object source, PathObjectHierarchy hierarchy, PathObject parentObject, PathObject pathObjectRemoved)
      Create a hierarchy event indicating objects were removed.
      Parameters:
      source -
      hierarchy -
      parentObject -
      pathObjectRemoved -
      Returns:
    • createObjectsChangedEvent

      public static PathObjectHierarchyEvent createObjectsChangedEvent(Object source, PathObjectHierarchy hierarchy, PathObjectHierarchyEvent.HierarchyEventType type, Collection<? extends PathObject> pathObjects, boolean isChanging)
      Create a hierarchy event indicating objects have changed in a way consistent with the specified event type.
      Parameters:
      source -
      hierarchy -
      type -
      pathObjects -
      isChanging -
      Returns:
    • isChanging

      public boolean isChanging()
      Returns true if changes are still being made, so more events will be fired. This enables listeners to postpone expensive operations that could be called often until this flag is false.
      Returns:
    • getHierarchy

      public PathObjectHierarchy getHierarchy()
      The hierarchy to which this event refers.
      Returns:
    • getChangedObjects

      public List<PathObject> getChangedObjects()
      The objects that were affected by whichever changes were made.
      Returns:
    • getEventType

      Get the hierarchy event type.
      Returns:
    • getSource

      public Object getSource()
      Get the source that triggered the event.
      Returns:
    • isStructureChangeEvent

      public boolean isStructureChangeEvent()
      Returns true if the hierarchy structure has changed, e.g. with objects added or removed
      Returns:
    • isAddedOrRemovedEvent

      public boolean isAddedOrRemovedEvent()
      Returns true if objects have been added or removed from the hierarchy.
      Returns:
    • isObjectClassificationEvent

      public boolean isObjectClassificationEvent()
      Returns true if the event indicates that object classifications have changed.
      Returns:
    • isObjectMeasurementEvent

      public boolean isObjectMeasurementEvent()
      Returns true if the event indicates that object measurements have changed.
      Returns:
    • getStructureChangeBase

      public PathObject getStructureChangeBase()
      If this is a structure change event, return the base object, i.e. below which the structure differs from previously. In the case that an object was added or removed, this will return the parent of the added/removed object. For more thorough changes, the root object is returned.

      For events that do not correspond to structural changes, this returns null.

      Returns: