Package sc.fiji.snt
Class PathNodeCanvas
java.lang.Object
sc.fiji.snt.PathNodeCanvas
Convenience class used to render
Path nodes (vertices) in an
TracerCanvas.- Author:
- Tiago Ferreira
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFlag describing an end point nodestatic final intFlag describing a single point pathstatic final intFlag describing a fork point nodestatic final intFlag describing a slab nodestatic final intSoma rendering mode: filled circle scaled to actual radiusstatic final intSoma rendering mode: triangle scaled to actual radius (only for SWC_SOMA tagged paths)static final intFlag describing a start point node -
Constructor Summary
ConstructorsConstructorDescriptionPathNodeCanvas(Path path, int index, TracerCanvas canvas) Creates a node from a Path position.PathNodeCanvas(PointInImage pim, int index, TracerCanvas canvas) Creates a path node from aPointInImage. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(Graphics2D g, Color fallbackColor) Draws this node.protected voiddrawConnection(Graphics2D g, PathNodeCanvas other) protected voiddrawDiameter(Graphics2D g2, int slice, int either_side) protected voiddrawDirectionArrow(Graphics2D g, PathNodeCanvas next) Draws a direction arrow pointing from this node toward the next node.doublegetSize()protected intgetSlice()static intGets the current rendering mode for soma nodes.intgetType()Returns the type of node.booleanstatic booleanGets whether direction arrows are currently being displayed.voidsetEditable(boolean editable) Enables the node as editable/non-editable.static voidsetShowDirectionArrows(boolean show) Sets whether direction arrows should be displayed on paths.voidsetSize(double size) static voidsetSomaRenderMode(int mode) Sets the rendering mode for soma nodes (single-point paths).voidsetType(int type) booleanChecks if direction arrows are enabled and this node should skip diameter rendering.
-
Field Details
-
START
public static final int STARTFlag describing a start point node- See Also:
-
END
public static final int ENDFlag describing an end point node- See Also:
-
JOINT
public static final int JOINTFlag describing a fork point node- See Also:
-
SLAB
public static final int SLABFlag describing a slab node- See Also:
-
HERMIT
public static final int HERMITFlag describing a single point path- See Also:
-
SOMA_RENDER_DEFAULT
public static final int SOMA_RENDER_DEFAULTSoma rendering mode: filled circle scaled to actual radius- See Also:
-
SOMA_RENDER_TRIANGLE
public static final int SOMA_RENDER_TRIANGLESoma rendering mode: triangle scaled to actual radius (only for SWC_SOMA tagged paths)- See Also:
-
-
Constructor Details
-
PathNodeCanvas
Creates a path node from aPointInImage.- Parameters:
pim- the position of the node (z-position ignored). Cannot be null.index- the index of this node within its pathcanvas- the canvas to render this node. Cannot be null.- Throws:
NullPointerException- if pim, pim.onPath, or canvas is null
-
PathNodeCanvas
Creates a node from a Path position.- Parameters:
path- the path holding this node. Cannot be nullindex- the position of this node within pathcanvas- 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 ofSOMA_RENDER_DEFAULT, orSOMA_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
Draws this node.- Parameters:
g- the Graphics2D drawing instancefallbackColor- the rendering color of this node. Note that this parameter is ignored if a color has already been defined throughPath.setNodeColors(Color[])
-
drawConnection
-
drawDirectionArrow
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 instancenext- 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
-
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.
-