[vtk-developers] Which class to derive from for filter with input: PolyData, output: Graph
David E DeMarle
dave.demarle at kitware.com
Wed Nov 11 15:58:34 EST 2009
That specific error message means that some filter in your program is
expecting something on one of its inputs, but doesn't have anything
connected there.
To fix that, find out why nothing is connected to that input in your
application and fix it.
If the algorithm never takes an input, like for a source, set the
number of inputs to zero (see vtkConeSource for example.)
If the algorithm can take a source, but doesn't have to, mark the
input as optional. Search for INPUT_IS_OPTIONAL for examples.
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109
On Wed, Nov 11, 2009 at 3:47 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Wed, Nov 11, 2009 at 1:41 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> What are the differences between deriving from vtkPolyDataAlgorithm vs
>> deriving from vtkGraphAlgorithm? I've seen that you are supposed to
>> derive from the algorithm class that matches the type of your output.
>> However, it seems that you can change the input to an arbitrary data
>> type using:
>>
>> int vtkYourilter::FillInputPortInformation( int port, vtkInformation* info )
>> {
>> if (!this->Superclass::FillInputPortInformation(port, info))
>> {
>> return 0;
>> }
>>
>> if ( port == 0)
>> {
>> info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData" );
>> return 1;
>> }
>> }
>>
>> Is this correct then? Should I derive from vtkGraphAlgorithm and set
>> the input to expect a vtkPolyData using the above method?
>>
>> Thanks,
>>
>> David
>>
>
> Here is my attempt at deriving from vtkGraphAlgorithm and setting the
> input port type to vtkPolyData:
> http://rpi.edu/~doriad/VTK_List/vtkNearestNeighborGraph/
>
> I get a bunch of these:
> vtkStreamingDemandDrivenPipeline (0x89d60a0): Input port 0 of
> algorithm vtkGraphToPolyData(0x89d5ac8) has 0 connections but is not
> optional.
>
> I changed the input port to expect a vtkPolyData with:
> if (port == 0)
> {
> info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData" );
> return 1;
> }
>
> and I changed the cast of the output information:
> vtkGraph *output = vtkGraph::SafeDownCast(
> outInfo->Get(vtkDataObject::DATA_OBJECT()));
>
> Is there anything else I need to do?
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
More information about the vtk-developers
mailing list