[vtkusers] Selections

Jeff Baumes jeff.baumes at kitware.com
Tue Feb 2 08:54:00 EST 2010


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

On Tue, Feb 2, 2010 at 7:15 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>
> On Mon, Feb 1, 2010 at 11:49 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> Have you looked for a test that uses vtkExtractSelection? I found one
>> in VTK/Graphics/Testing/Cxx/TestExtraction.cxx. It might help. I have
>> not looked at your example or the test.
>>
>> On Mon, Feb 1, 2010 at 8:33 PM, David Doria <daviddoria+vtk at gmail.com>
>> wrote:
>> > I am trying to demonstrate vtkSelectionSource and vtkExtractSelection:
>> > http://www.vtk.org/Wiki/VTK/Examples/ExtractSelection
>> > The example is setup to create 50 random points and extract 10 of them
>> > (IDs
>> > 10 through 20, so maybe 11?). Is this the right idea? Create a
>> > selectionSource, tell it which things you want to select, then extract
>> > the
>> > selection?
>> > The output of the extractSelection filter is NULL, so clearly it is not
>> > exactly correct :)
>> > Also, the output of the ExtractSelection is a vtkDataObject, so I tried
>> > to
>> > cast it as a vtkDataSet to get back to a sane data type - is this a
>> > reasonable approach? 'obj' is null for now so I can't tell if the cast
>> > will
>> > work.
>> > Any suggestions?
>> > Thanks,
>> >
>> > David
>>
>
> That helped catch a bug with the ExtractSelection filter, but I believe the
> problem lies in the SelectionSource. There doesn't seem to be any tests that
> use a vtkSelectionSource (this is bad, right!?).
> Here is the latest version:
> http://www.vtk.org/Wiki/VTK/Examples/ExtractSelection
> It exits successfully, but there are 0 points in the output.
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list