Package sc.fiji.snt

Class PathNodeCanvas

java.lang.Object
sc.fiji.snt.PathNodeCanvas

public class PathNodeCanvas extends Object
Convenience class used to render Path nodes (vertices) in an TracerCanvas.
Author:
Tiago Ferreira
  • Field Details

    • START

      public static final int START
      Flag describing a start point node
      See Also:
    • END

      public static final int END
      Flag describing an end point node
      See Also:
    • JOINT

      public static final int JOINT
      Flag describing a fork point node
      See Also:
    • SLAB

      public static final int SLAB
      Flag describing a slab node
      See Also:
    • HERMIT

      public static final int HERMIT
      Flag describing a single point path
      See Also:
    • SOMA_RENDER_DEFAULT

      public static final int SOMA_RENDER_DEFAULT
      Soma rendering mode: filled circle scaled to actual radius
      See Also:
    • SOMA_RENDER_TRIANGLE

      public static final int SOMA_RENDER_TRIANGLE
      Soma rendering mode: triangle scaled to actual radius (only for SWC_SOMA tagged paths)
      See Also:
  • Constructor Details

    • PathNodeCanvas

      public PathNodeCanvas(PointInImage pim, int index, TracerCanvas canvas)
      Creates a path node from a PointInImage.
      Parameters:
      pim - the position of the node (z-position ignored). Cannot be null.
      index - the index of this node within its path
      canvas - the canvas to render this node. Cannot be null.
      Throws:
      NullPointerException - if pim, pim.onPath, or canvas is null
    • PathNodeCanvas

      public PathNodeCanvas(Path path, int index, TracerCanvas canvas)
      Creates a node from a Path position.
      Parameters:
      path - the path holding this node. Cannot be null
      index - the position of this node within path
      canvas - the canvas to render this node. Cannot be null
  • Method Details

    • setSomaRenderMode

      public static void setSomaRenderMode(int mode)
      Sets the rendering mode for soma nodes (single-point paths).
      Parameters:
      mode - one of SOMA_RENDER_DEFAULT, or SOMA_RENDER_TRIANGLE
      Throws:
      IllegalArgumentException - if mode is not a valid rendering mode
    • getSomaRenderMode

      public static int getSomaRenderMode()
      Gets the current rendering mode for soma nodes.
      Returns:
      the current soma render mode
    • setShowDirectionArrows

      public static void setShowDirectionArrows(boolean show)
      Sets whether direction arrows should be displayed on paths. When enabled, small arrows are drawn at regular intervals along paths to indicate path direction (from start to end).
      Parameters:
      show - true to show direction arrows, false to hide them
    • isShowDirectionArrows

      public static boolean isShowDirectionArrows()
      Gets whether direction arrows are currently being displayed.
      Returns:
      true if direction arrows are shown
    • getSlice

      protected int getSlice()
    • getSize

      public double getSize()
      Returns:
      the rendering diameter of this node.
    • setSize

      public void setSize(double size)
      Parameters:
      size - the rendering diameter of this node. Set it to -1 to use the default value.
      See Also:
    • getType

      public int getType()
      Returns the type of node.
      Returns:
      the node type: PathNodeCanvas.END, PathNodeCanvas.JOINT, PathNodeCanvas.SLAB, etc.
    • setType

      public void setType(int type)
    • draw

      public void draw(Graphics2D g, Color fallbackColor)
      Draws this node.
      Parameters:
      g - the Graphics2D drawing instance
      fallbackColor - the rendering color of this node. Note that this parameter is ignored if a color has already been defined through Path.setNodeColors(Color[])
    • drawConnection

      protected void drawConnection(Graphics2D g, PathNodeCanvas other)
    • drawDirectionArrow

      protected void drawDirectionArrow(Graphics2D g, PathNodeCanvas next)
      Draws a direction arrow pointing from this node toward the next node. The arrow is drawn as a ">" symbol at the midpoint between nodes. Only draws if direction arrows are enabled and this is an appropriate node (every Nth node based on ARROW_INTERVAL).
      Parameters:
      g - the Graphics2D drawing instance
      next - the next node in the path (toward the end)
    • skipDiameterForDirectionArrows

      public boolean skipDiameterForDirectionArrows()
      Checks if direction arrows are enabled and this node should skip diameter rendering. When direction arrows are shown, diameter lines are hidden to reduce visual clutter.
      Returns:
      true if diameter rendering should be skipped
    • drawDiameter

      protected void drawDiameter(Graphics2D g2, int slice, int either_side)
    • isEditable

      public boolean isEditable()
      Returns:
      whether this node should be rendered as editable.
    • setEditable

      public void setEditable(boolean editable)
      Enables the node as editable/non-editable.
      Parameters:
      editable - true to render the node as editable.