Class GWDTTracerCommonCmd

java.lang.Object
org.scijava.module.AbstractModule
org.scijava.module.DefaultMutableModule
org.scijava.command.DynamicCommand
sc.fiji.snt.gui.cmds.CommonDynamicCmd
sc.fiji.snt.plugin.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

public abstract class GWDTTracerCommonCmd extends CommonDynamicCmd
Base command providing shared parameters and logic for GWDT autotracing. Subclassed by GWDTTracerCmd (interactive, image already loaded) and GWDTTracerFileCmd (non-interactive, file-based).
Author:
Tiago Ferreira
See Also:
  • Field Details

    • imgChoice

      protected String imgChoice
    • imgFileChoice

      protected File imgFileChoice
    • backgroundThreshold

      protected double backgroundThreshold
    • scoreMapFilter

      protected String 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 when scoreMapFilter == SCORE_MAP_OTHER. The base implementation handles any secondaryImageSuffix input 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()
    • createAndConfigureTracer

      protected AbstractGWDTTracer<?> createAndConfigureTracer(net.imagej.ImgPlus<?> img)
      Creates and configures a tracer from the shared GUI parameters. Returns null if configuration failed (e.g., missing secondary image for score map).
      Parameters:
      img - the image to trace
      Returns:
      configured tracer, or null on error
    • configureSecondaryScoreMap

      protected boolean configureSecondaryScoreMap(AbstractGWDTTracer<?> tracer)
      Hook for configuring the tracer's score map from a user-supplied secondary image. Invoked only when scoreMapFilter == SCORE_MAP_OTHER.

      Default implementation pulls from SNT.getSecondaryData() (the secondary layer currently loaded in the GUI) and aborts the command via error(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 returning true so tracing proceeds without it.

      Parameters:
      tracer - the tracer being configured
      Returns:
      true to continue (score map configured, or gracefully disabled); false to abort the command
    • runCommand

      protected void runCommand()
    • handleTracedTrees

      protected void handleTracedTrees(List<Tree> trees)
      Called after tracing completes with valid trees. 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

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

      protected void error(String msg)
      Overrides:
      error in class CommonDynamicCmd