Skip to content

[SOFA] Creation of new componeent responsible on translating the skeleton txt file into a vtk one - #1

Open
bouamarakamelia wants to merge 2 commits into
masterfrom
dev_kamelia_new_comp_vtk_export
Open

[SOFA] Creation of new componeent responsible on translating the skeleton txt file into a vtk one#1
bouamarakamelia wants to merge 2 commits into
masterfrom
dev_kamelia_new_comp_vtk_export

Conversation

@bouamarakamelia

Copy link
Copy Markdown

1. Description

Adds a new SkeletonReader component to MeshSkeletonizationPlugin.
It reads the polyline skeleton file produced by MeshSkeletonization and rebuilds it in memory as a proper node graph
(id, parents, children, mesh correspondence), rooted as a tree from a chosen entry point, and exportable as .vtk for visualization in ParaView.

2. New features according to the 3 main classes

SkeletonNode : skeleton point as a data class

Plain C++ class (no SOFA/CGAL dependency).
Stores id, 3D position, parentIds/childrenIds, and optional mesh-correspondence fields (meshVertexId, distanceToMesh).

SkeletonGraph : parsing + tree building

  • loadFromFile(): parses the polyline text format, merges coincident points into one node.
  • buildTree(): BFS from an entry point, fills parent/child ids, flags loop/anastomosis (when veins loop over each other) edges instead of dropping or duplicating them.
  • computeMeshCorrespondence(): links each node to its closest mesh vertex.
  • exportToVTK(): writes points, tree-edge lines, and type/depth/is_loop scalars.

SkeletonReader : SOFA DataEngine wrapper

Exposes the above as scene Data fields (filename, inputVertices, entryPoint in; outputVTK, nodeCount out).
Registered in init.cpp alongside MeshSkeletonization.
init() forces one update() pass so it also runs correctly in batch mode, not just when a GUI happens to read its outputs.

3. Results

A comparison window between the txt file output on SOFA and the vtk file output dependent from MeshSkeletonization plugin on the left opened in 3DSlicer.

image

@bouamarakamelia
bouamarakamelia requested a review from epernod August 7, 2026 10:57
@bouamarakamelia bouamarakamelia self-assigned this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant