[vtkusers] about vtkDijkstraGraphGeodesicPath

kenichiro yoshimi rccm.kyoshimi at gmail.com
Wed Oct 11 22:52:05 EDT 2017


Hi,

The vtkDijkstraGraphGeodesicPath filter seems to output a sorted point
set along the geodesic path. Hence, a straightforward way of getting
the distance is summing the lengths of each segment that makes up it.
---
pts = dijkstra.GetOutput().GetPoints()

p0 = [0,0,0]
p1 = [0,0,0]
dist = 0.0
for ptId in range(pts.GetNumberOfPoints()-1):
  pts.GetPoint(ptId, p0)
  pts.GetPoint(ptId+1, p1)
  dist += math.sqrt(vtk.vtkMath.Distance2BetweenPoints(p0, p1))

print(dist)
---

Regards

2017-10-12 2:12 GMT+09:00 Frédéric BRIEND <briend at cyceron.fr>:
> Hi,
>
> Sorry for the double post.
> Since the old post of Karthik, is there a way with
> "vtkDijkstraGraphGeodesicPath" to have the distance by GetGeodesicLength() ?
> How to do otherwise?
>
> Thanks in advance!
>
> My python script:
>
> cylinder= vtk.vtkSphereSource()
> cylinder.SetCenter(0.0, 0.0, 0.0)
> cylinder.SetRadius(0.5)
>
> dijkstra = vtk.vtkDijkstraGraphGeodesicPath()
> dijkstra.SetInputConnection(cylinder.GetOutputPort())
> dijkstra.SetStartVertex(4)
> dijkstra.SetEndVertex(28)
> dijkstra.Update()
>
> weights = vtk.vtkDoubleArray()
> size=dijkstra.GetCumulativeWeights(weights)
>
> print size
>
> I obtain for size: none
>
> --
>
> Frederic Briend
>
> PhD Candidate
>
> Université de Caen Normandie
>
> Laboratoire Imagerie et Stratégies Thérapeutiques de la Schizophrénie (ISTS,
> EA 7466)
>
> GIP CYCERON, Caen 14000, France
>
> Tel +33 2 31 47 01 56
>
> Email : briend at cyceron.fr
>
> http://www.ists.cyceron.fr/
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>


More information about the vtkusers mailing list