<div dir="ltr">Should be:<div><span style="color:rgb(0,0,0);font-size:12.8px"> appendFilter.AddInputConnection(</span><span style="color:rgb(0,0,0);font-size:12.8px">dijkstra.GetOutputPort())</span><br style="color:rgb(0,0,0);font-size:12.8px"></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 17, 2017 at 7:30 AM, Frédéric BRIEND <span dir="ltr"><<a href="mailto:briend@cyceron.fr" target="_blank">briend@cyceron.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Thanks a lot Yoshimi.<br>
However there is a problem of attibute in the script:</p>
<p> appendFilter.AddInputData(<wbr>dijkstra.GetOutputPort())<br>
AttributeError: AddInputData<br>
<br>
Does the script works for you?<br>
Best,</p>
<p>Frederic<br>
</p><div><div class="h5">
<br>
<div class="m_-3117952727990151314moz-cite-prefix">Le 13/10/2017 à 03:26, kenichiro
yoshimi a écrit :<br>
</div>
<blockquote type="cite">
<pre>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.<wbr>vtkDijkstraGraphGeodesicPath()
dijkstra.SetInputConnection(<wbr>cylinder.GetOutputPort())
dijkstra.SetStartVertex(v0)
dijkstra.SetEndVertex(v1)
dijkstra.Update()
pts = dijkstra.GetOutput().<wbr>GetPoints()
for ptId in range(pts.GetNumberOfPoints()-<wbr>1):
pts.GetPoint(ptId, p0)
pts.GetPoint(ptId+1, p1)
print(math.sqrt(vtk.vtkMath.<wbr>Distance2BetweenPoints(p0, p1)))
dist += math.sqrt(vtk.vtkMath.<wbr>Distance2BetweenPoints(p0, p1))
appendFilter.AddInputData(<wbr>dijkstra.GetOutput())
print(dist)
appendFilter.Update()
---
Thanks
2017-10-13 1:26 GMT+09:00 Frédéric BRIEND <a class="m_-3117952727990151314moz-txt-link-rfc2396E" href="mailto:briend@cyceron.fr" target="_blank"><briend@cyceron.fr></a>:
</pre>
<blockquote type="cite">
<pre>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().<wbr>GetPoints()
p0 = [0,0,0]
p1 = [0,0,0]
dist = 0.0
for ptId in range(pts.GetNumberOfPoints()-<wbr>1):
pts.GetPoint(ptId, p0)
pts.GetPoint(ptId+1, p1)
dist += math.sqrt(vtk.vtkMath.<wbr>Distance2BetweenPoints(p0, p1))
print(dist)
---
Regards
2017-10-12 2:12 GMT+09:00 Frédéric BRIEND <a class="m_-3117952727990151314moz-txt-link-rfc2396E" href="mailto:briend@cyceron.fr" target="_blank"><briend@cyceron.fr></a>:
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.<wbr>vtkDijkstraGraphGeodesicPath()
dijkstra.SetInputConnection(<wbr>cylinder.GetOutputPort())
dijkstra.SetStartVertex(4)
dijkstra.SetEndVertex(28)
dijkstra.Update()
weights = vtk.vtkDoubleArray()
size=dijkstra.<wbr>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 : <a class="m_-3117952727990151314moz-txt-link-abbreviated" href="mailto:briend@cyceron.fr" target="_blank">briend@cyceron.fr</a>
<a class="m_-3117952727990151314moz-txt-link-freetext" href="http://www.ists.cyceron.fr/" target="_blank">http://www.ists.cyceron.fr/</a>
______________________________<wbr>_________________
Powered by <a class="m_-3117952727990151314moz-txt-link-abbreviated" href="http://www.kitware.com" target="_blank">www.kitware.com</a>
Visit other Kitware open-source projects at
<a class="m_-3117952727990151314moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at:
<a class="m_-3117952727990151314moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a>
Search the list archives at: <a class="m_-3117952727990151314moz-txt-link-freetext" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a>
Follow this link to subscribe/unsubscribe:
<a class="m_-3117952727990151314moz-txt-link-freetext" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a>
--
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 <a href="tel:+33%202%2031%2047%2001%2056" value="+33231470156" target="_blank">+33 2 31 47 01 56</a>
Email : <a class="m_-3117952727990151314moz-txt-link-abbreviated" href="mailto:briend@cyceron.fr" target="_blank">briend@cyceron.fr</a>
<a class="m_-3117952727990151314moz-txt-link-freetext" href="http://www.ists.cyceron.fr/" target="_blank">http://www.ists.cyceron.fr/</a>
</pre>
</blockquote>
</blockquote>
<br>
</div></div><div class="m_-3117952727990151314moz-signature">-- <br>
<div class="m_-3117952727990151314WordSection1"><div><div class="h5">
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span class="m_-3117952727990151314SpellE"><span>Frederic</span></span><span> <span class="m_-3117952727990151314SpellE">Briend</span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span>PhD
Candidate<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span>Université
de Caen Normandie<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span>Laboratoire
Imagerie et Stratégies Thérapeutiques de la Schizophrénie
(ISTS, EA 7466)<u></u><u></u></span></p>
</div></div><p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><img src="http://www.ists.cyceron.fr/IMG/jpg/logo_ists.jpg" align="left" hspace="12" height="69" width="83"><span>GIP
CYCERON, Caen 14000, France<u></u><u></u></span></p><span class="">
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span>Tel +33 2 31
47 01 56<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span>Email : <a href="http://www.ists.cyceron.fr/" target="_blank">briend@cyceron.fr</a><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span><a href="http://www.ists.cyceron.fr/" target="_blank">http://www.ists.cyceron.fr/</a></span></p>
</span></div>
</div>
</div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Unpaid intern in BillsBasement at noware dot com<br></div>
</div>