Package sc.fiji.snt.gui.cmds
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 Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected SNTprotected SNTServiceprotected org.scijava.app.StatusServiceprotected SNTUIprotected org.scijava.ui.UIServiceFields inherited from class org.scijava.command.DynamicCommand
moduleService, pluginService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()voidprotected voidprotected booleangetConfirmationEdtSafe(String msg, String title) EDT-safe wrapper aroundGuiUtils.getConfirmation(String, String).protected List<long[]> getPixelPositionsOfBookmarks(boolean selectedRowsOnly) Returns marker/bookmark positions the user has placed for this session, converted to pixel/voxel indices.protected JDialoggetPromptWithCloseHandler(String title) Finds the SciJava-generated prompt dialog by its title and attaches aWindowAdapterthat resets the UI state toSNTUI.READYwhen the dialog is closed.protected JDialoggetPromptWithCloseHandler(String title, Runnable extraOnClose) Variant ofgetPromptWithCloseHandler(String)that runs an extra action when the dialog is closing (e.g., cleaning up listeners).protected voidinit(boolean abortIfInactive) booleanprotected voidprotected voidprotected voidnotifyLoadingEnd(Viewer3D recViewer) protected voidnotifyLoadingStart(Viewer3D recViewer) protected voidresetUI()protected voidresetUI(boolean validateDimensions) protected voidresetUI(boolean validateDimensions, int state) voidrun()protected voidReports a transient progress message for the current operation.protected voidprotected voidWarns 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 - seeSNT.materializeDisplayCanvas(sc.fiji.snt.util.BoundingBox).Methods inherited from class org.scijava.command.DynamicCommand
context, getCancelReason, getContext, getInfo, getInput, getOutput, saveInputs, setContext, setInput, setOutput, uncancelMethods inherited from class org.scijava.module.AbstractModule
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, preview, resolveInput, resolveOutput, setInputs, setOutputs, unresolveInput, unresolveOutputMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.scijava.module.Module
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, isResolved, preview, resolveInput, resolveOutput, setInputs, setOutputs, setResolved, unresolveInput, unresolveOutputMethods inherited from interface org.scijava.module.MutableModule
addInput, addInput, addOutput, addOutput, removeInput, removeOutput
-
Field Details
-
HEADER_HTML
- See Also:
-
EMPTY_LABEL
- See Also:
-
statusService
protected org.scijava.app.StatusService statusService -
uiService
protected org.scijava.ui.UIService uiService -
sntService
-
snt
-
ui
-
-
Constructor Details
-
CommonDynamicCmd
public CommonDynamicCmd()
-
-
Method Details
-
init
protected void init(boolean abortIfInactive) -
status
-
setStatus
Reports a transient progress message for the current operation. Unlikestatus(String, boolean), this is meant for progress narration of a single long-running command, not general SNTUI status text. Always forwards tosnt.setCanvasLabelAllPanes(msg)(classic-mode canvases; or, when running in Stream mode, the active Bdv/Bvv viewer's persistent progress bar viaAbstractBigViewer.updateStatus(String, int, int)- Parameters:
msg- the progress message, ornull/empty to clear it
-
isCanceled
public boolean isCanceled()- Specified by:
isCanceledin interfaceorg.scijava.Cancelable- Overrides:
isCanceledin classorg.scijava.command.DynamicCommand
-
cancel
public void cancel()- Specified by:
cancelin interfaceorg.scijava.module.Module- Overrides:
cancelin classorg.scijava.module.AbstractModule
-
cancel
- Specified by:
cancelin interfaceorg.scijava.Cancelable- Overrides:
cancelin classorg.scijava.command.DynamicCommand
-
error
-
getConfirmationEdtSafe
EDT-safe wrapper aroundGuiUtils.getConfirmation(String, String). The dialog it shows callsJDialog#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. aSwingWorker, as inGWDTMultiSomaCmd#runTrace/GWDTTracerCmd#runTrace) or that SciJava itself may invoke off the EDT must route any such confirmation through this method rather than callingGuiUtilsdirectly, to avoid undefined Swing behavior.- Parameters:
msg- the confirmation messagetitle- the dialog title- Returns:
- the user's choice;
falseif the EDT could not be reached (e.g. interrupted while waiting)
-
msg
-
notifyLoadingStart
-
notifyLoadingEnd
-
resetUI
protected void resetUI() -
resetUI
protected void resetUI(boolean validateDimensions) -
resetUI
protected void resetUI(boolean validateDimensions, int state) -
getPromptWithCloseHandler
Finds the SciJava-generated prompt dialog by its title and attaches aWindowAdapterthat resets the UI state toSNTUI.READYwhen the dialog is closed. This is necessary becauseinit(boolean)sets the state toSNTUI.RUNNING_CMD, but if the user dismisses the dialog without running the command, nothing else resets it.Subclasses implementing
Interactiveshould call this method early (e.g., fromrun()) 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 viagetInfo().setLabel()— must be unique across open dialogs- Returns:
- the dialog, or
nullif not yet created by SciJava
-
getPromptWithCloseHandler
Variant ofgetPromptWithCloseHandler(String)that runs an extra action when the dialog is closing (e.g., cleaning up listeners).- Parameters:
title- the dialog titleextraOnClose- additional action to run onwindowClosing, ornullfor none. Runs before the UI state is reset.- Returns:
- the dialog, or
nullif not yet created
-
getPixelPositionsOfBookmarks
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 - seeSNT.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(), aftersnthas been set byinit(boolean). -
notifyExternalDataLoaded
protected void notifyExternalDataLoaded() -
run
public void run()
-