Package sc.fiji.snt

Class SNTUI

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

public class SNTUI extends JDialog
Implements SNT's main dialog.
Author:
Tiago Ferreira
See Also:
  • Field Details

    • partsNearbyCSpinner

      protected CheckboxSpinner partsNearbyCSpinner
    • useSnapWindow

      protected JCheckBox useSnapWindow
    • snapWindowXYsizeSpinner

      protected JSpinner snapWindowXYsizeSpinner
    • snapWindowZsizeSpinner

      protected JSpinner snapWindowZsizeSpinner
    • guiUtils

      protected GuiUtils guiUtils
    • recViewer

      protected Viewer3D recViewer
    • recViewerFrame

      protected Frame recViewerFrame
    • sciViewSNT

      protected SciViewSNT sciViewSNT
    • READY

      public static final int READY
      Flag specifying that image data is available and the UI is not waiting on any pending operations, thus 'ready to trace'
      See Also:
    • RUNNING_CMD

      public static final int RUNNING_CMD
      See Also:
    • WAITING_FOR_SIGMA_POINT_I

      public static final int WAITING_FOR_SIGMA_POINT_I
      See Also:
    • LOADING

      public static final int LOADING
      Flag specifying UI is currently waiting for I/0 operations to conclude
      See Also:
    • FITTING_PATHS

      public static final int FITTING_PATHS
      Flag specifying UI is currently waiting for fitting operations to conclude
      See Also:
    • EDITING

      public static final int EDITING
      Flag specifying UI is currently waiting for user to edit a selected Path
      See Also:
    • SNT_PAUSED

      public static final int SNT_PAUSED
      Flag specifying all SNT are temporarily disabled (all user interactions are waived back to ImageJ)
      See Also:
    • TRACING_PAUSED

      public static final int TRACING_PAUSED
      Flag specifying tracing functions are (currently) disabled. Tracing is disabled when the user chooses so or when no valid image data is available (e.g., when no image has been loaded and a placeholder display canvas is being used)
      See Also:
    • confirmTemporarySegments

      protected boolean confirmTemporarySegments
    • finishOnDoubleConfimation

      protected boolean finishOnDoubleConfimation
    • discardOnDoubleCancellation

      protected boolean discardOnDoubleCancellation
    • askUserConfirmation

      protected boolean askUserConfirmation
  • Constructor Details

    • SNTUI

      public SNTUI(SNT plugin)
      Instantiates SNT's main UI and associated PathManagerUI and FillManagerUI instances.
      Parameters:
      plugin - the SNT instance associated with this UI
  • Method Details

    • getState

      public int getState()
      Gets the current UI state.
      Returns:
      the current UI state, e.g., READY, RUNNING_CMD, etc.
    • getPrefs

      public SNTPrefs getPrefs()
      Returns:
      the preferences associated with this instance
    • isReady

      public boolean isReady()
      Assesses whether the UI is blocked.
      Returns:
      true if the UI is currently unblocked, i.e., ready for tracing/editing/analysis *
    • setEnableDebugMode

      public void setEnableDebugMode(boolean enable)
      Enables/disables debug mode
      Parameters:
      enable - true to enable debug mode, otherwise false
    • pause

      public void pause(boolean pause)
      Pauses/Resume SNT (equivalent to command in image contextual menu).
      Parameters:
      pause - whether SNT should be paused/resumed
    • pauseTracing

      public void pauseTracing(boolean pause)
      Pauses/Resume tracing functions (equivalent to command in image contextual menu).
      Parameters:
      pause - whether tracing functions should be paused/resumed
    • runCommand

      public void runCommand(String cmd) throws IllegalArgumentException
      Runs a menu command (as listed in the menu bar hierarchy).
      Parameters:
      cmd - The command to be run, exactly as listed in its menu (either in this dialog, or PathManagerUI)
      Throws:
      IllegalArgumentException - if cmd was not found.
    • selectTab

      public void selectTab(String tabTitle)
      Activates the specified tab.
      Parameters:
      tabTitle - The tab title (e.g., "Main", "3D");
    • runCommand

      public void runCommand(String cmd, String... args) throws IllegalArgumentException
      Runs a menu command with options.
      Parameters:
      cmd - The command to be run, exactly as listed in SNTUI's menu bar
      args - the option(s) that would fill the command's prompt. e.g., 'runCommand("Load Demo Dataset...", "4. Hippocampal neuron (DIC timelapse)")'
      Throws:
      IllegalArgumentException - if cmd is not found or supported.
    • runCommand

      public void runCommand(Class<? extends org.scijava.command.Command> cmd, HashMap<String,Object> inputs)
      Runs a Scijava command associated with SNT.
      Parameters:
      cmd - The command class to be run, exactly as listed in SNTUI's menu bar
      inputs - the input(s) map
    • runSNTCommandFinderCommand

      protected void runSNTCommandFinderCommand(String cmd)
    • runCustomCommand

      protected boolean runCustomCommand(String cmd)
    • getBookmarkManager

      public BookmarkManager getBookmarkManager()
      Gets the Bookmark Manager pane.
      Returns:
      the BookmarkManager associated with this UI
    • getNotesPane

      public NotesUI getNotesPane()
      Gets the Bookmark Manager pane.
      Returns:
      the BookmarkManager associated with this UI
    • getDelineationsManager

      public DelineationsManager getDelineationsManager()
      Gets the Delineations Manager pane.
      Returns:
      the DelineationsManager associated with this UI
    • runAutotracingWizard

      public void runAutotracingWizard()
      Launches the autotracing wizard for the active image.

      The tracer implementation is selected based on image type:

      See Also:
    • runSecondaryLayerWizard

      public void runSecondaryLayerWizard()
      Runs the 'secondary layer' wizard prompt for built-in filters
    • runSecondaryLayerWizard

      public void runSecondaryLayerWizard(String filter, double[] scales) throws IllegalArgumentException
      Runs the 'secondary layer wizard' in the background, without displaying prompt.
      Parameters:
      filter - either "Frangi Vesselness", "Tubeness", or "Gaussian Blur"
      scales - a list of aprox. thicknesses (radius) of the structures being traced
      Throws:
      IllegalArgumentException - if no valid image data is currently loaded
    • gaussianCalculated

      protected void gaussianCalculated(boolean succeeded)
    • refresh

      public void refresh()
      Updates the dialog, including status bar and 'computation settings' widget.
    • setVisibilityFilter

      public void setVisibilityFilter(String filter, boolean state)
      Sets filters for visibility of paths, as per respective widget in dialog.
      Parameters:
      filter - a reference to the visibility filter checkbox. Either the checkbox complete label or relevant keyword, e.g., "selected", "Z-slices", "channel", etc. "all" can also be used to toggle all checkboxes in the widget
      state - whether the filter should be active or not.
    • setRenderingScale

      public void setRenderingScale(double scale)
      Sets rendering scale of Paths as per respective widget in dialog.
      Parameters:
      scale - the scale value (-1 for default scale)
    • geSettingsString

      protected String geSettingsString()
    • updateSettingsString

      protected void updateSettingsString()
    • exitRequested

      protected void exitRequested()
    • disableImageDependentComponents

      protected void disableImageDependentComponents()
    • changeState

      public void changeState(int newState)
      Changes this UI to a new state. Does nothing if newState is the current UI state
      Parameters:
      newState - the new state, e.g., READY, TRACING_PAUSED, etc.
    • resetState

      protected void resetState()
    • error

      public void error(String msg)
    • showMessage

      public void showMessage(String msg, String title)
    • loadImagefromGUI

      protected void loadImagefromGUI(int newC, int newT)
    • updateAssignDiameterSpinner

      protected void updateAssignDiameterSpinner()
    • openFile

      protected File openFile(String extensionWithoutPeriod)
    • openReconstructionFile

      protected File openReconstructionFile(String extension)
    • saveFile

      protected File saveFile(String promptMsg, String suggestedFileName, String extensionWithoutDot)
    • updateSecLayerWidgets

      protected void updateSecLayerWidgets()
    • showStatus

      public void showStatus(String msg, boolean temporary)
      Updates the status bar.
      Parameters:
      msg - the text to displayed. Set it to null (or empty String) to reset the status bar.
      temporary - if true and msg is valid, text is displayed transiently for a couple of seconds
    • setLookAndFeel

      public void setLookAndFeel(String lookAndFeelName)
    • getOrPromptForWorkspace

      public File getOrPromptForWorkspace()
      Returns the workspace directory, prompting user to create it if it doesn't exist.
      Returns:
      workspace directory, or null if user declined creation
    • displayOnStarting

      protected void displayOnStarting()
    • promptForAutoTracingAsAppropriate

      protected void promptForAutoTracingAsAppropriate()
    • noPathsError

      protected boolean noPathsError()
    • setFillListVisible

      protected void setFillListVisible(boolean makeVisible)
    • setSigmaPaletteListener

      public void setSigmaPaletteListener(SigmaPaletteListener listener)
    • getPathManager

      public PathManagerUI getPathManager()
      Gets the Path Manager dialog.
      Returns:
      the PathManagerUI associated with this UI
    • getFillManager

      public FillManagerUI getFillManager()
      Gets the Fill Manager dialog.
      Returns:
      the FillManagerUI associated with this UI
    • getPlausibilityMonitor

      public PlausibilityMonitor getPlausibilityMonitor()
      Returns the plausibility monitor used by the Curation Manager (Curation Assistant).
    • getCurationManager

      public CurationManager getCurationManager()
      Returns the Curation Manager (Curation Assistant).
    • getReconstructionViewer

      public Viewer3D getReconstructionViewer(boolean initializeIfNull)
      Gets the Reconstruction Viewer.
      Parameters:
      initializeIfNull - it true, initializes the Viewer if it has not yet been initialized
      Returns:
      the reconstruction viewer
    • getSciViewSNT

      public SciViewSNT getSciViewSNT(boolean initializeIfNull)
      Gets the SciViewSNT instance.
      Parameters:
      initializeIfNull - whether a new instance should be created if one hasn't been initialized
      Returns:
      the SciViewSNT instance
    • getTracingCanvasPopupMenu

      public JPopupMenu getTracingCanvasPopupMenu()
    • setReconstructionViewer

      protected void setReconstructionViewer(Viewer3D recViewer)
    • setSciViewSNT

      protected void setSciViewSNT(SciViewSNT sciViewSNT)
    • reset

      protected void reset()
    • ctPositionChanged

      protected void ctPositionChanged()
    • inputImageChanged

      protected void inputImageChanged()
    • abortCurrentOperation

      protected void abortCurrentOperation()
    • launchSigmaPaletteAround

      protected void launchSigmaPaletteAround(int x, int y)
    • togglePathsChoice

      protected void togglePathsChoice()
    • setSecondaryLayerTracingSelected

      protected void setSecondaryLayerTracingSelected(boolean enable)
    • toggleSecondaryLayerTracing

      protected void toggleSecondaryLayerTracing()
    • enableAStarGUI

      protected void enableAStarGUI(boolean enable)
      Should only be called by SNT.enableAstar(boolean)
    • togglePartsChoice

      protected void togglePartsChoice()
    • toggleChannelAndFrameChoice

      protected void toggleChannelAndFrameChoice()
    • accessToValidImagePlus

      protected boolean accessToValidImagePlus()
    • noValidImageDataError

      protected void noValidImageDataError()
    • getTable

      public SNTTable getTable()
    • saveTracingsAndOpenSiblingImage

      protected void saveTracingsAndOpenSiblingImage(boolean next)
    • getImageFilenamePrefix

      protected String getImageFilenamePrefix()
    • saveToXML

      protected void saveToXML(boolean timeStampedCopy)
    • saveToXML

      protected boolean saveToXML(File file, boolean promptForNodeValuesExport)
    • saveAllPathsToSwc

      protected boolean saveAllPathsToSwc(String filePath)
    • saveAllPathsToSwc

      protected boolean saveAllPathsToSwc(String filePath, String commonFileHeader)
    • getRecorder

      public ScriptRecorder getRecorder(boolean createIfNeeded)