<div dir="ltr">What I mean is that when I save the vtp file and then read it, the file does not render anything (blank window). I think the source of problem is that the vtkPolyData that is taken from surfaceMapper has 0 number of Ploy, meaning that, in the ContoursToSurface example [1], if I add the following lines:<div>
<br></div><div>vtkPolyData *myvtkPolyData = vtkPolyData::SafeDownCast( surfaceMapper->GetInputAsDataSet() );<br></div><div><br></div><div>std:cerr << myvtkPolyData->GetNumberOfPolys();<br></div><div><br></div>
<div>it will print zero.</div><div><br></div><div>I resolved the issue, as it follows: </div><div><br></div><div>In the example [1], there is an instance of vtkTransformPolyDataFilter which rescales the output from IJK coordinate system back into the world coordinates. I just needed to add "UpdateWholeExtent()" method to it, and this will update the pipeline:</div>
<div><br></div><div>transformFilter->UpdateWholeExtent();<br></div><div><br></div><div>This example [1] works fine, as long as someone wants to visualize the results, however if someone wants to "use" the polyData (e.g. to save a vtp file out of it), then, I think, it is necessary to either add the above line or perform any alternative solution.</div>
<div><br></div><div>-S</div><div><br></div><div><br></div><div><br></div><div><br></div><div>[1] <span style="font-size:12.800000190734863px;color:rgb(17,85,204);font-family:arial,sans-serif;text-decoration:underline"><a href="http://www.vtk.org/Wiki/VTK/">http://www.vtk.org/Wiki/VTK/</a></span><span style="font-size:12.800000190734863px;color:rgb(17,85,204);font-family:arial,sans-serif;text-decoration:underline">Examples/Cxx/PolyData/</span><span style="font-size:12.800000190734863px;color:rgb(17,85,204);font-family:arial,sans-serif;text-decoration:underline">ContoursToSurface</span></div>
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, May 10, 2014 at 6:09 AM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Fri, May 9, 2014 at 4:55 PM, Sam Raby <span dir="ltr"><<a href="mailto:rabysam28@gmail.com" target="_blank">rabysam28@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">In the following VTK example:<div><br></div>
<div><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ContoursToSurface" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ContoursToSurface</a><br></div>
<div><br></div><div>after the surface of sphere is generated, I am trying to simply save the surface as a vtp file using the following code, but I can not, that is, the saved file does not show anything. Can anyone help why this happens? Thanks. </div>
<div><br></div><div><div> </div><div> vtkPolyData *myvtkPolyData = vtkPolyData::SafeDownCast( surfaceMapper->GetInputAsDataSet() );</div><div> vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();</div>
<div> writer->SetFileName("/home/surface.vtp");</div><div> writer->SetInputData( myvtkPolyData );</div><div> writer->SetDataModeToBinary();</div><div> writer->Write();</div></div></div></blockquote>
<div><br></div></div></div>What do you mean it does not show anything? How are you trying to view it? I would suggest using Paraview.<span class="HOEnZb"><font color="#888888"><div class="gmail_extra"><br clear="all"><div>
David <br></div></div></font></span></div></div></div>
</blockquote></div><br></div>