[SOFA] Creation of new componeent responsible on translating the skeleton txt file into a vtk one - #1
Conversation
epernod
left a comment
There was a problem hiding this comment.
Why do you remove the 3 skeletons in txt ?
a few small remarks in the code to be changed.
| SkeletonReader(); | ||
| virtual ~SkeletonReader() = default; | ||
|
|
||
| void init() override; | ||
| void doUpdate() override; | ||
|
|
||
| void draw(const sofa::core::visual::VisualParams* vparams) override; |
There was a problem hiding this comment.
Those 3 methods need to be in public as they are overriding mother class
| { | ||
| if (d_inSkeletonFilename.getValue().empty()) | ||
| { | ||
| msg_error() << "No input skeleton file set, please set the 'filename' data."; |
There was a problem hiding this comment.
good practice is to add that before returning:
sofa::core::objectmodel::BaseObject::d_componentState.setValue(sofa::core::objectmodel::ComponentState::Invalid);
There was a problem hiding this comment.
in future version of SOFA we plan to generalise the check of this componentState, if a component is invalid we don't call it later in the simulation, etc...
There was a problem hiding this comment.
I'll take it into consideration.
| *.vtk | ||
| *.obj |
There was a problem hiding this comment.
no sure those should be there otherwise we will never be able to add new files
There was a problem hiding this comment.
Since we're not supposed to put big files in, i put them in the gitignore so they wouldn't be pushed in.
I had a lot of data.
1. Description
Adds a new
SkeletonReadercomponent toMeshSkeletonizationPlugin.It reads the polyline skeleton file produced by
MeshSkeletonizationand 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
.vtkfor visualization in ParaView.2. New features according to the 3 main classes
SkeletonNode: skeleton point as a data classPlain C++ class (no SOFA/CGAL dependency).
Stores id, 3D position,
parentIds/childrenIds, and optional mesh-correspondence fields (meshVertexId,distanceToMesh).SkeletonGraph: parsing + tree buildingloadFromFile(): 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, andtype/depth/is_loopscalars.SkeletonReader: SOFADataEnginewrapperExposes the above as scene Data fields (
filename,inputVertices,entryPointin;outputVTK,nodeCountout).Registered in
init.cppalongsideMeshSkeletonization.init()forces oneupdate()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.