Package sc.fiji.snt
Class BookmarkManager
java.lang.Object
sc.fiji.snt.BookmarkManager
Implements the Bookmark Manager pane.
- Author:
- Tiago Ferreira
-
Constructor Summary
ConstructorsConstructorDescriptionBookmarkManager(SNTUI sntui) SNT constructor: implements the Bookmark Manager pane embedded in SNT's UI.BookmarkManager(AbstractBigViewer viewer) Viewer constructor: implements a standalone marker manager for a BigDataViewer-family viewer (Bvv, Bdv, etc.). -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double x, double y, double z) BVV mode: adds a marker at the specified world coordinates.voidadd(double x, double y, double z, int c, int t) Adds a bookmark at the specified world/calibrated coordinates and time/channel positions.voidBVV mode: adds a marker at the specified world coordinates with a color and size, and default label.voidadd(int x, int y, int z, int c, int t) Adds a bookmark at the specified pixel/voxel coordinates and time/channel positions.protected voidadd(int x, int y, int z, ij.ImagePlus imp) voidBVV mode: adds a marker at the specified world coordinates with a color and size.voidAdds multiple bookmarks with the specified label and locations.voidAdds multiple bookmarks with the specified label, locations, and color tag.voidAdds multiple bookmarks with the specified label and locations.voidAdds multiple bookmarks with the specified label and locations.voidAdds multiple bookmarks from selected path nodesvoidAdds a bookmark at the (world/calibrated) position of the specified path node.voidaddViewerToolbarButton(JComponent component) Adds a component to the viewer toolbar section of this panel.voidClears the selection of bookmarks in the table.intgetCount()Returns the number of bookmarks.Returns the position of the most recently added bookmark/marker, in spatially calibrated ("world") coordinates (canonical storage format).protected JPanelgetPanel()getPixelPositions(boolean onlySelectedRows) Returns bookmark/marker positions in pixel/voxel coordinates, converted from this manager's canonical world/calibrated storage viaworldToPixel(Bookmark).getPositions(boolean onlySelectedRows) Returns bookmark/marker positions in spatially calibrated ("world") coordinates, i.e., this manager's canonical storage format, returned as-is (fresh copies) in both modes.static List<ij.gui.PointRoi> static List<ij.gui.PointRoi> Creates a list ofPointRois 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.booleanReturns whether any bookmarks exist.protected booleanvoidload(ij.gui.Roi[] rois) booleanLoads bookmarks from the specified file.booleanvoidLoads bookmarks from the specified list of ROIs.voidvoidreset()Clears all bookmarks.booleanSaves bookmarks to the specified file.booleanvoidShows the marker panel, bringing it to front if already visible.voidShows or hides this marker manager's UI: redirects to SNTUI's "Bookmarks" tab whenever when SNTUI is present (e.g., in stream mode, seeinsideSNTUI()), otherwise toggles the floating viewer dialog.voidtoOverlay(ij.gui.Overlay overlay) Adds the bookmark ROIs to the specified overlay.voidAdds the bookmarks to the ROI Manager.
-
Constructor Details
-
BookmarkManager
SNT constructor: implements the Bookmark Manager pane embedded in SNT's UI. -
BookmarkManager
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 theMkey. The manager is displayed as a floating panel.- Parameters:
viewer- the viewer instance to attach to
-
-
Method Details
-
getViewerDialogPanel
Returns the floating dialog for viewer mode, creating it on first call. -
addViewerToolbarButton
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 benull
-
toggleViewerPanel
public void toggleViewerPanel()Shows or hides this marker manager's UI: redirects to SNTUI's "Bookmarks" tab whenever when SNTUI is present (e.g., in stream mode, seeinsideSNTUI()), otherwise toggles the floating viewer dialog. -
showPanel
public void showPanel()Shows the marker panel, bringing it to front if already visible. -
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-coordinatey- world y-coordinatez- world z-coordinate
-
add
BVV mode: adds a marker at the specified world coordinates with a color and size.- Parameters:
label- the marker's label (will be made unique if a repeated entry exists)x- world x-coordinatey- world y-coordinatez- world z-coordinatecolor- the marker color, ornullfor the viewer defaultsize- the sphere radius in world units; 0 uses the viewer default
-
add
BVV mode: adds a marker at the specified world coordinates with a color and size, and default label.- Parameters:
x- world x-coordinatey- world y-coordinatez- world z-coordinatecolor- the marker color, ornullfor the viewer defaultsize- the sphere radius in world units; 0 uses the viewer default
-
add
protected void add(int x, int y, int z, ij.ImagePlus imp) - Parameters:
x- , y, z pixel/voxel coordinates (as sourced from a mouse click onimp)
-
add
Adds a bookmark at the (world/calibrated) position of the specified path node.- Parameters:
path- the pathnodeIndex- the node index
-
remove
-
add
public void add(int x, int y, int z, int c, int t) Adds a bookmark at the specified pixel/voxel coordinates and time/channel positions. Coordinates are converted to (and stored as) world/calibrated units using the active image's calibration.- Parameters:
x- the x-coordinate of the bookmark, in pixelsy- the y-coordinate of the bookmark, in pixelsz- the z-coordinate of the bookmark, in pixels (slice index, 0-based)c- the channel position of the bookmarkt- the time position of the bookmark
-
add
public void add(double x, double y, double z, int c, int t) Adds a bookmark at the specified world/calibrated coordinates and time/channel positions.- Parameters:
x- the x-coordinate of the bookmark, in calibrated unitsy- the y-coordinate of the bookmark, in calibrated unitsz- the z-coordinate of the bookmark, in calibrated unitsc- the channel position of the bookmarkt- the time position of the bookmark
-
add
Adds multiple bookmarks with the specified label and locations.- Parameters:
label- the label for the bookmarkslocations- the list of SNTPoint (world/calibrated) locations for the bookmarkschannel- the channel position for the bookmarksframe- the time position for the bookmarkscolor- the color (category) for the bookmarks
-
add
Adds multiple bookmarks with the specified label and locations.- Parameters:
label- the label for the bookmarkslocations- the list of SNTPoint locations for the bookmarkschannel- the channel position for the bookmarksframe- the time position for the bookmarks
-
add
Adds multiple bookmarks with the specified label and locations.- Parameters:
label- the label for the bookmarksxyzctLocations- the list of XYZCT locations, in pixel/voxel coordinates (seeDetection.xyzct())
-
add
Adds multiple bookmarks with the specified label, locations, and color tag. Coordinates are converted to (and stored as) world/calibrated units using the active image's calibration.- Parameters:
label- the label prefix for the bookmarksxyzctLocations- the list of XYZCT locations, in pixel/voxel coordinates (seeDetection.xyzct())color- the color tag for the bookmarks, ornullfor no tag
-
add
Adds multiple bookmarks from selected path nodes- Parameters:
map- the map of [k=Path, v=list of node indices] from which node positions are extractedcommonLabel- 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
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
- Parameters:
filePathOrURL- local path or remote URL (e.g.https://.../markers.csv) to a CSV file with the same layout expected byload(File).- Returns:
- true if bookmarks were loaded successfully, false otherwise.
-
load
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
Saves bookmarks to the specified file.- Parameters:
file- the file to save bookmarks to- Returns:
- true if bookmarks were saved successfully, false otherwise
-
save
- See Also:
-
getCount
public int getCount()Returns the number of bookmarks.- Returns:
- the number of bookmarks currently stored in the manager.
-
getROIs
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
Returns bookmark/marker positions in pixel/voxel coordinates, converted from this manager's canonical world/calibrated storage viaworldToPixel(Bookmark).- Parameters:
onlySelectedRows- if true, only selected rows are included; otherwise, all bookmarks in the manager are included- Returns:
- the list of Points (fresh
PointInImagecopies) of the bookmarks, in pixel/voxel coordinates
-
getPositions
Returns bookmark/marker positions in spatially calibrated ("world") coordinates, i.e., this manager's canonical storage format, returned as-is (fresh copies) in both modes.- Parameters:
onlySelectedRows- if true, only selected rows are included; otherwise, all bookmarks in the manager are included- Returns:
- the list of Points representing the bookmarks, in calibrated ("world") coordinates
-
getLastPosition
Returns the position of the most recently added bookmark/marker, in spatially calibrated ("world") coordinates (canonical storage format).In viewer mode (BVV/BDV), this is the last marker placed with the
Mkey (or added programmatically). In SNT-UI mode, this is the last entry added to the Bookmark Manager pane. Since new entries are always appended, this reflects placement order in the common case; it can become stale relative to placement order after an explicit list-reordering operation (e.g. the table's "Sort by Distance..." menu, or a Merge/Colocalize operation, both of which re-write the backing list).- Returns:
- the position of the last bookmark, or
nullif none have been added
-
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
-
getRois
public static List<ij.gui.PointRoi> getRois(String commonLabel, List<double[]> xyzctLocations, Color color) Creates a list ofPointRois from XYZCT locations with a color tag.- Parameters:
commonLabel- the label prefix for each ROIxyzctLocations- the list of XYZCT locations (pixel coordinates)color- the stroke color for the ROIs, ornullfor default- Returns:
- list of PointRoi objects
-