Package sc.fiji.snt

Class SNT

All Implemented Interfaces:
HessianGenerationCallback, PaneOwner, SearchProgressCallback

Implements the SNT plugin.
Author:
Tiago Ferreira, Cameron Arshadi
  • Field Details

    • statusService

      protected org.scijava.app.StatusService statusService
    • verbose

      protected static boolean verbose
    • MIN_SNAP_CURSOR_WINDOW_XY

      protected static final int MIN_SNAP_CURSOR_WINDOW_XY
      See Also:
    • MIN_SNAP_CURSOR_WINDOW_Z

      protected static final int MIN_SNAP_CURSOR_WINDOW_Z
      See Also:
    • MAX_SNAP_CURSOR_WINDOW_XY

      protected static final int MAX_SNAP_CURSOR_WINDOW_XY
      See Also:
    • MAX_SNAP_CURSOR_WINDOW_Z

      protected static final int MAX_SNAP_CURSOR_WINDOW_Z
      See Also:
    • startBallName

      protected static final String startBallName
      See Also:
    • targetBallName

      protected static final String targetBallName
      See Also:
    • ballRadiusMultiplier

      protected static final int ballRadiusMultiplier
      See Also:
    • univ

      protected ij3d.Image3DUniverse univ
    • use3DViewer

      protected boolean use3DViewer
    • colorImage

      protected ij.ImagePlus colorImage
    • DISPLAY_PATHS_SURFACE

      protected static final int DISPLAY_PATHS_SURFACE
      See Also:
    • DISPLAY_PATHS_LINES

      protected static final int DISPLAY_PATHS_LINES
      See Also:
    • DISPLAY_PATHS_LINES_AND_DISCS

      protected static final int DISPLAY_PATHS_LINES_AND_DISCS
      See Also:
    • cursorSnapWindowXY

      protected volatile int cursorSnapWindowXY
    • cursorSnapWindowZ

      protected volatile int cursorSnapWindowZ
    • autoCanvasActivation

      protected volatile boolean autoCanvasActivation
    • panMode

      protected volatile boolean panMode
    • snapCursor

      protected volatile boolean snapCursor
    • showOnlySelectedPaths

      protected volatile boolean showOnlySelectedPaths
    • showOnlyActiveCTposPaths

      protected volatile boolean showOnlyActiveCTposPaths
    • activateFinishedPath

      protected volatile boolean activateFinishedPath
    • requireShiftToFork

      protected volatile boolean requireShiftToFork
    • autoCT

      protected volatile boolean autoCT
    • manualRadius

      protected double manualRadius
    • width

      protected int width
    • height

      protected int height
    • depth

      protected int depth
    • imageType

      protected int imageType
    • x_spacing

      protected double x_spacing
    • y_spacing

      protected double y_spacing
    • z_spacing

      protected double z_spacing
    • spacing_units

      protected String spacing_units
    • channel

      protected int channel
    • frame

      protected int frame
    • filterType

      protected SNT.FilterType filterType
    • searchImageType

      protected SNT.SearchImageType searchImageType
    • isUseSubVolumeStats

      protected volatile boolean isUseSubVolumeStats
    • oneMinusErfZFudge

      protected volatile double oneMinusErfZFudge
    • doSearchOnSecondaryData

      protected boolean doSearchOnSecondaryData
    • secondaryData

      protected net.imglib2.RandomAccessibleInterval secondaryData
    • secondaryImageFile

      protected File secondaryImageFile
    • tubularGeodesicsTracingEnabled

      protected boolean tubularGeodesicsTracingEnabled
    • tubularGeodesicsThread

      protected TubularGeodesicsTracer tubularGeodesicsThread
    • last_start_point_x

      protected double last_start_point_x
    • last_start_point_y

      protected double last_start_point_y
    • last_start_point_z

      protected double last_start_point_z
    • temporaryPath

      protected Path temporaryPath
    • currentPath

      protected Path currentPath
    • ui

      protected SNTUI ui
    • tracingHalted

      protected volatile boolean tracingHalted
    • rubberBandTracing

      protected volatile boolean rubberBandTracing
    • DEFAULT_SELECTED_COLOR

      protected static final Color DEFAULT_SELECTED_COLOR
    • DEFAULT_DESELECTED_COLOR

      protected static final Color DEFAULT_DESELECTED_COLOR
    • DEFAULT_SELECTED_COLOR3F

      protected static final org.jogamp.vecmath.Color3f DEFAULT_SELECTED_COLOR3F
    • DEFAULT_DESELECTED_COLOR3F

      protected static final org.jogamp.vecmath.Color3f DEFAULT_DESELECTED_COLOR3F
    • selectedColor3f

      protected org.jogamp.vecmath.Color3f selectedColor3f
    • deselectedColor3f

      protected org.jogamp.vecmath.Color3f deselectedColor3f
    • selectedColor

      protected Color selectedColor
    • deselectedColor

      protected Color deselectedColor
    • displayCustomPathColors

      protected boolean displayCustomPathColors
    • confirmedSegmentSizes

      protected final Deque<Integer> confirmedSegmentSizes
    • listeners

      protected List<SNTListener> listeners
  • Constructor Details

    • SNT

      public SNT(ij.ImagePlus sourceImage) throws IllegalArgumentException
      Script-friendly constructor for Instantiating and initializing SNT in 'Tracing Mode' (typically headless operations). The channel/frame to be traced is assumed to be the image's active CT position.

      Note that the image is not displayed. For interactive display of the image call initialize(ImagePlus)/startUI() directly.

      Parameters:
      sourceImage - the source image
      Throws:
      IllegalArgumentException - If sourceImage is of type 'RGB'
    • SNT

      public SNT(net.imagej.ImgPlus<T> sourceImage) throws IllegalArgumentException
      Script-friendly constructor for Instantiating SNT in 'Tracing Mode' (typically headless operations)
      Parameters:
      sourceImage - the source image
      Throws:
      IllegalArgumentException
    • SNT

      public SNT(net.imagej.ImgPlus<T> sourceImage, int channel, int timePoint) throws IllegalArgumentException
      Script-friendly constructor for Instantiating SNT in 'Tracing Mode' (typically headless operations)
      Parameters:
      sourceImage - the source image
      channel - channel index to extract (index 0)
      timePoint - time index to extract (index 0)
      Throws:
      IllegalArgumentException
    • SNT

      public SNT(org.scijava.Context context, ij.ImagePlus sourceImage) throws IllegalArgumentException
      Instantiates SNT in 'Tracing Mode'.
      Parameters:
      context - the SciJava application context providing the services required by the class
      sourceImage - the source image
      Throws:
      IllegalArgumentException - If sourceImage is of type 'RGB'
    • SNT

      public SNT(org.scijava.Context context, PathAndFillManager pathAndFillManager)
      Instantiates SNT in 'Analysis Mode'
      Parameters:
      context - the SciJava application context providing the services required by the class
      pathAndFillManager - The PathAndFillManager instance to be associated with the plugin
  • Method Details

    • undoLastSegment

      protected void undoLastSegment()
    • rebuildDisplayCanvases

      public void rebuildDisplayCanvases() throws IllegalArgumentException
      Rebuilds display canvases, i.e., the placeholder canvases used when no valid image data exists (a single-canvas is rebuilt if only the XY view is active).

      Useful when multiple files are imported and imported paths 'fall off' the dimensions of current canvas(es). If there is not enough memory to accommodate enlarged dimensions, the resulting canvas will be a 2D image.

      Throws:
      IllegalArgumentException - if valid image data exists
    • updateDisplayCanvases

      public void updateDisplayCanvases()
      Rebuilds display canvas(es) to ensure all paths are contained in the image. Does nothing if placeholder canvas(es) are not being used.
      See Also:
    • accessToValidImageData

      public boolean accessToValidImageData()
      Checks whether valid image data exists.
      Returns:
      true if a tracing image exists, or (for headless/API usage) cached pixel data remains in memory.
    • isDisplayCanvas

      protected boolean isDisplayCanvas(ij.ImagePlus imp)
    • isCachedData

      protected boolean isCachedData(ij.ImagePlus imp)
    • initialize

      public void initialize(ij.ImagePlus imp)
      Overrides:
      initialize in class MultiDThreePanes
    • initialize

      public void initialize(boolean singlePane, int channel, int frame)
      Initializes the plugin by assembling all the required tracing views
      Parameters:
      singlePane - if true only the XY view will be generated, if false XY, ZY, XZ views are created
      channel - the channel to be traced. Ignored when no valid image data exists.
      frame - the frame to be traced. Ignored when no valid image data exists.
    • initialize

      public void initialize(boolean singlePane, int channel, int frame, boolean computeStackStats)
    • reloadImage

      public void reloadImage(int channel, int frame)
    • rebuildZYXZpanes

      public void rebuildZYXZpanes()
    • startUI

      public void startUI()
    • loadTracings

      public boolean loadTracings(File file)
    • isUnsavedChanges

      protected boolean isUnsavedChanges()
    • setUnsavedChanges

      protected void setUnsavedChanges(boolean b)
    • getPathAndFillManager

      public PathAndFillManager getPathAndFillManager()
    • getSeedOverlay

      public SeedOverlay getSeedOverlay()
      Returns the SeedOverlay associated with this SNT instance. The overlay holds candidate SeedPoints (e.g., output of upstream point detectors) and is rendered on the tracing canvas when non-empty.

      The overlay is transient: it is automatically cleared when the active image changes (see initialize(ImagePlus)) and is not persisted with the .traces file. Importers should use SeedOverlay.addAll(java.util.Collection) for bulk loads.

      Returns:
      the seed overlay (never null)
    • getCanvas

      public TracerCanvas getCanvas(int pane)
    • getDataset

      public net.imagej.Dataset getDataset()
      Gets the Image being traced as Dataset. If the loaded image has been closed, cached pixel data is returned as per getLoadedDataAsImp(). Null is returned if no image exists.
    • getImagePlus

      public ij.ImagePlus getImagePlus()
      Gets the Image being traced. If the loaded image has been closed, cached pixel data is returned as per getLoadedDataAsImp(). Null is returned if no image exists.
    • getImpDiagonalLength

      protected double getImpDiagonalLength(boolean scaled, boolean xyOnly)
    • createCanvas

      public sc.fiji.snt.InteractiveTracerCanvas createCanvas(ij.ImagePlus imagePlus, int plane)
      Overrides:
      createCanvas in class MultiDThreePanes
    • dispose

      protected void dispose()
    • cancelSearch

      public void cancelSearch(boolean cancelFillToo)
    • threadStatus

      public void threadStatus(SearchInterface source, int status)
      Specified by:
      threadStatus in interface SearchProgressCallback
    • changeUIState

      public void changeUIState(int newState)
    • getUIState

      protected int getUIState()
    • saveFill

      protected void saveFill()
    • discardFill

      protected void discardFill()
    • stopFilling

      protected void stopFilling(boolean updateUIState)
    • stopFilling

      protected void stopFilling()
    • startFilling

      protected void startFilling()
    • addListener

      public void addListener(SNTListener listener)
    • notifyListeners

      public void notifyListeners(SNTEvent event)
    • anyListeners

      protected boolean anyListeners()
    • finished

      public void finished(SearchInterface source, boolean success)
      Specified by:
      finished in interface SearchProgressCallback
    • pointsInSearch

      public void pointsInSearch(SearchInterface source, long inOpen, long inClosed)
      Specified by:
      pointsInSearch in interface SearchProgressCallback
    • justDisplayNearSlices

      protected void justDisplayNearSlices(boolean value, int eitherSide)
    • uiReadyForModeChange

      protected boolean uiReadyForModeChange()
    • getEditingPath

      protected Path getEditingPath()
    • getPreviousEditingPath

      protected Path getPreviousEditingPath()
    • getEditingNode

      protected int getEditingNode()
    • editModeAllowed

      public boolean editModeAllowed()
      Assesses if activation of 'Edit Mode' is possible.
      Returns:
      true, if possible, false otherwise
    • editModeAllowed

      protected boolean editModeAllowed(boolean warnUserIfNot)
      Checks if edit mode can be enabled.
      Parameters:
      warnUserIfNot - if true, shows error messages when edit mode is not allowed
      Returns:
      true if edit mode is allowed, false otherwise
    • editModeAllowed

      protected boolean editModeAllowed(boolean warnUserIfNot, Path pathToEdit)
      Checks if edit mode can be enabled, optionally using a specific path.
      Parameters:
      warnUserIfNot - if true, shows error messages when edit mode is not allowed
      pathToEdit - the path to edit, or null to auto-detect from selection
      Returns:
      true if edit mode is allowed, false otherwise
    • isEditingFittedPath

      protected boolean isEditingFittedPath()
      Returns whether the path currently being edited is displayed as its fitted version. Callers should use this to guard edit operations that cannot meaningfully propagate between fitted and unfitted representations (e.g., structural edits such as insert/delete, or tree-level operations like split/re-root).
      Returns:
      true if the editing path is in fitted-display mode
    • setEditingPath

      protected void setEditingPath(Path path)
    • detectEditingPath

      protected void detectEditingPath()
    • getSingleSelectedPath

      protected Path getSingleSelectedPath()
    • enableEditMode

      protected void enableEditMode(boolean enable)
    • pause

      protected void pause(boolean pause, boolean hideSideViewsOnPause)
    • pauseTracing

      protected void pauseTracing(boolean pause, boolean validateChange)
    • isEditModeEnabled

      protected boolean isEditModeEnabled()
    • updateCursor

      protected void updateCursor(double new_x, double new_y, double new_z)
    • loadLabelsFile

      public void loadLabelsFile(String path)
    • loadTracesFile

      protected boolean loadTracesFile(File file)
      Assumes UI is available
    • loadSWCFile

      protected boolean loadSWCFile(File file)
    • mouseMovedTo

      public void mouseMovedTo(double x_in_pane, double y_in_pane, int in_plane, boolean sync_panes_modifier_down, boolean join_modifier_down)
    • setTemporaryPath

      public void setTemporaryPath(Path path)
    • setCurrentPath

      public void setCurrentPath(Path path)
    • getCurrentPath

      public Path getCurrentPath()
    • setPathUnfinished

      protected void setPathUnfinished(boolean unfinished)
    • makePathVolume

      public ij.ImagePlus makePathVolume(Collection<Path> paths, boolean labelsImage)
      Rasterizes centerline of paths into an ImagePlus
      Parameters:
      labelsImage - If true, each path has a unique intensity; otherwise all nodes are set to 255 (8-bit Binary)
      Returns:
      the ImagePlus with embedded centerlines
    • startRubberBandSearch

      protected void startRubberBandSearch(double x_in_pane, double y_in_pane, int plane)
    • computeImgStats

      protected <T extends net.imglib2.type.numeric.RealType<T>> ij.process.ImageStatistics computeImgStats(Iterable<T> in, ij.process.ImageStatistics imgStats)
    • computeImgStats

      public <T extends net.imglib2.type.numeric.RealType<T>> ij.process.ImageStatistics computeImgStats(Iterable<T> in, ij.process.ImageStatistics imgStats, SNT.CostType costType)
    • confirmTemporary

      public void confirmTemporary(boolean updateTracingViewers)
    • cancelTemporary

      public void cancelTemporary()
    • cancelPath

      public void cancelPath()
      Cancels the temporary path.
    • startHessian

      @Deprecated public void startHessian(String image, double sigma, double max, boolean wait)
      Deprecated.
      Constructs and enables a lazy instance of a Tubeness filter. The image is filtered locally during path searches. Filtered data is stored in a disk cache when memory runs full. This method is slated for redesign.
      Parameters:
      image - the image to filter, either "primary" or "secondary".
      sigma - the scale parameter for the Tubeness filter, in physical units.
      max - the maximum pixel intensity in the Tubeness image beyond which the cost function of the A* search is minimized.
      wait - this parameter does nothing.
    • startHessian

      public <T extends net.imglib2.type.numeric.RealType<T>> void startHessian(String image, String filter, double[] scales, String strategy, int nThreads)
      Constructs and enables an instance of a hessian eigenvalue filter. If the strategy is "preprocess", the entire filtered image, including intensity statistics, are pre-computed and stored in memory. If the strategy is "lazy", the image is filtered and measured locally during path searches, and filtered data is stored in a disk cache when memory runs full. If you are tracing over a large image or if you are in a memory-limited environment, you should choose "lazy".
      Type Parameters:
      T -
      Parameters:
      image - the image to filter, either "primary" or "secondary".
      filter - the hessian filter type, either "tubeness" or "frangi"
      scales - the scale parameters for the Hessian filter, in physical units. Computation time increases linearly with the number of scales.
      strategy - either "lazy" or "preprocess"
      nThreads - number of threads to use in the computation
    • startHessian

      public <T extends net.imglib2.type.numeric.RealType<T>> void startHessian(String image, String filter, double[] scales, double min, double max, String strategy, int nThreads)
      Constructs and enables an instance of a hessian eigenvalue filter. If the strategy is "preprocess", the entire filtered image is pre-computed and stored in memory. If the strategy is "lazy", the image is filtered locally during path searches, and filtered data is stored in a disk cache when memory runs full. If you are tracing over a large image or if you are in a memory-limited environment, you should choose "lazy".
      Type Parameters:
      T -
      Parameters:
      image - the image to filter, either "primary" or "secondary".
      filter - the hessian filter type, either "tubeness" or "frangi"
      scales - the scale parameters for the Hessian filter, in physical units. Computation time increases linearly with the number of scales.
      min - the minimum pixel intensity in the filtered image beyond which the cost function of the A* search is maximized.
      max - the maximum pixel intensity in the filtered image beyond which the cost function of the A* search is minimized.
      strategy - either "lazy" or "preprocess"
      nThreads - number of threads to use in the computation
    • autoTrace

      public Path autoTrace(SNTPoint start, SNTPoint end, PointInImage forkPoint)
      Automatically traces a path from a point A to a point B. See autoTrace(List, PointInImage) for details.
      Parameters:
      start - the PointInImage the starting point of the path
      end - the PointInImage the terminal point of the path
      forkPoint - the PointInImage fork point of the parent Path from which the searched path should branch off, or null if the path should not have any parent.
      Returns:
      the path a reference to the computed path.
      See Also:
    • autoTrace

      public Path autoTrace(SNTPoint start, SNTPoint end, PointInImage forkPoint, boolean headless)
      Automatically traces a path from a point A to a point B. See autoTrace(List, PointInImage) for details.
      Parameters:
      start - the PointInImage the starting point of the path
      end - the PointInImage the terminal point of the path
      forkPoint - the PointInImage fork point of the parent Path from which the searched path should branch off, or null if the path should not have any parent.
      headless - whether search should occur headless
      Returns:
      the path a reference to the computed path.
      See Also:
    • autoTrace

      public Path autoTrace(List<SNTPoint> pointList, PointInImage forkPoint)
      Automatically traces a path from a list of points and adds it to the active PathAndFillManager instance. Note that this method still requires SNT's UI. For headless auto-tracing have a look at TracerThread.

      SNT's UI will remain blocked in "search mode" until the Path computation completes. Tracing occurs through the active SearchInterface selected in the UI, i.e., TracerThread (the default A* search), TubularGeodesicsTracer, etc.

      All input PointInImage must be specified in real world coordinates.

      Parameters:
      pointList - the list of PointInImage containing the nodes to be used as target goals during the search. If the search cannot converge into a target point, such point is omitted from path, if Successful, target point will be included in the final path. The final path. The first point in the list is the start of the path, the last its terminus. Null objects not allowed.
      forkPoint - the PointInImage fork point of the parent Path from which the searched path should branch off, or null if the path should not have any parent.
      Returns:
      the path a reference to the computed path. It is added to the Path Manager list. If a path cannot be fully computed from the specified list of points, a single-point path is generated.
    • autoTrace

      public Path autoTrace(List<SNTPoint> pointList, PointInImage forkPoint, boolean headless)
      Automatically traces a path from a point A to a point B. See autoTrace(List, PointInImage) for details.
      Parameters:
      pointList - the list of PointInImage containing the nodes to be used as target goals during the search. If the search cannot converge into a target point, such point is omitted from path, if Successful, target point will be included in the final path. The final path. The first point in the list is the start of the path, the last its terminus. Null objects not allowed.
      forkPoint - the PointInImage fork point of the parent Path from which the searched path should branch off, or null if the path should not have any parent.
      headless - whether search should occur headless
      Returns:
      the path a reference to the computed path.
      See Also:
    • replaceCurrentPath

      protected void replaceCurrentPath(Path path)
    • finishedPath

      protected void finishedPath()
    • clickForTrace

      protected void clickForTrace(org.jogamp.vecmath.Point3d p, boolean join)
    • clickForTrace

      protected void clickForTrace(double world_x, double world_y, double world_z, boolean join)
    • clickForTrace

      protected void clickForTrace(double x_in_pane_precise, double y_in_pane_precise, int plane, boolean join)
    • setFillThresholdFrom

      public void setFillThresholdFrom(double world_x, double world_y, double world_z)
    • setFillThreshold

      public void setFillThreshold(double distance) throws IllegalArgumentException
      Sets the fill threshold distance. Typically, this value is set before a filling operation as a starting value for the FillerThread.
      Parameters:
      distance - the new threshold distance. Set it to -1 to use SNT's default.
      Throws:
      IllegalArgumentException - If distance is not a valid positive value
    • getFillThreshold

      public double getFillThreshold()
    • setStoreExtraFillNodes

      public void setStoreExtraFillNodes(boolean storeExtraFillNodes)
    • setStopFillAtThreshold

      public void setStopFillAtThreshold(boolean stopFillAtThreshold)
    • addSphere

      protected void addSphere(String name, double x, double y, double z, Color color, double radius)
    • removeSphere

      protected void removeSphere(String name)
    • startSholl

      protected void startSholl(PointInImage centerScaled)
    • getFilledBinaryImp

      public ij.ImagePlus getFilledBinaryImp()
    • getFilledImp

      public <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus getFilledImp()
    • getFilledDistanceImp

      public ij.ImagePlus getFilledDistanceImp()
    • getFilledLabelImp

      public <T extends net.imglib2.type.numeric.IntegerType<T>> ij.ImagePlus getFilledLabelImp()
    • guessResamplingFactor

      protected int guessResamplingFactor()
    • isUIready

      protected boolean isUIready()
    • addFillerThread

      public void addFillerThread(FillerThread filler)
    • initPathsToFill

      public void initPathsToFill(Set<Path> fromPaths, boolean splitFillerThreads)
    • invalidStatsError

      protected <T extends net.imglib2.type.numeric.RealType<T>> boolean invalidStatsError(boolean isSecondary)
    • setFillTransparent

      protected void setFillTransparent(boolean transparent)
    • getMinimumSeparation

      public double getMinimumSeparation()
    • getAverageSeparation

      public double getAverageSeparation()
    • getLoadedDataAsImp

      public <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus getLoadedDataAsImp()
      Retrieves the pixel data of the main image currently loaded in memory as an ImagePlus object. Returned image is always a single channel image.
      Returns:
      the loaded data corresponding to the C,T position currently being traced, or null if no image data has been loaded into memory.
    • getLoadedData

      public <T extends net.imglib2.type.numeric.RealType<T>> net.imglib2.RandomAccessibleInterval<T> getLoadedData()
    • getLoadedDataAsImg

      public net.imagej.ImgPlus<?> getLoadedDataAsImg(boolean secondaryLayer)
    • getLoadedIterable

      public <T> net.imglib2.IterableInterval getLoadedIterable()
    • getFilteredImageFile

      protected File getFilteredImageFile()
      Returns the file of the 'secondary image', if any.
      Returns:
      the secondary image file, or null if no file has been set
    • isSecondaryDataAvailable

      public boolean isSecondaryDataAvailable()
      Assesses if the 'secondary image' has been loaded into memory. Note that while some tracer Threads will load the image into memory, others may waive the loading to third party libraries
      Returns:
      true, if image has been loaded into memory.
    • isSecondaryImageFileLoaded

      protected boolean isSecondaryImageFileLoaded()
    • isTracingOnSecondaryImageAvailable

      protected boolean isTracingOnSecondaryImageAvailable()
    • setSecondaryImage

      public void setSecondaryImage(File file)
      Specifies the 'secondary image' to be used during a tracing session.
      Parameters:
      file - The file containing the 'secondary image'
    • loadSecondaryImage

      public void loadSecondaryImage(File file) throws IOException, IllegalArgumentException
      Loads the 'secondary image' specified by setSecondaryImage(File) into memory as 32-bit data.
      Parameters:
      file - The file to be loaded
      Throws:
      IOException - If image could not be loaded
      IllegalArgumentException - if dimensions are unexpected, or image type is not supported
      See Also:
    • loadSecondaryImage

      public void loadSecondaryImage(ij.ImagePlus imp) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • loadSecondaryImage

      public <T extends net.imglib2.type.numeric.RealType<T>> void loadSecondaryImage(net.imglib2.RandomAccessibleInterval<T> img, boolean computeStatistics)
    • setSecondaryImageMinMax

      public void setSecondaryImageMinMax(double min, double max)
    • getSecondaryImageMinMax

      public double[] getSecondaryImageMinMax()
    • loadSecondaryImage

      protected void loadSecondaryImage(ij.ImagePlus imp, boolean changeUIState)
    • loadSecondaryImage

      protected <T extends net.imglib2.type.numeric.RealType<T>> void loadSecondaryImage(net.imglib2.RandomAccessibleInterval<T> img, boolean changeUIState, boolean computeStatistics)
    • enableSecondaryLayerTracing

      public void enableSecondaryLayerTracing(boolean enable)
    • flushSecondaryData

      public void flushSecondaryData()
    • getSecondaryDataAsImp

      public <T extends net.imglib2.type.numeric.NumericType<T>> ij.ImagePlus getSecondaryDataAsImp()
      Retrieves the 'secondary image' data currently loaded in memory as an ImagePlus object. Returned image is always of 32-bit type.
      Returns:
      the loaded data or null if no image has been loaded.
      See Also:
    • getSecondaryData

      public <T extends net.imglib2.type.numeric.RealType<T>> net.imglib2.RandomAccessibleInterval<T> getSecondaryData()
    • getPrefs

      public SNTPrefs getPrefs()
    • proportionDone

      public void proportionDone(double proportion)
      Specified by:
      proportionDone in interface HessianGenerationCallback
    • showCorrespondencesTo

      @Deprecated public void showCorrespondencesTo(File tracesFile, Color c, double maxDistance)
      Deprecated.
    • setShowOnlySelectedPaths

      protected void setShowOnlySelectedPaths(boolean showOnlySelectedPaths, boolean updateGUI)
    • setShowOnlyActiveCTposPaths

      protected void setShowOnlyActiveCTposPaths(boolean showOnlyActiveCTposPaths, boolean updateGUI)
    • setShowOnlySelectedPaths

      public void setShowOnlySelectedPaths(boolean showOnlySelectedPaths)
    • getImagePlus

      public ij.ImagePlus getImagePlus(int pane)
      Gets the Image associated with a view pane.
      Parameters:
      pane - the flag specifying the view either MultiDThreePanes.XY_PLANE, MultiDThreePanes.XZ_PLANE or MultiDThreePanes.ZY_PLANE.
      Returns:
      the image associate with the specified view, or null if the view is not available. If the view is XY_PLANE, and the image has been closed, cached pixel data is returned as per getLoadedDataAsImp()
    • error

      protected void error(String msg)
    • showMessage

      protected void showMessage(String msg, String title)
    • getTracingCanvas

      protected sc.fiji.snt.InteractiveTracerCanvas getTracingCanvas()
    • getActiveWindow

      protected Component getActiveWindow()
    • isOnlySelectedPathsVisible

      public boolean isOnlySelectedPathsVisible()
    • updateTracingViewers

      protected void updateTracingViewers(boolean includeLegacy3Dviewer)
    • updateNonTracingViewers

      protected void updateNonTracingViewers()
    • updateAllViewers

      public void updateAllViewers()
    • get3DUniverse

      @Deprecated protected ij3d.Image3DUniverse get3DUniverse()
      Deprecated.
      Gets the instance of the legacy 3D viewer universe. Note that the legacy 3D viewer is now deprecated.
      Returns:
      a reference to the 3DUniverse or null if no universe has been set
    • set3DUniverse

      protected void set3DUniverse(ij3d.Image3DUniverse universe)
    • updateImageContent

      @Deprecated protected void updateImageContent(int resamplingFactor)
      Deprecated.
    • setSelectedColor

      protected void setSelectedColor(Color newColor)
    • setDeselectedColor

      protected void setDeselectedColor(Color newColor)
    • setColorImage

      @Deprecated protected void setColorImage(ij.ImagePlus newColorImage)
      Deprecated.
    • setPaths3DDisplay

      @Deprecated protected void setPaths3DDisplay(int paths3DDisplay)
      Deprecated.
    • getPaths3DDisplay

      @Deprecated protected int getPaths3DDisplay()
      Deprecated.
    • selectPath

      public void selectPath(Path p, boolean addToExistingSelection)
    • getSelectedPaths

      public Collection<Path> getSelectedPaths()
    • setPathList

      public void setPathList(List<Path> pathList, Path justAdded, boolean expandAll)
    • setFillList

      public void setFillList(List<Fill> fillList)
    • setSelectedPaths

      public void setSelectedPaths(Collection<Path> selectedPathsSet, Object source)
    • findSnappingPointInXView

      protected void findSnappingPointInXView(double x_in_pane, double y_in_pane, double[] point)
    • clickAtMaxPoint

      protected void clickAtMaxPoint(int x_in_pane, int y_in_pane, int plane, boolean join)
    • showMIPOverlays

      public void showMIPOverlays(double opacity)
      Overlays a semi-transparent MIP (8-bit scaled) of the data being traced over the tracing canvas(es). Does nothing if image is 2D. Note that with multidimensional images, only the C,T position being traced is projected.
      Parameters:
      opacity - (alpha), in the range 0.0-1.0, where 0.0 is none (fully transparent) and 1.0 is fully opaque. Setting opacity to zero clears previous MIPs.
    • showMIPOverlays

      protected void showMIPOverlays(boolean filteredData, double opacity)
    • discreteMsg

      protected void discreteMsg(String msg)
    • showCanvasWarning

      protected void showCanvasWarning(String msg, int durationMs)
      Displays a timed warning (amber background) on the canvas banner.
      Parameters:
      msg - the warning text, or null to clear immediately
      durationMs - how long the label stays visible (milliseconds)
    • showCanvasWarning

      protected void showCanvasWarning(String msg)
      See Also:
    • showCanvasInfo

      protected void showCanvasInfo(String msg, int durationMs)
      Displays a timed informational message (blue background) on the canvas banner. Use for confirmations, status updates, and non-critical feedback.
      Parameters:
      msg - the info text, or null to clear immediately
      durationMs - how long the label stays visible (milliseconds)
    • showCanvasInfo

      protected void showCanvasInfo(String msg)
      See Also:
    • getConfirmation

      protected boolean getConfirmation(String msg, String title)
    • toggleSnapCursor

      protected void toggleSnapCursor()
    • setAnnotationsVisible

      public void setAnnotationsVisible(boolean visible)
      Enables/Disables SNT overlays over tracing views. Note that disabling overlays will also suppress most GUI-related operations.
      Parameters:
      visible - whether overlays should be rendered
    • enableSnapCursor

      public void enableSnapCursor(boolean enable)
      Enables SNT's XYZ snap cursor feature. Does nothing if no image data is available or currently loaded image is binary
      Parameters:
      enable - whether cursor snapping should be enabled
    • enableAutoActivation

      public void enableAutoActivation(boolean enable)
    • enableAutoSelectionOfFinishedPath

      public void enableAutoSelectionOfFinishedPath(boolean enable)
    • isTracingOnSecondaryImageActive

      public boolean isTracingOnSecondaryImageActive()
    • enableAstar

      public void enableAstar(boolean enable)
      Toggles the A* search algorithm (enabled by default)
      Parameters:
      enable - true to enable A* search, false otherwise
    • isAstarEnabled

      public boolean isAstarEnabled()
      Checks if A* search is enabled
      Returns:
      true, if A* search is enabled, otherwise false
    • is2D

      public boolean is2D()
      Returns:
      true if the image currently loaded does not have a depth (Z) dimension
    • setDrawDiameters

      public void setDrawDiameters(boolean draw)
    • getDrawDiameters

      public boolean getDrawDiameters()
    • closeAndResetAllPanes

      public void closeAndResetAllPanes()
      Overrides:
      closeAndResetAllPanes in class MultiDThreePanes
    • getContext

      public org.scijava.Context getContext()
    • getUI

      public SNTUI getUI()
      Gets the main UI.
      Returns:
      the main dialog of SNT's UI
    • showStatus

      public void showStatus(int progress, int maximum, String status)
      Description copied from interface: PaneOwner
      Shows a status message with progress information.
      Specified by:
      showStatus in interface PaneOwner
      Overrides:
      showStatus in class MultiDThreePanes
      Parameters:
      progress - the current progress value
      maximum - the maximum progress value
      status - the status message to display
    • getOneMinusErfZFudge

      protected double getOneMinusErfZFudge()
    • getStats

      public ij.process.ImageStatistics getStats()
    • getStatsSecondary

      public ij.process.ImageStatistics getStatsSecondary()
    • setUseSubVolumeStats

      public void setUseSubVolumeStats(boolean useSubVolumeStatistics)
    • getUseSubVolumeStats

      public boolean getUseSubVolumeStats()
    • getSearchType

      public SNT.SearchType getSearchType()
    • setSearchType

      public void setSearchType(SNT.SearchType searchType)
    • getCostType

      public SNT.CostType getCostType()
    • setCostType

      public void setCostType(SNT.CostType costType)
    • getHeuristicType

      public SNT.HeuristicType getHeuristicType()
    • setHeuristicType

      public void setHeuristicType(SNT.HeuristicType heuristicType)
    • getSearchImageType

      public SNT.SearchImageType getSearchImageType()
    • setSearchImageType

      public void setSearchImageType(SNT.SearchImageType searchImageType)
    • getFilterType

      public SNT.FilterType getFilterType()
    • setFilterType

      public void setFilterType(SNT.FilterType filterType)
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • getDepth

      public int getDepth()
    • getPixelWidth

      public double getPixelWidth()
    • getPixelHeight

      public double getPixelHeight()
    • getPixelDepth

      public double getPixelDepth()
    • getSpacingUnits

      public String getSpacingUnits()
    • getChannel

      public int getChannel()
    • getFrame

      public int getFrame()
    • captureView

      public ij.ImagePlus captureView(String view, boolean project)
      Retrieves a WYSIWYG 'snapshot' of a tracing canvas.
      Parameters:
      view - A case-insensitive string specifying the canvas to be captured. Either "xy" (or "main"), "xz", "zy" or "3d" (for legacy's 3D Viewer).
      project - whether the snapshot of 3D image stacks should include its projection (MIP), or just the current plane
      Returns:
      the snapshot capture of the canvas as an RGB image
      Throws:
      UnsupportedOperationException - if SNT is not running
      IllegalArgumentException - if view is not a recognized option
    • captureView

      public ij.ImagePlus captureView(String view, org.scijava.util.ColorRGB backgroundColor) throws IllegalArgumentException
      Retrieves a WYSIWYG 'snapshot' of a tracing canvas without voxel data.
      Parameters:
      view - A case-insensitive string specifying the canvas to be captured. Either "xy" (or "main"), "xz", "zy" or "3d" (for legacy's 3D Viewer).
      backgroundColor - the background color of the canvas (string, hex, or html)
      Returns:
      the snapshot capture of the canvas as an RGB image
      Throws:
      UnsupportedOperationException - if SNT is not running
      IllegalArgumentException - if view or backgroundColor are not recognized
    • getCalibration

      public ij.measure.Calibration getCalibration()