<div>Hi,</div>
<div> </div>
<div>I guess the direct output of IdFilter should give you proper Id's, rather than passing it through geometry filter.</div>
<div> </div>
<div>See this example</div>
<div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointCellIds">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointCellIds</a></div>
<div> </div>
<div>Hope that helps</div>
<div> </div>
<div>Regards<br><br></div>
<div class="gmail_quote">On Tue, Feb 28, 2012 at 3:06 PM, John Platt <span dir="ltr"><<a href="mailto:jcplatt@dsl.pipex.com">jcplatt@dsl.pipex.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Hi,<br><br>vtkUnstructuredGridGeometryFil<u></u>ter creates new, 0-based, contiguous, points and cell ids. I suspect you are labelling these new ids. Have you tried putting the id filter before the geometry filter?<br>
<br>HTH<br><br>John.<br><br>----- Original Message ----- From: "Jochen" <<a href="mailto:jochen.kling@email.de" target="_blank">jochen.kling@email.de</a>><br>To: <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
Sent: Tuesday, February 28, 2012 12:24 AM<br>Subject: [vtkusers] Labeling points of an unstructured grid
<div class="HOEnZb">
<div class="h5"><br><br><br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Hi all,<br><br>I would like to label all points of an unstructured grid with their original<br>id. This sounds like easy to accomplish. I'm running out of any idea what<br>
I'm doing wrong. And to be honest, I'm out of order now. Hopefully there is<br>somebody out there, who can help me.<br><br>(my context: vtk 5.8.0, activiz, c#)<br><br>As soon as I add /<u></u>vtkUnstructuredGridGeometryFil<u></u>ter/-filter points are<br>
labeled with wrong ids.<br>In the case I use the pure grid as input for /vtkIdFilter/ everything is<br>fine except that I see labels for inner points, which I cannot accept.<br><br>This code shows the correct ids: ( but I see the inner points)<br>
<br>private void ShowNodes() {<br>vtkUnstructuredGridReader reader;<br>vtkUnstructuredGrid ugrid;<br>vtkVertexGlyphFilter vertexFilter;<br>vtkIdFilter idFilter;<br>vtkPolyDataMapper ptsMapper;<br>vtkLabeledDataMapper lblMapper;<br>
vtkActor ptsActor;<br>vtkActor2D lblActor;<br><br>// read ugrid<br>reader = vtkUnstructuredGridReader.New(<u></u>);<br>reader.SetFileName(@"c:\vtk\<u></u>data\cube.1.vtk"); // created by tetgen.exe<br>(cube with 48 tetrahedrons)<br>
reader.Update();<br>ugrid = reader.GetOutput();<br><br>// filter original point ids<br>idFilter = vtkIdFilter.New();<br>idFilter.SetInputConnection(<u></u>ugrid.GetProducerPort());<br>idFilter.PointIdsOn();<br>idFilter.Update();<br>
<br>// points<br>vertexFilter = vtkVertexGlyphFilter.New();<br>vertexFilter.<u></u>SetInputConnection(ugrid.<u></u>GetProducerPort());<br>vertexFilter.Update();<br>ptsMapper = vtkPolyDataMapper.New();<br>ptsMapper.SetInputConnection(<u></u>vertexFilter.GetOutputPort());<br>
ptsMapper.ScalarVisibilityOn()<u></u>;<br>ptsActor = vtkActor.New();<br>ptsActor.SetMapper(ptsMapper);<br>ptsActor.GetProperty().<u></u>SetPointSize(10.0f);<br><br>// point labels<br>lblMapper = vtkLabeledDataMapper.New();<br>
lblMapper.SetInputConnection(<u></u>idFilter.GetOutputPort());<br>lblMapper.<u></u>SetLabelModeToLabelFieldData()<u></u>;<br>lblActor = vtkActor2D.New();<br>lblActor.SetMapper(lblMapper);<br><br>// render<br>renderer.AddActor(ptsActor);<br>
renderer.AddActor(lblActor);<br>renWin.Render();<br>}<br><br>------------------------------<u></u>----------------------<br>This code shows totally wrong ids (Differences to code above in bold)<br><br>private void ShowSurfaceNodes() {<br>
vtkUnstructuredGridReader reader;<br>vtkUnstructuredGrid ugrid;<br>vtkVertexGlyphFilter vertexFilter;<br>vtkIdFilter idFilter;<br>vtkPolyDataMapper ptsMapper;<br>vtkLabeledDataMapper lblMapper;<br>vtkActor ptsActor;<br>vtkActor2D lblActor;<br>
* vtkUnstructuredGridGeometryFil<u></u>ter geo;<br>*<br>// read ugrid<br>reader = vtkUnstructuredGridReader.New(<u></u>);<br>reader.SetFileName(@"c:\vtk\<u></u>data\cube.1.vtk"); // created by tetgen.exe<br>(cube with 48 tetrahedrons)<br>
reader.Update();<br>ugrid = reader.GetOutput();<br><br>// filter inner points, so only surface points will be available<br>* geo = vtkUnstructuredGridGeometryFil<u></u>ter.New();<br>geo.SetInputConnection(ugrid.<u></u>GetProducerPort());<br>
*<br>// filter original point ids<br>idFilter = vtkIdFilter.New();<br>idFilter.SetInputConnection(*<u></u>geo.GetOutputPort()*);<br>idFilter.PointIdsOn();<br>idFilter.Update();<br><br>// points<br>vertexFilter = vtkVertexGlyphFilter.New();<br>
vertexFilter.<u></u>SetInputConnection(*geo.<u></u>GetOutputPort()*);<br>vertexFilter.Update();<br>ptsMapper = vtkPolyDataMapper.New();<br>ptsMapper.SetInputConnection(<u></u>vertexFilter.GetOutputPort());<br>ptsMapper.ScalarVisibilityOn()<u></u>;<br>
ptsActor = vtkActor.New();<br>ptsActor.SetMapper(ptsMapper);<br>ptsActor.GetProperty().<u></u>SetPointSize(10.0f);<br><br>// point labels<br>lblMapper = vtkLabeledDataMapper.New();<br>lblMapper.SetInputConnection(<u></u>idFilter.GetOutputPort());<br>
lblMapper.<u></u>SetLabelModeToLabelFieldData()<u></u>;<br>lblActor = vtkActor2D.New();<br>lblActor.SetMapper(lblMapper);<br><br><br>renderer.AddActor(ptsActor);<br>renderer.AddActor(lblActor);<br>renWin.Render();<br>}<br>
<br>I hope code is not too long.<br>Please help. I tried so many things, unfortunately with no success.<br><br>with kind regards<br>Jochen<br><br><br><br>--<br>View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Labeling-points-of-an-unstructured-grid-tp5520458p5520458.html" target="_blank">http://vtk.1045678.n5.nabble.<u></u>com/Labeling-points-of-an-<u></u>unstructured-grid-<u></u>tp5520458p5520458.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>______________________________<u></u>_________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>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" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
<br></blockquote><br><br>______________________________<u></u>_________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>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" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>