Class CommonDynamicCmd

java.lang.Object
org.scijava.module.AbstractModule
org.scijava.module.DefaultMutableModule
org.scijava.command.DynamicCommand
sc.fiji.snt.gui.cmds.CommonDynamicCmd
All Implemented Interfaces:
Runnable, org.scijava.Cancelable, org.scijava.command.Command, org.scijava.Contextual, org.scijava.module.Module, org.scijava.module.MutableModule, org.scijava.plugin.SciJavaPlugin
Direct Known Subclasses:
AlongPathDetectorCmd, AnalyzerCmd, AnnotationDensityCmd, AnnotationGraphGeneratorCmd, BackupManagerCmd, BinaryTracerCommonCmd, BrainAnnotationCmd, ChooseDatasetCmd, ColorMapReconstructionCmd, ComputeSecondaryImg, CostFunctionSelectionCmd, DistributionBPCmd, DistributionCPCmd, DuplicateCmd, FigCreatorCmd, FilterOrTagPathsByAngleCmd, GraphGeneratorCmd, GroupAnalyzerCmd, GrowthAnalyzerCmd, GWDTTracerCommonCmd, ImportSeedPointsCmd, InsectBrainImporterCmd, InterpolateRadiiCmd, JSONImporterCmd, LabelProximityDetectorCmd, LabkitLoaderCmd, LoadReconstructionCmd, LoadSeedsFromROIsCmd, LocalThicknessCmd, MLImporterCmd, NDFImporterCmd, NodeProfiler, OpenDatasetCmd, PathAnalyzerCmd, PathMatcherCmd, PathProfiler, PathSpineAnalysisCmd, PathTimeAnalysisCmd, PeripathDetectorCmd, PlotterCmd, RemoteSWCImporterCmd, RestoreSessionCmd, RootAngleAnalyzerCmd, SaveMeasurementsCmd, SaveSessionCmd, ShollAnalysisBulkTreeCmd, ShollAnalysisTreeCmd, SkeletonizerCmd, SomaDetectorCmd, TranslateReconstructionsCmd, TreeMapperCmd, TwoDHistCmd, WekaModelLoader

public class CommonDynamicCmd extends org.scijava.command.DynamicCommand
Command class for GUI commands extending DynamicCommand
Author:
Tiago Ferreira
  • Field Details

    • HEADER_HTML

      protected static final String HEADER_HTML
      See Also:
    • EMPTY_LABEL

      protected static final String EMPTY_LABEL
      See Also:
    • statusService

      protected org.scijava.app.StatusService statusService
    • uiService

      protected org.scijava.ui.UIService uiService
    • sntService

      protected SNTService sntService
    • snt

      protected SNT snt
    • ui

      protected SNTUI ui
  • Constructor Details

    • CommonDynamicCmd

      public CommonDynamicCmd()
  • Method Details

    • init

      protected void init(boolean abortIfInactive)
    • status

      protected void status(String statusMsg, boolean temporaryMsg)
    • setStatus

      protected void setStatus(String msg)
      Reports a transient progress message for the current operation. Unlike status(String, boolean), this is meant for progress narration of a single long-running command, not general SNTUI status text. Always forwards to snt.setCanvasLabelAllPanes(msg) (classic-mode canvases; or, when running in Stream mode, the active Bdv/Bvv viewer's persistent progress bar via AbstractBigViewer.updateStatus(String, int, int)
      Parameters:
      msg - the progress message, or null/empty to clear it
    • isCanceled

      public boolean isCanceled()
      Specified by:
      isCanceled in interface org.scijava.Cancelable
      Overrides:
      isCanceled in class org.scijava.command.DynamicCommand
    • cancel

      public void cancel()
      Specified by:
      cancel in interface org.scijava.module.Module
      Overrides:
      cancel in class org.scijava.module.AbstractModule
    • cancel

      public void cancel(String reason)
      Specified by:
      cancel in interface org.scijava.Cancelable
      Overrides:
      cancel in class org.scijava.command.DynamicCommand
    • error

      protected void error(String msg)
    • getConfirmationEdtSafe

      protected boolean getConfirmationEdtSafe(String msg, String title)
      EDT-safe wrapper around GuiUtils.getConfirmation(String, String). The dialog it shows calls JDialog#setVisible(true) directly, with no internal thread dispatch - safe only when already on the EDT. Commands whose heavy work runs on a background thread (e.g. a SwingWorker, as in GWDTMultiSomaCmd#runTrace/GWDTTracerCmd#runTrace) or that SciJava itself may invoke off the EDT must route any such confirmation through this method rather than calling GuiUtils directly, to avoid undefined Swing behavior.
      Parameters:
      msg - the confirmation message
      title - the dialog title
      Returns:
      the user's choice; false if the EDT could not be reached (e.g. interrupted while waiting)
    • msg

      protected void msg(String msg, String title)
    • notifyLoadingStart

      protected void notifyLoadingStart(Viewer3D recViewer)
    • notifyLoadingEnd

      protected void notifyLoadingEnd(Viewer3D recViewer)
    • resetUI

      protected void resetUI()
    • resetUI

      protected void resetUI(boolean validateDimensions)
    • resetUI

      protected void resetUI(boolean validateDimensions, int state)
    • getPromptWithCloseHandler

      protected JDialog getPromptWithCloseHandler(String title)
      Finds the SciJava-generated prompt dialog by its title and attaches a WindowAdapter that resets the UI state to SNTUI.READY when the dialog is closed. This is necessary because init(boolean) sets the state to SNTUI.RUNNING_CMD, but if the user dismisses the dialog without running the command, nothing else resets it.

      Subclasses implementing Interactive should call this method early (e.g., from run()) to ensure the listener is attached before the user can close the dialog. The dialog is cached: repeated calls are no-ops once it has been found.

      Parameters:
      title - the exact title set via getInfo().setLabel() — must be unique across open dialogs
      Returns:
      the dialog, or null if not yet created by SciJava
    • getPromptWithCloseHandler

      protected JDialog getPromptWithCloseHandler(String title, Runnable extraOnClose)
      Variant of getPromptWithCloseHandler(String) that runs an extra action when the dialog is closing (e.g., cleaning up listeners).
      Parameters:
      title - the dialog title
      extraOnClose - additional action to run on windowClosing, or null for none. Runs before the UI state is reset.
      Returns:
      the dialog, or null if not yet created
    • getPixelPositionsOfBookmarks

      protected List<long[]> getPixelPositionsOfBookmarks(boolean selectedRowsOnly)
      Returns marker/bookmark positions the user has placed for this session, converted to pixel/voxel indices.
      Parameters:
      selectedRowsOnly - if true, only selected rows are included; otherwise, all markers/bookmarks are considered
      Returns:
      pixel/voxel-coordinate positions (long[]{x, y, z}, one per marker/bookmark), in table order; empty if there is no relevant manager available (e.g. Stream mode with no viewer open yet), or it has no entries
    • warnIfMaterializedCropActive

      protected void warnIfMaterializedCropActive()
      Warns the user that this command will run against the currently materialized crop's (small) pixel data, not the full Stream-mode dataset it was cut from - see SNT.materializeDisplayCanvas(sc.fiji.snt.util.BoundingBox). A no-op if no crop is currently materialized. Subclasses whose command reads pixel data directly (GWDT tracing, soma detection, binary-image autotracing, etc.) should call this from their own init(), after snt has been set by init(boolean).
    • notifyExternalDataLoaded

      protected void notifyExternalDataLoaded()
    • run

      public void run()