Class BinaryTracerFileCmd

java.lang.Object
org.scijava.module.AbstractModule
org.scijava.module.DefaultMutableModule
org.scijava.command.DynamicCommand
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

public class BinaryTracerFileCmd extends BinaryTracerCommonCmd
Non-interactive command for batch BinaryTracer autotracing of all images in a directory. Each image is processed independently and traced trees are exported to disk as SWC files.

Failures on individual images are logged but do not abort the batch. ROI-based root detection is supported when images contain embedded ROIs (e.g., from TIFF headers).

Author:
Tiago Ferreira
See Also:
  • Constructor Details

    • BinaryTracerFileCmd

      public BinaryTracerFileCmd()
  • Method Details

    • isFileMode

      protected boolean isFileMode()
      Description copied from class: BinaryTracerCommonCmd
      Returns whether this command operates in file mode (loading images from file paths) or in image-choice mode (selecting from open images).
      Specified by:
      isFileMode in class BinaryTracerCommonCmd
      Returns:
      true for file-based operation, false for choice-widget operation
    • run

      public void run()
      Specified by:
      run in interface org.scijava.module.MutableModule
      Specified by:
      run in interface Runnable
      Overrides:
      run in class CommonDynamicCmd
    • error

      protected void error(String msg)
      Overrides:
      error in class BinaryTracerCommonCmd
    • validateBeforeTracing

      protected boolean validateBeforeTracing(ij.gui.Roi roi, boolean inferRootFromRoi, boolean isSame, boolean isSegmented, boolean isValidOrigImg, boolean isSameDim, boolean isCompatible, boolean isValidConnectDist, boolean isValidRoi)
      Description copied from class: BinaryTracerCommonCmd
      Validates configuration before tracing begins. The default (non-interactive) implementation logs warnings and adjusts flags as needed without prompting the user. Interactive subclasses may override this to display a confirmation dialog.

      This method may modify BinaryTracerCommonCmd.connectComponents and BinaryTracerCommonCmd.ensureMaskImgVisibleOnAbort directly.

      Overrides:
      validateBeforeTracing in class BinaryTracerCommonCmd
      Parameters:
      roi - the active ROI (may be null)
      inferRootFromRoi - whether root inference from ROI is requested
      isSame - whether mask and original image are the same
      isSegmented - whether the mask image is binary/thresholded
      isValidOrigImg - whether the original image path is valid
      isSameDim - whether mask and original share dimensions
      isCompatible - whether images share spatial calibration
      isValidConnectDist - whether the max connection distance is valid
      isValidRoi - whether the ROI is a valid area ROI
      Returns:
      true to proceed with tracing, false to abort
    • handleTracedTrees

      protected void handleTracedTrees(List<Tree> trees)
      Description copied from class: BinaryTracerCommonCmd
      Called after tracing completes with valid trees. The default implementation honors BinaryTracerCommonCmd.afterTracingChoice: optionally replaces existing paths, assigns colors (per-tree "dim" palette when proofreading, inter-tree otherwise), adds trees via PathAndFillManager, and optionally calibrates the Curation Manager for proofreading. Subclasses may override to export trees to disk or adopt the mask image as tracing canvas.
      Overrides:
      handleTracedTrees in class BinaryTracerCommonCmd
      Parameters:
      trees - the traced trees (guaranteed non-null and non-empty)