<div class="gmail_quote">On Tue, Feb 2, 2010 at 8:54 AM, Jeff Baumes <span dir="ltr"><<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
A threshold selection (like the one you set up), does not threshold a<br>
range of point indices. It is used to threshold based on values in a<br>
data array (which you specify with SetArrayName()). What you should<br>
try is<br>
<br>
for (int i = 10; i <= 20; i++)<br>
{<br>
selectionSource->AddID(-1, i);<br>
}<br>
<br>
In general, you should also always specify the content and field type.<br>
The content type is the type of selection (indices, threshold, values,<br>
etc.) and field type whether you are thresholding points or cells.<br>
<br>
selectionSource->SetContentType(vtkSelectionNode::INDICES);<br>
selectionSource->SetFieldType(vtkSelectionNode::POINT);<br>
<br>
FYI, it's almost as easy to construct a vtkSelection object yourself<br>
without using vtkSelectionSource. There is an article in the Source<br>
that explains all of this better:<br>
<br>
<a href="http://www.kitware.com/products/thesource/apr2009.html" target="_blank">http://www.kitware.com/products/thesource/apr2009.html</a><br>
<font color="#888888"><br>
Jeff<br>
</font><div><div></div><div class="h5"></div></div></blockquote></div><br><div>Hi Jeff,</div><div><br></div><div>I had tried the AddID function, it also resulted in 0 points in the output. When I added the ::INDICES and ::POINT properties, the output now has 50 points (still supposed to be 11).</div>
<div><br></div><div>I see in the Source article you did this:</div><div>vtkUnstructuredGrid* extracted = extractSelection->GetOutput();</div><div><br></div><div>but when I try that it tells me cannot convert vtkDataObject to vtkUnstructuredGrid. Hence my vtkDataSet::SafeDownCast. Maybe this is the problem?</div>
<div><br></div><div>Here is the latest version:</div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/ExtractSelection">http://www.vtk.org/Wiki/VTK/Examples/ExtractSelection</a></div><div><br clear="all">Thanks,<br><br>
David</div>