Package sc.fiji.snt

Class PathManagerUI

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TreeSelectionListener, RootPaneContainer, WindowConstants

public class PathManagerUI extends JDialog implements TreeSelectionListener
Implements the Path Manager Dialog.
Author:
Tiago Ferreira
See Also:
  • Field Details

  • Constructor Details

    • PathManagerUI

      public PathManagerUI(SNT plugin)
      Instantiates a new Path Manager Dialog.
      Parameters:
      plugin - the SNT instance to be associated with this Path Manager. It is assumed that its SNTUI is available.
  • Method Details

    • getSelectedPathsOrganizedByTrees

      public Map<String,Tree> getSelectedPathsOrganizedByTrees(boolean ifNoneSelectedGetAll)
      Gets the paths currently selected in the Manager's JTree list as Trees.
      Parameters:
      ifNoneSelectedGetAll - if true and no paths are currently selected, all Paths in the list are considered
      Returns:
      the map of selected paths (as keys
      See Also:
    • getSelectedPaths

      public List<Path> getSelectedPaths(boolean ifNoneSelectedGetAll)
      Gets the paths currently selected in the Manager's JTree list.
      Parameters:
      ifNoneSelectedGetAll - if true and no paths are currently selected, all Paths in the list will be returned
      Returns:
      the selected paths. Note that children of a Path are not returned if unselected.
    • selectionExists

      protected boolean selectionExists()
    • cancelFit

      protected void cancelFit(boolean updateUIState)
    • dispose

      public void dispose()
      Overrides:
      dispose in class Window
    • valueChanged

      public void valueChanged(TreeSelectionEvent e)
      Specified by:
      valueChanged in interface TreeSelectionListener
    • setSelectedPaths

      public void setSelectedPaths(Collection<Path> selectedPaths, Object source)
    • setPathList

      public void setPathList(List<Path> pathList, Path justAdded, boolean expandAll)
    • getSingleTree

      protected Tree getSingleTree()
    • getMultipleTrees

      protected Collection<Tree> getMultipleTrees()
    • quickMeasurementsCmdError

      protected void quickMeasurementsCmdError(GuiUtils guiUtils)
    • setFillList

      public void setFillList(List<Fill> fillList)
    • getNavigationToolBar

      public JToolBar getNavigationToolBar()
    • getProofReadingToolBar

      public JToolBar getProofReadingToolBar()
    • refreshForPaths

      public void refreshForPaths(Collection<Path> paths)
      Repaints the Path Manager view for the given paths. Public hook used by external mutators (e.g. the Curation Assistant's review-tag actions in CurationManager) that change path names directly and need the table to pick the change up; bypasses the heavier viewer-update pass because path mutations like tag-suffix edits don't affect 3D viewers.
      Parameters:
      paths - the paths whose representation in the manager needs to refresh; null or empty repaints the current selection.
    • update

      public void update()
      Refreshes (Repaints) the Path Manager JTree. Gets called by SNT.isOnlySelectedPathsVisible() to reflect changes in path colors, etc.
    • update

      public void update(boolean selectedPathsOnly)
      Refreshes (Repaints) the Path Manager JTree.
      Parameters:
      selectedPathsOnly - Whether only selected nodes in the JTree should be updated (repainted). If false all nodes are updated.
    • reload

      public void reload()
      Reloads the contents of PathAndFillManager
    • updateTable

      protected void updateTable()
    • getTable

      protected SNTTable getTable()
    • getSNT

      public SNT getSNT()
      Gets the SNT instance associated with this Path Manager.
      Returns:
      the SNT instance
    • getPathAndFillManager

      public PathAndFillManager getPathAndFillManager()
      Gets the PathAndFillManager instance.
      Returns:
      the PathAndFillManager instance
    • getJTree

      public JTree getJTree()
      Gets the JTree component used to display paths.
      Returns:
      the JTree component
    • getSearchable

      public com.jidesoft.swing.Searchable getSearchable()
      Gets the Searchable interface for the JTree.
      Returns:
      the Searchable interface
    • applySelectionFilter

      public void applySelectionFilter(String property, Number min, Number max) throws IllegalArgumentException
      Selects paths matching a morphometric criteria.
      Parameters:
      property - The morphometric property ("Length", "Path order", etc.) as listed in the "Morphology filter" menu (case-sensitive).
      min - the lowest value (exclusive) in the filter
      max - the highest value (exclusive) in the filter
      Throws:
      IllegalArgumentException - if property was not recognized. Note that some filtering options listed in the GUI may not be supported.
    • setCombinedSelectionFilters

      public void setCombinedSelectionFilters(boolean enable)
      Sets whether selection filters should be combined. This is equivalent to toggling the 'filter' button in Path Manager's UI
      Parameters:
      enable - if true, selection filters are combined
    • applyTag

      public void applyTag(String customTagOrColor) throws IllegalArgumentException
      Applies a custom tag/ color to selected Path(s).
      Parameters:
      customTagOrColor - The tag (or color) to be applied to selected Paths. Specifying "null color" will remove color tags from selected paths.
      Throws:
      IllegalArgumentException
    • applyDefaultTags

      public void applyDefaultTags(String... defaultTags) throws IllegalArgumentException
      Applies a default (built-in) tag to selected Path(s).
      Parameters:
      defaultTags - The tags to be applied to selected Paths, as listed in the "Tag" menu, e.g., "Traced Channel", "Traced Frame", "No. of Spine/Varicosity Markers", etc.
      Throws:
      IllegalArgumentException
    • applySelectionFilter

      public void applySelectionFilter(String query) throws IllegalArgumentException
      Selects paths matching a text-based criteria, or a list of SWC type flags
      Parameters:
      query - The matching text, as it would have been typed in the "Text filtering" box. If query encodes an integer list (e.g., "[1,3,5]"), paths are selected based on their SWC type flag
      Throws:
      IllegalArgumentException
    • applySelectionFilter

      public void applySelectionFilter(String property, Number criteria) throws IllegalArgumentException
      Selects paths matching a morphometric criteria.
      Parameters:
      property - The morphometric property ("Length", "Path order", etc.) as listed in the "Morphology filter" menu (case-sensitive).
      criteria - the filtering criteria.
      Throws:
      IllegalArgumentException - if property was not recognized. Note that some filtering options listed in the GUI may not be supported.
    • geSelectedPathsAsTree

      public Tree geSelectedPathsAsTree()
      Gets the collection of paths listed in the Path Manager as a Tree object. All paths are retrieved if none are currently selected.
      Returns:
      the Tree holding the Path collection
    • clearSelection

      public void clearSelection()
      Clears the current path selection.
    • selectAll

      public void selectAll()
      Selects all paths.
    • select

      public void select(Path path)
      Selects a specific path in the Path Manager.
      Parameters:
      path - the path to be selected. If the path is not found in the manager, the selection remains unchanged. If null active selection (if any) is cleared.
    • runCommand

      public void runCommand(String cmd) throws IllegalArgumentException
      Runs a menu command.
      Parameters:
      cmd - The command to be run, exactly as listed in the PathManagerUI's menu bar or Right-click contextual menu
      Throws:
      IllegalArgumentException - if cmd was not found.
    • runCustomCommand

      protected boolean runCustomCommand(String cmd)
    • runCommand

      public void runCommand(String cmd, String... args) throws IllegalArgumentException, IOException
      Runs a menu command with options.
      Parameters:
      cmd - The command to be run, exactly as listed in the PathManagerUI's menu bar or Right-click contextual menu
      args - the option(s) that would fill the command's prompt. e.g., 'runCommand("Branch-based Color Mapping...", "X coordinates", "Cyan Hot.lut")'
      Throws:
      IllegalArgumentException - if cmd was not found, or if it is not supported.
      IOException
    • measurementsUnsaved

      protected boolean measurementsUnsaved()
    • measureCells

      protected void measureCells()
    • extractTagsFromPath

      public static String extractTagsFromPath(Path p)
    • extractTagsFromPaths

      public static Set<String> extractTagsFromPaths(Collection<Path> paths)
    • main

      public static void main(String[] args)