Class PlausibilityMonitor

java.lang.Object
sc.fiji.snt.analysis.curation.PlausibilityMonitor

public class PlausibilityMonitor extends Object
Monitors tracing and editing operations for morphological plausibility.

The monitor maintains two tiers of checks:

Listeners are notified whenever the warning list changes so that UI components (status bar, canvas overlays, assistant panel) can react.

Author:
Tiago Ferreira
See Also:
  • Constructor Details

    • PlausibilityMonitor

      public PlausibilityMonitor()
  • Method Details

    • onForkInitiated

      public void onForkInitiated(Path parent, int branchIndex)
      Hook 1: Fork initiation. Called from SNT.startPath() when the user Alt-clicks to start a branch. Caches the parent path and branch point index for later comparison.
      Parameters:
      parent - the parent path being forked from
      branchIndex - the node index in the parent at the fork point
    • onSegmentCompleted

      public List<PlausibilityCheck.Warning> onSegmentCompleted(Path candidateChild)
      Hook 2: Segment completion. Called from SNT.searchFinished() when A* returns a candidate segment, before the user sees the keep/junk dialog.
      Parameters:
      candidateChild - the candidate child path segment
      Returns:
      the list of warnings (empty if plausible)
    • onPathFinalized

      public List<PlausibilityCheck.Warning> onPathFinalized(Path completedChild)
      Hook 3: Path finalization. Called when the user completes an entire path (SNT.finishPath()). Runs a holistic check on the full child path against its parent.
      Parameters:
      completedChild - the finished child path
      Returns:
      the list of warnings (empty if plausible)
    • onNodeEdited

      public List<PlausibilityCheck.Warning> onNodeEdited(Path editedPath, int nodeIndex)
      Hook 4: Node editing. Called after a node is moved, inserted, or deleted during edit mode. Re-checks the local neighborhood.
      Parameters:
      editedPath - the path being edited
      nodeIndex - the index of the affected node
      Returns:
      the list of warnings (empty if plausible)
    • clearForkContext

      public void clearForkContext()
      Clears the cached fork context. Should be called when tracing is canceled or a non-forking path is started.
    • runDeepScan

      public List<PlausibilityCheck.Warning> runDeepScan(Collection<Path> paths)
      Runs all enabled PlausibilityCheck.DeepChecks against the given paths.
      Parameters:
      paths - the paths to scan (e.g., all paths in the current Tree)
      Returns:
      the list of warnings (empty if no issues found)
    • runFullScan

      public List<PlausibilityCheck.Warning> runFullScan(Collection<Path> paths)
      Runs all enabled checks (both live and deep) against the given paths. Live checks are applied to every parent–child fork in the collection; deep checks scan the collection as a whole.

      This is the method behind "Run Full Scan" in the Curation Assistant panel.

      Parameters:
      paths - the paths to scan (e.g., all paths in the current Tree)
      Returns:
      the combined list of warnings (empty if no issues found)
    • addWarningListener

      public void addWarningListener(PlausibilityMonitor.WarningListener listener)
    • removeWarningListener

      public void removeWarningListener(PlausibilityMonitor.WarningListener listener)
    • isLastUpdateFromLiveCheck

      public boolean isLastUpdateFromLiveCheck()
      Returns whether the most recent warning update originated from a live check (inline during tracing) as opposed to an on-demand or full scan. UI code can use this to decide whether to show canvas animations.
      Returns:
      true if the last update was from a live check
    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public void setEnabled(boolean enabled)
    • setImageData

      public void setImageData(net.imglib2.RandomAccessibleInterval<? extends net.imglib2.type.numeric.RealType<?>> image)
      Sets the image data used by checks that require it (e.g., PlausibilityCheck.SignalQuality). Should be called before runDeepScan(Collection) or runFullScan(Collection).
      Parameters:
      image - the image (imglib2 RAI); null to clear
    • setImageStats

      public void setImageStats(double min, double max)
      Sets image-level statistics for auto-threshold computation.
      Parameters:
      min - image minimum intensity
      max - image maximum intensity
    • getLiveChecks

      public List<PlausibilityCheck.LiveCheck> getLiveChecks()
      Returns:
      the (modifiable) list of registered live checks
    • getDeepChecks

      public List<PlausibilityCheck.DeepCheck> getDeepChecks()
      Returns:
      the (modifiable) list of registered deep checks
    • getCurrentWarnings

      public List<PlausibilityCheck.Warning> getCurrentWarnings()
      Returns:
      the current (immutable) list of active warnings
    • getLiveCheck

      public <T extends PlausibilityCheck.LiveCheck> T getLiveCheck(Class<T> type)
      Convenience method to get a specific live check by type.
      Parameters:
      type - the check class
      Returns:
      the check instance, or null if not registered
    • getDeepCheck

      public <T extends PlausibilityCheck.DeepCheck> T getDeepCheck(Class<T> type)
      Convenience method to get a specific deep check by type.
      Parameters:
      type - the check class
      Returns:
      the check instance, or null if not registered