<div dir="ltr">Hi,<div><br></div><div>The vtkusers mailing list is transitioning to <a href="http://discourse.vtk.org">discourse.vtk.org</a>. Please post new questions on that forum.</div><div><br></div><div>To answer your question, you are seeing exactly what you should see with this pipeline. The contour on a surface will always be a set of line segments. If you want to see a surface corresponding the interior of the contour, you might consider using the vtkClipPolyData, which will clip the geometry by the active scalar array according to what you set in vtkClipPolyData::SetValue().</div><div><br></div><div>HTH,</div><div>Cory</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 6, 2019 at 10:53 AM frmunoz <<a href="mailto:fjmunoz95@gmail.com">fjmunoz95@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">hi,<br>
<br>
I have problems when doing contours on a PolyData object, my input data<br>
comes from a .vtu files which have Unstructured Grid, so this is what i've<br>
done:<br>
- transform the UnstructuredGrid to PolyData<br>
- do pointsValues().SetScalars using one Attribute from the Unstructured<br>
Grid (i've checked that is a point data attribute) as vtkDoubleArray. <br>
- do contour using this poly data, choose the contours and update<br>
- then create the mapper, actor and rederer to visualize.<br>
<br>
and i get a contour line which correspond to the border of the isosurface<br>
(checked with paraview) but inside the contour line, where the surface<br>
should be, there is nothing.<br>
<br>
I'm using windows 10 and i've isntalled vtk using anaconda, cannot upload<br>
the file since is too big, but in code what im doing is:<br>
<br>
# read file<br>
reader = vtk.vtkXMLUnstructuredGridReader()<br>
reader.SetFileName(file_name)<br>
reader.Update()<br>
<br>
# transform to poly<br>
geo = vtk.vtkGeometryFilter()<br>
geo.SetInputConnection(reader.GetOutputPort())<br>
geo.Update()<br>
poly = geo.GetOutput()<br>
<br>
# set desired scalar on poly data<br>
attr = poly.GetAttributes(0).GetArray(1) # desired attr<br>
poly.GetPointData().SetScalars(attr)<br>
<br>
# get contour poly data<br>
contour = vtk.vtkContourFilter()<br>
contour.SetInputData(poly)<br>
contour.SetValue(0, 0)<br>
contour.Update()<br>
<br>
# mapper<br>
mapper = vtk.vtkPolyDataMapper()<br>
mapper.SetInputData(contour.GetOutput())<br>
mapper.ScalarVisibilityOff()<br>
<br>
# actor<br>
actor = vtk.vtkActor()<br>
actor.SetMapper(mapper)<br>
<br>
# renderer<br>
renderer = vtk.vtkRenderer()<br>
render_window = vtk.vtkRenderWindow()<br>
render_window.AddRenderer(renderer)<br>
interactor = vtk.vtkRenderWindowInteractor()<br>
interactor.SetRenderWindow(render_window)<br>
<br>
renderer.AddActor(actor)<br>
renderer.SetBackground(.3, .6, .3) # green<br>
<br>
render_window.SetSize(600, 600)<br>
render_window.Render()<br>
interactor.Initialize()<br>
interactor.Start()<br>
<br>
i'll insert an image of the result i'm seeing. <br>
<<a href="http://vtk.1045678.n5.nabble.com/file/t342690/contour.png" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/file/t342690/contour.png</a>> <br>
<br>
<br>
P.D.1 if you wonder why im not just using the UnstructuredGrid to do the<br>
contour it's because didn't work, but really dont know what was the problem.<br>
<br>
Thanks<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
_______________________________________________<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/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_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=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>