[vtkusers] about vtkDijkstraGraphGeodesicPath
Frédéric BRIEND
briend at cyceron.fr
Tue Oct 17 10:49:26 EDT 2017
Indeed, thanks a lot!
Frederic
Le 17/10/2017 à 16:40, Bill Lorensen a écrit :
> Should be:
> appendFilter.AddInputConnection(dijkstra.GetOutputPort())
>
> On Tue, Oct 17, 2017 at 7:30 AM, Frédéric BRIEND <briend at cyceron.fr
> <mailto:briend at cyceron.fr>> wrote:
>
> Thanks a lot Yoshimi.
> However there is a problem of attibute in the script:
>
> appendFilter.AddInputData(dijkstra.GetOutputPort())
> AttributeError: AddInputData
>
> Does the script works for you?
> Best,
>
> Frederic
>
>
> Le 13/10/2017 à 03:26, kenichiro yoshimi a écrit :
>> Hello Frederic,
>>
>> The options about constrained shortest path can not be found in the
>> vtkDijkstraGraphGeodesicPath. I don't know it is helpful or not but it
>> is possible to add points to pass through as some of the constraints.
>> It works in the following way due to applying vtkAppendFilter
>> successively to some outputs of vtkDijkstraGraphGeodesicPath.
>>
>> ---
>> import vtk
>> import math
>>
>> cylinder= vtk.vtkSphereSource()
>> cylinder.SetCenter(0.0, 0.0, 0.0)
>> cylinder.SetRadius(0.5)
>>
>> appendFilter = vtk.vtkAppendFilter()
>> appendFilter.MergePointsOn()
>>
>> vIds = [4, 12, 23, 28]
>>
>> p0 = [0,0,0]
>> p1 = [0,0,0]
>> dist = 0.0
>> for n in range(len(vIds)-1):
>> v0 = vIds[n]
>> v1 = vIds[n+1]
>>
>> dijkstra = vtk.vtkDijkstraGraphGeodesicPath()
>> dijkstra.SetInputConnection(cylinder.GetOutputPort())
>> dijkstra.SetStartVertex(v0)
>> dijkstra.SetEndVertex(v1)
>> dijkstra.Update()
>>
>> pts = dijkstra.GetOutput().GetPoints()
>> for ptId in range(pts.GetNumberOfPoints()-1):
>> pts.GetPoint(ptId, p0)
>> pts.GetPoint(ptId+1, p1)
>> print(math.sqrt(vtk.vtkMath.Distance2BetweenPoints(p0, p1)))
>> dist += math.sqrt(vtk.vtkMath.Distance2BetweenPoints(p0, p1))
>>
>> appendFilter.AddInputData(dijkstra.GetOutput())
>>
>> print(dist)
>>
>> appendFilter.Update()
>> ---
>>
>> Thanks
>>
>> 2017-10-13 1:26 GMT+09:00 Frédéric BRIEND<briend at cyceron.fr> <mailto:briend at cyceron.fr>:
>>> Hi,
>>>
>>> Always with vtkDijkstraGraphGeodesicPath function, is-it possible to
>>> constrained the geodesic shortest paths (example)?
>>> and thus to add points beetween the "dijkstra.SetStartVertex(X)" and the
>>> "dijkstra.SetEndVertex(Y)"?
>>>
>>> Thanks in advance!
>>>
>>> Frederic
>>>
>>>
>>>
>>> Le 12/10/2017 à 04:52, kenichiro yoshimi a écrit :
>>>
>>> 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> <mailto: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 <mailto:briend at cyceron.fr>
>>>
>>> http://www.ists.cyceron.fr/
>>>
>>>
>>> _______________________________________________
>>> Powered bywww.kitware.com <http://www.kitware.com>
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>> <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 <http://www.vtk.org/Wiki/VTK_FAQ>
>>>
>>> Search the list archives at:http://markmail.org/search/?q=vtkusers
>>> <http://markmail.org/search/?q=vtkusers>
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>> <http://public.kitware.com/mailman/listinfo/vtkusers>
>>>
>>>
>>> --
>>>
>>> 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 <tel:+33%202%2031%2047%2001%2056>
>>>
>>> Email :briend at cyceron.fr <mailto:briend at cyceron.fr>
>>>
>>> http://www.ists.cyceron.fr/
>
> --
>
> FredericBriend
>
> 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/>
>
> http://www.ists.cyceron.fr/
>
>
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> <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 <http://www.vtk.org/Wiki/VTK_FAQ>
>
> Search the list archives at:
> http://markmail.org/search/?q=vtkusers
> <http://markmail.org/search/?q=vtkusers>
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
> <http://public.kitware.com/mailman/listinfo/vtkusers>
>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
--
FredericBriend
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/>
http://www.ists.cyceron.fr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171017/8fe8bd06/attachment.html>
More information about the vtkusers
mailing list