Package sc.fiji.snt

Class BookmarkManager

java.lang.Object
sc.fiji.snt.BookmarkManager

public class BookmarkManager extends Object
Implements the Bookmark Manager pane.
Author:
Tiago Ferreira
  • Constructor Summary

    Constructors
    Constructor
    Description
    SNT constructor: implements the Bookmark Manager pane embedded in SNT's UI.
    BVV constructor: implements a standalone marker manager for a BVV viewer.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(double x, double y, double z)
    BVV mode: adds a marker at the specified world coordinates.
    void
    add(double x, double y, double z, Color color, float size)
    BVV mode: adds a marker at the specified world coordinates with a color and size.
    void
    add(int x, int y, int z, int c, int t)
    Adds a bookmark at the specified coordinates and time/channel positions.
    protected void
    add(int x, int y, int z, ij.ImagePlus imp)
     
    void
    add(String label, List<double[]> xyzctLocations)
    Adds multiple bookmarks with the specified label and locations.
    void
    add(String label, List<double[]> xyzctLocations, Color color)
    Adds multiple bookmarks with the specified label, locations, and color tag.
    void
    add(String label, List<SNTPoint> locations, int channel, int frame)
    Adds multiple bookmarks with the specified label and locations.
    void
    add(Map<Path,Set<Integer>> map, String commonLabel)
    Adds multiple bookmarks from selected path nodes
    void
    add(Path path, int nodeIndex)
     
    void
    Adds a component to the BVV toolbar section of this panel.
    void
    Clears the selection of bookmarks in the table.
    Returns the floating dialog for BVV mode, creating it on first call.
    int
    Returns the number of bookmarks.
    protected JPanel
     
    getPixelPositions(boolean onlySelectedRows)
    Returns a list of points representing the bookmarks.
    getPositions(boolean onlySelectedRows)
    Returns a list of points representing the bookmarks.
    static List<ij.gui.PointRoi>
    getRois(String commonLabel, List<double[]> xyzctLocations)
     
    static List<ij.gui.PointRoi>
    getRois(String commonLabel, List<double[]> xyzctLocations, Color color)
    Creates a list of PointRois from XYZCT locations with a color tag.
    List<ij.gui.Roi>
    getROIs(boolean onlySelectedRows)
    Returns a list of ROIs representing the bookmarks.
    boolean
    Returns whether any bookmarks exist.
    protected boolean
     
    void
    load(ij.gui.Roi[] rois)
     
    boolean
    load(File file)
    Loads bookmarks from the specified file.
    boolean
    load(String filePath)
     
    void
    load(List<ij.gui.Roi> rois)
    Loads bookmarks from the specified list of ROIs.
    void
    remove(Path path, int nodeIndex)
     
    void
    Clears all bookmarks.
    boolean
    save(File file)
    Saves bookmarks to the specified file.
    boolean
    save(String filePath)
     
    void
    Alias for toggleBvvPanel() shows the marker panel.
    void
    Shows or hides the floating BVV marker panel.
    void
    toOverlay(ij.gui.Overlay overlay)
    Adds the bookmark ROIs to the specified overlay.
    void
    Adds the bookmarks to the ROI Manager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BookmarkManager

      public BookmarkManager(SNTUI sntui)
      SNT constructor: implements the Bookmark Manager pane embedded in SNT's UI.
    • BookmarkManager

      public BookmarkManager(Bvv bvv)
      BVV constructor: implements a standalone marker manager for a BVV viewer. Markers are rendered as spheres in the BVV overlay and can be placed with the M key. The manager is displayed as a floating panel.
      Parameters:
      bvv - the BVV viewer instance to attach to
  • Method Details

    • getBvvPanel

      public JDialog getBvvPanel()
      Returns the floating dialog for BVV mode, creating it on first call.
    • addBvvToolbarButton

      public void addBvvToolbarButton(JComponent component)
      Adds a component to the BVV toolbar section of this panel. The component is appended after a separator the first time this method is called. Bvv uses this to inject context-specific controls (e.g. a slab-clip toggle).
      Parameters:
      component - the component to add; must not be null
    • toggleBvvPanel

      public void toggleBvvPanel()
      Shows or hides the floating BVV marker panel.
    • showPanel

      public void showPanel()
      Alias for toggleBvvPanel() shows the marker panel.
    • getPanel

      protected JPanel getPanel()
    • add

      public void add(double x, double y, double z)
      BVV mode: adds a marker at the specified world coordinates. The marker is auto-labelled and immediately rendered in the BVV overlay.
      Parameters:
      x - world x-coordinate
      y - world y-coordinate
      z - world z-coordinate
    • add

      public void add(double x, double y, double z, Color color, float size)
      BVV mode: adds a marker at the specified world coordinates with a color and size.
      Parameters:
      x - world x-coordinate
      y - world y-coordinate
      z - world z-coordinate
      color - the marker color, or null for the viewer default
      size - the sphere radius in world units; 0 uses the viewer default
    • add

      protected void add(int x, int y, int z, ij.ImagePlus imp)
    • add

      public void add(Path path, int nodeIndex)
    • remove

      public void remove(Path path, int nodeIndex)
    • add

      public void add(int x, int y, int z, int c, int t)
      Adds a bookmark at the specified coordinates and time/channel positions.
      Parameters:
      x - the x-coordinate of the bookmark
      y - the y-coordinate of the bookmark
      z - the z-coordinate of the bookmark
      c - the channel position of the bookmark
      t - the time position of the bookmark
    • add

      public void add(String label, List<SNTPoint> locations, int channel, int frame)
      Adds multiple bookmarks with the specified label and locations.
      Parameters:
      label - the label for the bookmarks
      locations - the list of SNTPoint locations for the bookmarks
      channel - the channel position for the bookmarks
      frame - the time position for the bookmarks
    • add

      public void add(String label, List<double[]> xyzctLocations)
      Adds multiple bookmarks with the specified label and locations.
      Parameters:
      label - the label for the bookmarks
      xyzctLocations - the list of XYZCT locations
    • add

      public void add(String label, List<double[]> xyzctLocations, Color color)
      Adds multiple bookmarks with the specified label, locations, and color tag.
      Parameters:
      label - the label prefix for the bookmarks
      xyzctLocations - the list of XYZCT locations
      color - the color tag for the bookmarks, or null for no tag
    • add

      public void add(Map<Path,Set<Integer>> map, String commonLabel)
      Adds multiple bookmarks from selected path nodes
      Parameters:
      map - the map of [k=Path, v=list of node indices] from which node positions are extracted
      commonLabel - an (optional) bookmark label suffix
    • clearSelection

      public void clearSelection()
      Clears the selection of bookmarks in the table. Does nothing if no selection exists.
    • reset

      public void reset()
      Clears all bookmarks.
    • hasBookmarks

      public boolean hasBookmarks()
      Returns whether any bookmarks exist.
      Returns:
      true if there is at least one bookmark
    • isShowing

      protected boolean isShowing()
    • load

      public boolean load(File file)
      Loads bookmarks from the specified file.
      Parameters:
      file - the file to load bookmarks from. File is expected to be a CSV file with 6 columns in the following order: Label, X, Y, Z, C, T.
      Returns:
      true if bookmarks were loaded successfully, false otherwise
    • load

      public boolean load(String filePath)
      See Also:
    • load

      public void load(List<ij.gui.Roi> rois)
      Loads bookmarks from the specified list of ROIs. ROIs can be of any type. If area ROIs are provided, their centroids are used as bookmark locations.
      Parameters:
      rois - the list of ROIs to load bookmarks from
    • load

      public void load(ij.gui.Roi[] rois)
      See Also:
    • save

      public boolean save(File file)
      Saves bookmarks to the specified file.
      Parameters:
      file - the file to save bookmarks to
      Returns:
      true if bookmarks were saved successfully, false otherwise
    • save

      public boolean save(String filePath)
      See Also:
    • getCount

      public int getCount()
      Returns the number of bookmarks.
      Returns:
      the number of bookmarks currently stored in the manager.
    • getROIs

      public List<ij.gui.Roi> getROIs(boolean onlySelectedRows)
      Returns a list of ROIs representing the bookmarks.
      Parameters:
      onlySelectedRows - if true, only selected rows are included; otherwise, all ROIs in the manager are included
      Returns:
      the list of ROIs (PointRoi) representing the bookmarks
    • getPixelPositions

      public List<SNTPoint> getPixelPositions(boolean onlySelectedRows)
      Returns a list of points representing the bookmarks.
      Parameters:
      onlySelectedRows - if true, only selected rows are included; otherwise, all ROIs in the manager are included
      Returns:
      the list of Points representing the bookmarks
    • getPositions

      public List<SNTPoint> getPositions(boolean onlySelectedRows)
      Returns a list of points representing the bookmarks.
      Parameters:
      onlySelectedRows - if true, only selected rows are included; otherwise, all ROIs in the manager are included
      Returns:
      the list of Points representing the bookmarks
    • toOverlay

      public void toOverlay(ij.gui.Overlay overlay)
      Adds the bookmark ROIs to the specified overlay. If no bookmarks are selected, all bookmarks are added, otherwise only the selected bookmarks are added.
      Parameters:
      overlay - the overlay to add the bookmarks to. Null not allowed
    • toRoiManager

      public void toRoiManager()
      Adds the bookmarks to the ROI Manager. If no bookmarks are selected, all bookmarks are added, otherwise only the selected bookmarks are added.
    • getRois

      public static List<ij.gui.PointRoi> getRois(String commonLabel, List<double[]> xyzctLocations)
    • getRois

      public static List<ij.gui.PointRoi> getRois(String commonLabel, List<double[]> xyzctLocations, Color color)
      Creates a list of PointRois from XYZCT locations with a color tag.
      Parameters:
      commonLabel - the label prefix for each ROI
      xyzctLocations - the list of XYZCT locations (pixel coordinates)
      color - the stroke color for the ROIs, or null for default
      Returns:
      list of PointRoi objects