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.
    Viewer constructor: implements a standalone marker manager for a BigDataViewer-family viewer (Bvv, Bdv, etc.).
  • 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(String label, List<SNTPoint> locations, int channel, int frame, String color)
    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 viewer toolbar section of this panel.
    void
    Clears the selection of bookmarks in the table.
    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.
    Returns the floating dialog for viewer mode, creating it on first call.
    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
    Shows the marker panel, bringing it to front if already visible.
    void
    Shows or hides the floating viewer 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(AbstractBigViewer viewer)
      Viewer constructor: implements a standalone marker manager for a BigDataViewer-family viewer (Bvv, Bdv, etc.). Markers are rendered as spheres/circles in the viewer overlay and can be placed with the M key. The manager is displayed as a floating panel.
      Parameters:
      viewer - the viewer instance to attach to
  • Method Details

    • getViewerDialogPanel

      public JDialog getViewerDialogPanel()
      Returns the floating dialog for viewer mode, creating it on first call.
    • addViewerToolbarButton

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

      public void toggleViewerPanel()
      Shows or hides the floating viewer marker panel.
    • showPanel

      public void showPanel()
      Shows the marker panel, bringing it to front if already visible.
    • 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-labeled 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, String color)
      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
      color - the color (category) for the bookmarks
    • 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