[vtk-developers] Which class to derive from for filter with input: PolyData, output: Graph

David Doria daviddoria+vtk at gmail.com
Fri Nov 20 11:02:34 EST 2009


On Fri, Nov 20, 2009 at 9:47 AM, Jeff Baumes <jeff.baumes at kitware.com> wrote:
>>
>> Does vtkGraphAlgorithm not work basically the same as vtkPolyDataAlgorithm?
>>
>
> Yes, basically. All that most of these algorithm superclasses do are
> set the default algorithm properties to have one input and one output,
> both a specific type (e.g. graph or polydata). All this behavior can
> be overridden in subclasses, so they are really just a convenience.
> With a few extra lines of code you could directly inherit from
> vtkAlgorithm. Generally speaking, people use the type of algorithm
> superclass corresponding to the type of the output of the filter, then
> override input connection settings as necessary.
>
> The one other convenience is that the GetOutput() method returns the
> specific type, so you don't have to use SafeDownCast. There are a
> couple other tiny things these superclasses do, but conceptually that
> is it.
>
> It is unsafe to use the legacy GetOutput() / SetInput() methods to
> connect pipeline objects. They were supported for backwards
> compatibility when VTK's pipeline went through an overhaul, but newer
> stuff added after that (e.g. infovis/graph stuff) do not provide
> testing that this works in all cases. Do you still get your errors if
> you use the correct way to do things now: GetOutputPort() /
> SetInputConnection()?
>
> Jeff
>

Ok, so I don't think I am misinterpreting anything with the algorithm classes.

Yep, still errors even using GetOutputPort() / SetInputConnection().

Here is the latest version:
http://www.rpi.edu/~doriad/VTK_List/vtkNearestNeighborGraph/

In fact, stepping through with the debugger I realized that it is
never even going into FillInputPortInformation() or RequestData(),
which seems very strange?

The error is:
vtkStreamingDemandDrivenPipeline (0x8571e78): Algorithm
vtkGraphAlgorithm(0x856fee8) returned failure for request:
vtkInformation (0x8572160)

Thoughts?

Thanks,

David



More information about the vtk-developers mailing list