<div><div class="gmail_quote">On Fri, May 7, 2010 at 2:16 PM, Jack <span dir="ltr">&lt;<a href="mailto:teddy.kord@yahoo.co.uk">teddy.kord@yahoo.co.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div style="font-family:&#39;times new roman&#39;, &#39;new york&#39;, times, serif;font-size:12pt"><div style="font-family:times, serif;font-size:12pt"><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse;color:rgb(51, 51, 51)">Hi<div>
<br></div><div>I have a file with a dataset of structured points. I&#39;d like to convert this to a dataset of unstructured points and/or unstructured grid. How can I do this?</div><div><br></div><div>So far, this is what I have: </div>
<div><br></div><div><div>int main()</div><div>{</div><div><span style="white-space:pre">        </span>//get all data from the file</div><div><span style="white-space:pre">        </span>vtkSmartPointer&lt; vtkStructuredPointsReader&gt; reader = vtkSmartPointer&lt; vtkStructuredPointsReader&gt;:: New();</div>
<div><span style="white-space:pre">
        </span>reader-&gt;SetFileName(&quot;geometry. vtk&quot;);</div><div><span style="white-space:pre">        </span>reader-&gt;Update();</div><div><br></div><div><span style="white-space:pre">        </span>vtkStructuredPoints* structuredPoints = reader-&gt;GetOutput();</div>
<div><br></div><div><span style="white-space:pre">        </span>//get the number of points the file contains</div><div> <span style="white-space:pre">        </span>vtkIdType numPoints = structuredPoints-&gt; GetNumberOfPoints();</div>
<div> </div><div><span style="white-space:pre">        </span>std::cout &lt;&lt; &quot;There are &quot; &lt;&lt; numPoints &lt;&lt; &quot; points.&quot; &lt;&lt; std::endl;</div><div><br></div><div><span style="white-space:pre">        </span>vtkSmartPointer&lt; vtkUnstructuredGrid&gt; unstructuredGrid = vtkSmartPointer&lt; vtkUnstructuredGrid&gt;::New();</div>
<div><br></div><div>}</div><div><br></div><div>It&#39;s incomplete and I&#39;m not sure how to
 proceed.</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Theodore</div><div></div></div></span></div></div></div></div></blockquote></div><br></div><div><br></div><div>These are the basics of creating and writing a VTU:</div>
<div><br></div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/IO/WriteVTU">http://www.vtk.org/Wiki/VTK/Examples/IO/WriteVTU</a><div><br></div><div>I&#39;ve never used vtkStructuredPoints - it seems to be a subclass of vtkImageData, so you may be able to get the dat aout of it using something similar to </div>
<div><br></div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/ImageData/IterateImageData">http://www.vtk.org/Wiki/VTK/Examples/ImageData/IterateImageData</a></div><div><br></div><div>Good luck - if you figure it out please make a wiki example!</div>
<div><a href="http://www.vtk.org/Wiki/VTK/Examples/IO/WriteVTU"></a><br clear="all">Thanks,<br><br>David<br></div></div>