[vtk-developers] Intersecting tables, documentation, and me

Kerr, Robert rakerr at sandia.gov
Tue Oct 12 16:01:21 EDT 2010


Jeff,
Thanks for the extra explanation-I think it's starting to make more sense.

I don't know of a VTK primer on the wiki-which doesn't necessarily mean it's not there.

What this all really means is that I need to go back and re-do the VTK book, now that I have enough background to understand what's going on.  That should probably be a standard directive:  "After working with VTK for 3.75 months, you should re-read the book!"

-bob
Meddle not in the affairs of wizards, for they are subtle and
quick to anger.
**********************************************************************
   Robert Kerr,  Titan Informatics Toolkit Developer
   rakerr at sandia.gov         |    PO Box 5800,  MS 1323
   Phone: (505) 844-8606    |    Sandia National Labs
   Fax: (505) 284-2518        |  Albuquerque, NM 87185-1323
**********************************************************************

From: Jeff Baumes [mailto:jeff.baumes at kitware.com]
Sent: Tuesday, October 12, 2010 1:37 PM
To: Kerr, Robert
Cc: vtk-developers at vtk.org
Subject: Re: [vtk-developers] Intersecting tables, documentation, and me

On Tue, Oct 12, 2010 at 3:09 PM, Kerr, Robert <rakerr at sandia.gov<mailto:rakerr at sandia.gov>> wrote:
Recently I've been working on something that involves vtkExtractSelectedRows.  I finally got my issues (well, at least my programming ones) worked out, and everything is peachy-keen.  But it was harder than I'd expected.  Here's a description of some of my frustration.


Here's what I read about vtkExtractSelectedRows:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Detailed Description

return selected rows of a table

The first input is a vtkTable to extract rows from. The second input is a vtkSelection containing the selected indices. The third input is a vtkAnnotationLayers containing selected indices. The field type of the input selection is ignored when converted to row indices.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

And yet, the first input isn't a vtkTable, rather it's a vtkAlgorithmOutput.  The second input is not a vtkSelection, rather it also is a vtkAlgorithmOutput.

You can use a vtkTable and vtkSelection as the inputs by doing the following:

alg->SetInput(0, table);
alg->SetInput(1, selection);

These are convenience methods, and behind the scenes they do indeed call GetProducerPort() internally. The indices are also only needed when specifying a port other than the first port (port zero), which is the default. These methods should not be used when making true pipeline connections between one algorithm and another. In that case you generally do

alg->SetInputConnection(upstream_alg->GetOutputPort());

Notice that in all these cases, type checking is not explicit at compile time. SetInput and SetInputConnection take vtkDataObject and vtkAlgorithmOutput, respectively. This is to allow general API in the algorithm superclass and also to give algorithms flexibility to input and produce different types of data objects in different scenarios at runtime.

Scrabbling around through the docs, I found a link to a test case for vtkExtractSelectedRows, and was able to figure out the correct voodoo to make it work, but it certainly wasn't clear from the documentation.

Is it just "understood" that when we say an input is a vtkTable we instead mean vtkTable->GetProducerPort() and so on?  Is this written anywhere in the docs?  I know I'm probably exposing my abysmal ignorance of all things VTK by speaking out here, but neither would I want to contribute to the VTK Conspiracy of 1492, which (I imagine) states that "knowing how to convert from a vtkTable to a vtkAlgorithmOutput is implicitly required for anyone using VTK".

The bulk of VTK documentation uses this language of "the first input is such-and-such type", and you are right that this underlying knowledge of the pipeline is often inferred. The VTK books do a good job of explaining the pipeline model, is there perhaps no equivalent "VTK primer" on the wiki?

Jeff

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20101012/c23bbd1f/attachment.html>


More information about the vtk-developers mailing list