<br><br><div class="gmail_quote">On 12 May 2010 23:48, Ted Kord <span dir="ltr">&lt;<a href="mailto:teddy.kord@googlemail.com">teddy.kord@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On 7 May 2010 23:15,  <span dir="ltr">&lt;<a href="mailto:vtkusers-owner@vtk.org" target="_blank">vtkusers-owner@vtk.org</a>&gt;</span> wrote:<br></div></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
<div><div></div><div>You are not allowed to post to this mailing list, and your message has<br>
been automatically rejected.  If you think that your messages are<br>
being rejected in error, contact the mailing list owner at<br>
<a href="mailto:vtkusers-owner@vtk.org" target="_blank">vtkusers-owner@vtk.org</a>.<br>
<br>
</div></div><br><br></div></div>---------- Forwarded message ----------<br>From: Ted Kord &lt;<a href="mailto:teddy.kord@googlemail.com" target="_blank">teddy.kord@googlemail.com</a>&gt;<br>To: &quot;Eric E. Monson&quot; &lt;<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>&gt;<br>

Date: Fri, 7 May 2010 23:15:36 +0100<br>Subject: Re: [vtkusers] Converting a Structured Points File to an Unstructured Points/Grid File<br>I believe I&#39;ve managed to obtain one solution. The code below works fine.<div>

<br></div><div><div>int main(int argc, char *argv[])</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><span style="white-space:pre">        </span>vtkSmartPointer&lt;vtkPoints&gt; points = vtkSmartPointer&lt;vtkPoints&gt;::New();</div><div><br></div><div><span style="white-space:pre">        </span>// Insert points </div>


<div><span style="white-space:pre">        </span>for (int i = 0; i &lt; numPoints; ++i) {</div><div><span style="white-space:pre">                </span>std::cout &lt;&lt; i &lt;&lt; std::endl;</div>
<div><span style="white-space:pre">                </span>double* point = ((vtkImageData*)structuredPoints)-&gt;GetPoint(i);</div><div><span style="white-space:pre">                </span>points-&gt;InsertNextPoint(point);</div>
<div><span style="white-space:pre">        </span>}</div><div><span style="white-space:pre">                </span></div><div><span style="white-space:pre">        </span>unstructuredGrid-&gt;SetPoints(points);</div>
<div><span style="white-space:pre">        </span>//vtkSmartPointer&lt;vtkUnstructuredGridWriter&gt; writer = vtkSmartPointer&lt;vtkUnstructuredGridWriter&gt;::New();</div><div><span style="white-space:pre">        </span>vtkSmartPointer&lt;vtkXMLUnstructuredGridWriter&gt; writer = vtkSmartPointer&lt;vtkXMLUnstructuredGridWriter&gt;::New();</div>


<div><span style="white-space:pre">        </span>writer-&gt;SetFileName(&quot;unstructured_geometry.vtu&quot;);</div><div><span style="white-space:pre">        </span>writer-&gt;SetInput(unstructuredGrid);</div>
<div><span style="white-space:pre">        </span>writer-&gt;Write();</div><div><br></div><div>        return EXIT_SUCCESS;</div><div>}</div><div><br></div><div><br></div>I&#39;ll create a wiki example in due course.</div>
<div><br></div><div>Thanks all</div><div><br></div><div>Theodore</div><div><br></div><div><br><div class="gmail_quote">On 7 May 2010 21:22, Eric E. Monson <span dir="ltr">&lt;<a href="mailto:emonson@cs.duke.edu" target="_blank">emonson@cs.duke.edu</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hey Theodore,<div><br></div><div>One quick way might be to send the output of the reader right into a vtkThreshold filter (that is set with a threshold range which will pass all of your data). I&#39;ve never tried it with a vtkStructuredPoints, but it works well for vtkImageData, and I think it should work in your case.</div>


<div><br></div><div>There are test code samples linked off of the Doxygen page:</div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkThreshold.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkThreshold.html</a></div>


<div><br></div><div>Or, there is at least this one (and maybe more) on the VTK examples Wiki:</div><div><br></div><div><a href="http://www.itk.org/Wiki/VTK/Examples/ThresholdingCells" target="_blank">http://www.itk.org/Wiki/VTK/Examples/ThresholdingCells</a></div>


<div><br></div><div>(There&#39;s also a vtkThresholdPoints filter that outputs vtkPolyData)</div><div><br></div><div>-Eric</div><div><br><div>
<span style="font-size:12px"><div>------------------------------------------------------</div><div>Eric E Monson</div><div>Duke Visualization Technology Group</div><div><span style="font-size:medium"><br></span></div></span>
</div>
<br><div><div><div></div><div><div>On May 7, 2010, at 2:16 PM, Jack wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div><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></span></div></div></div></div></div></div></blockquote></div></div></div></blockquote></div></div></blockquote></div></blockquote>
<div><br></div><div><br></div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(51, 51, 51); "><div>Hi again</div><div><br></div><div>I thought this was working but it turns out not to be.</div>
<div><br></div><div>I&#39;ve tried several ways to do this but no success. I would have thought that  vtkStructuredPointsToUnstructuredGrid would work but for some reason, I keep getting compilation errors whenever I try to instantiate this.</div>
<div><br></div><div>I&#39;d appreciate if someone could show me how to accomplish this.</div><div><br></div><div>Thanks</div><div><br></div></span><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(51, 51, 51); ">Theodore</span> </div>
</div>