Hi Bernardo,
there’s a class that you can use, both from C++ or Python, but there isn’t a script for that.
I suggest you look into vtkVmtk/ComputationalGeometry/vtkvmtkPolyDataCenterlines.cxx, but here’s a sketch:
make sure you define a point array on a surface, which will be your cost function defined over the surface; let’s say this point array is called “Cost”. Then:
- in C++:
#include “vtkIdList.h”
#include “vtkvmtkNonManifoldFastMarching.h"
vtkIdList* seeds = vtkIdList::New();
seeds->SetId(1234); // this is the id of the point you want to start the propagation
vtkvmtkNonManifoldFastMarching* fastMarching = vtkvmtkNonManifoldFastMarching::New();
fastMarching->SetInput(surface);
fastMarching->SetCostFunctionArrayName(“Cost");
fastMarching->SetSolutionArrayName(“Solution");
fastMarching->SeedsBoundaryConditionsOn();
fastMarching->SetSeeds(seeds);
fastMarching->Update();
In python it’s essentially the same thing:
import vtk
from vmtk import vtkvmtk
seeds = vtk.vtkIdList()
seeds.SetId(1234)
fastMarching = vtkvmtk.vtkvmtkNonManifoldFastMarching()
fastMarching.SetInput(surface)
fastMarching.SetCostFunctionArrayName(“Cost")
fastMarching.SetSolutionArrayName(“Solution")
fastMarching.SeedsBoundaryConditionsOn()
fastMarching.SetSeeds(seeds)
fastMarching.Update()
Best,
Luca