[vtkusers] Selections

David Doria daviddoria+vtk at gmail.com
Tue Feb 2 09:08:37 EST 2010


On Tue, Feb 2, 2010 at 8:54 AM, Jeff Baumes <jeff.baumes at kitware.com> wrote:

> A threshold selection (like the one you set up), does not threshold a
> range of point indices. It is used to threshold based on values in a
> data array (which you specify with SetArrayName()). What you should
> try is
>
> for (int i = 10; i <= 20; i++)
>  {
>  selectionSource->AddID(-1, i);
>  }
>
> In general, you should also always specify the content and field type.
> The content type is the type of selection (indices, threshold, values,
> etc.) and field type whether you are thresholding points or cells.
>
> selectionSource->SetContentType(vtkSelectionNode::INDICES);
> selectionSource->SetFieldType(vtkSelectionNode::POINT);
>
> FYI, it's almost as easy to construct a vtkSelection object yourself
> without using vtkSelectionSource. There is an article in the Source
> that explains all of this better:
>
> http://www.kitware.com/products/thesource/apr2009.html
>
> Jeff
>

Hi Jeff,

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).

I see in the Source article you did this:
vtkUnstructuredGrid* extracted = extractSelection->GetOutput();

but when I try that it tells me cannot convert vtkDataObject to
vtkUnstructuredGrid. Hence my vtkDataSet::SafeDownCast. Maybe this is the
problem?

Here is the latest version:
http://www.vtk.org/Wiki/VTK/Examples/ExtractSelection

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100202/caaa14e5/attachment.htm>


More information about the vtkusers mailing list