Skip to content

[New Component] Addition of new methods based on jira issue number 105 - #2

Open
bouamarakamelia wants to merge 3 commits into
masterfrom
dev_kamelia_new_methods_to_comp
Open

[New Component] Addition of new methods based on jira issue number 105#2
bouamarakamelia wants to merge 3 commits into
masterfrom
dev_kamelia_new_methods_to_comp

Conversation

@bouamarakamelia

Copy link
Copy Markdown

1. Description

Extends SkeletonGraph/SkeletonReader with node-level query methods (parents, children, path from root, subtree) and a new human-readable CSV export, so the skeleton tree can be inspected per-node without needing ParaView or writing custom code.

2. Newest features

node(nodeId) : safe lookup by id

  • Bounds-checked accessor into m_nodes.
  • Returns nullptr for an invalid id instead of crashing.
  • Is the foundation every other new method builds on.

parentsOf(nodeId) / childrenOf(nodeId)

  • Direct accessors returning a node's parent/children id lists.
  • Invalid id → empty vector, not a crash.
  • Thin wrappers around node().

pathFromRoot(nodeId)

  • Walks each node's primary parent (parentIds().front()) back to the root, then reverses the result to get root → ... → nodeId, inclusive.
  • Guards against a cyclic parent chain with a visited-set check, bailing out to an empty path rather than looping forever.

subtree(nodeId)

  • Breadth-first traversal outward through childrenIds, collecting every node reachable from nodeId (itself included).
  • Correctly reflects loop edges: a node that gained an extra child from a loop is not treated as a dead end.

exportReportCSV(filename)

  • Writes one row per node: id, x, y, z, parentId, childrenIds, pathFromRoot, loopParentIds. parentId is the single primary (tree) parent for the common case; any extra parent from a loop-closing node is kept in a separate loopParentIds column so nothing is silently dropped.
  • Wired into SkeletonReader as a new output Data field, outputReport.

3. Results

  • exportReportCSV compiled and run for real against what we have;
  • output matches expected values exactly, e.g.:
    id,x,y,z,parentId,childrenIds,pathFromRoot,loopParentIds
    2,0.0,0.0,2.0,1,"3;5","0;1;2",""
    6,-2.0,0.0,4.0,5,"","0;1;2;5;6","4"
    
  • Wired into the scene via outputReport="report.csv" on <SkeletonReader/>, no other component or file affected.
image

4. Example of the componenet in the scene (use case)

        <SkeletonReader name="reader"
            filename="outputfilefromtheMeshSkeletonizationOutput.txt"
            inputVertices="@loader.position"
            outputVTK="output.vtk"
            outputReport="output.csv" />

@epernod epernod added pr: clean pr: enhancement pr: status to review To notify reviewers to review this pull-request labels Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: clean pr: enhancement pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants