On Tue, Oct 12, 2010 at 3:09 PM, Kerr, Robert <span dir="ltr"><<a href="mailto:rakerr@sandia.gov">rakerr@sandia.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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.<br>
<br>
<br>
Here's what I read about vtkExtractSelectedRows:<br>
<br>
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv<br>
Detailed Description<br>
<br>
return selected rows of a table<br>
<br>
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.<br>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>
<br>
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.<br></blockquote><div><br></div><div>You can use a vtkTable and vtkSelection as the inputs by doing the following:</div>
<div><br></div><div>alg->SetInput(0, table);</div><div>alg->SetInput(1, selection);</div><div><br></div><div>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</div>
<div><br></div><div>alg->SetInputConnection(upstream_alg->GetOutputPort());</div><div><br></div><div>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.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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.<br>
<br>
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".<br>
<br></blockquote><div><br></div><div><meta charset="utf-8"><div>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?</div>
<div><br></div><div>Jeff</div><div> </div></div></div>