Class GWDTTracerCommonCmd
- 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:
AutotraceFromSeedsCmd,AutotraceFromTipsCmd,AutotraceFromWaypointsCmd,GWDTMultiSomaCommonCmd,GWDTTracerCmd,GWDTTracerFileCmd
GWDTTracerCmd (interactive, image already loaded) and
GWDTTracerFileCmd (non-interactive, file-based).- Author:
- Tiago Ferreira
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected doubleprotected doubleprotected net.imagej.ImgPlus<?> protected booleanprotected Stringprotected Fileprotected doubleprotected org.scijava.prefs.PrefServiceprotected Stringprotected static final Stringprotected static final StringStream-mode-only strategy: seeds detection from BDV/BVV marker(s) (Mkey), since Stream mode has no Roi support.protected static final Stringprotected StringFields inherited from class sc.fiji.snt.gui.cmds.CommonDynamicCmd
EMPTY_LABEL, HEADER_HTML, snt, sntService, statusService, ui, uiServiceFields inherited from class org.scijava.command.DynamicCommand
moduleService, pluginService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidapplyWorldOriginOffsetIfAny(List<Tree> trees) Shifts each tree bysnt's currentworld origin offset, if any (a no-op when that offset is all-zero, which is the common case).voidprotected booleanconfigureSecondaryScoreMap(AbstractGWDTTracer<?> tracer) Hook for configuring the tracer's score map from a user-supplied secondary image.protected AbstractGWDTTracer<?> createAndConfigureTracer(net.imagej.ImgPlus<?> img) Creates and configures a tracer from the shared GUI parameters.protected voidprotected net.imagej.ImgPlus<?> protected voidhandleTracedTrees(List<Tree> trees) Called after tracing completes with valid trees (already corrected for any world origin offset - seeapplyWorldOriginOffsetIfAny(java.util.List<sc.fiji.snt.Tree>)).protected voidprotected voidprotected abstract booleanprotected voidprotected voidprotected voidprotected voidprotected voidToggles visibility of secondary-image inputs that are only relevant whenscoreMapFilter == SCORE_MAP_OTHER.Methods inherited from class sc.fiji.snt.gui.cmds.CommonDynamicCmd
cancel, getConfirmationEdtSafe, getPixelPositionsOfBookmarks, getPromptWithCloseHandler, getPromptWithCloseHandler, init, isCanceled, msg, notifyExternalDataLoaded, notifyLoadingEnd, notifyLoadingStart, resetUI, resetUI, resetUI, run, setStatus, status, warnIfMaterializedCropActiveMethods 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
-
SOMA_AUTO
- See Also:
-
SOMA_ROI_AUTO_EDGE
- See Also:
-
SOMA_BOOKMARK
Stream-mode-only strategy: seeds detection from BDV/BVV marker(s) (Mkey), since Stream mode has no Roi support. Only offered whensnt.isStreamMode(); seeinitForImage()- See Also:
-
prefService
protected org.scijava.prefs.PrefService prefService -
imgChoice
-
imgFileChoice
-
somaStrategyChoice
-
backgroundThreshold
protected double backgroundThreshold -
scoreMapFilter
-
lengthThreshold
protected double lengthThreshold -
branchTuneMaxAngle
protected double branchTuneMaxAngle -
debugMode
protected boolean debugMode -
abortRun
protected boolean abortRun -
chosenImp
protected net.imagej.ImgPlus<?> chosenImp
-
-
Constructor Details
-
GWDTTracerCommonCmd
public GWDTTracerCommonCmd()
-
-
Method Details
-
scoreMapFilterCallback
protected void scoreMapFilterCallback()Toggles visibility of secondary-image inputs that are only relevant whenscoreMapFilter == SCORE_MAP_OTHER. The base implementation handles anysecondaryImageSuffixinput declared by subclasses; subclasses may override to control additional related inputs. Safe to call when the input is not declared (no-op in that case). -
initForImage
protected void initForImage() -
initForFile
protected void initForFile() -
readPreferences
protected void readPreferences() -
savePreferences
protected void savePreferences() -
applyDefaults
protected void applyDefaults() -
createAndConfigureTracer
Creates and configures a tracer from the shared GUI parameters. Returnsnullif configuration failed (e.g., missing secondary image for score map).- Parameters:
img- the image to trace- Returns:
- configured tracer, or null on error
-
configureSecondaryScoreMap
Hook for configuring the tracer's score map from a user-supplied secondary image. Invoked only whenscoreMapFilter == SCORE_MAP_OTHER.Default implementation pulls from
SNT.getSecondaryData()(the secondary layer currently loaded in the GUI) and aborts the command viaerror(String)if none is available.Subclasses may override to source the secondary from disk (or elsewhere) and may choose to handle missing/incompatible inputs gracefully by disabling score mapping (
tracer.setScoreMapEnabled(false)) and returningtrueso tracing proceeds without it.- Parameters:
tracer- the tracer being configured- Returns:
trueto continue (score map configured, or gracefully disabled);falseto abort the command
-
runCommand
protected void runCommand() -
applyWorldOriginOffsetIfAny
Shifts each tree bysnt's currentworld origin offset, if any (a no-op when that offset is all-zero, which is the common case). Called once, right after tracing produces valid trees and beforehandleTracedTrees(java.util.List<sc.fiji.snt.Tree>), so that every subclass/override ofhandleTracedTrees(whether it loads trees intoPathAndFillManager, exports them to disk, or both - seeGWDTTracerFileCmd) sees already-corrected coordinates.The offset is only non-zero when
chosenImp's pixel data was wired in from a source whose own coordinate frame is not anchored at world (0,0,0) (seeBigDataLoaderCmd#applyFallbackCalibration); leaving it uncorrected would produce shape-correct but uniformly mispositioned trees.Translating the node coordinates alone is only half of the correction interactive tracing applies (see
SNT#syncActivePathCanvasState): every Path's owncanvasOffsetmust be stamped with the matching (negative, pixel-space) counterpart too, orPath#getXUnscaledDouble()and friends resolve to the wrong voxel index against whatever RAIchosenImpwas read from, even though the Path's own world coordinates display and measure correctly.SNT.getActiveCanvasPixelOffset()(not the crop-independentSNT.getDefaultCanvasPixelOffset()) is used becausechosenImpitself comes fromSNT.getLoadedDataAsImg(boolean)- the crop-local grid whenever a crop happens to be materialized, the raw streamed source's grid otherwise (seeinitForImage()).- Parameters:
trees- the traced trees to correct in place
-
handleTracedTrees
Called after tracing completes with valid trees (already corrected for any world origin offset - seeapplyWorldOriginOffsetIfAny(java.util.List<sc.fiji.snt.Tree>)). The default implementation loads trees into PathAndFillManager and optionally triggers proofreading. Subclasses (e.g.,GWDTTracerFileCmd) may override to export trees to disk instead.- Parameters:
trees- the traced trees (guaranteed non-empty)
-
isFileMode
protected abstract boolean isFileMode() -
getImgFromImgChoice
protected net.imagej.ImgPlus<?> getImgFromImgChoice() -
noValidImgError
protected void noValidImgError() -
cancel
- Specified by:
cancelin interfaceorg.scijava.Cancelable- Overrides:
cancelin classCommonDynamicCmd
-
error
- Overrides:
errorin classCommonDynamicCmd
-