[vtk-developers] Variable output type

Karthik Krishnan karthik.krishnan at kitware.com
Sat May 29 11:05:42 EDT 2010


That's because your superclass, vtkGraphAlgorithm is one of those classes
that overrides the usual data creation passes and enforces the output to be
the same type as the input.


In addition to what you have, please also try adding the following method :

  int vtkTestFilter::ProcessRequest(vtkInformation* request,
                                            vtkInformationVector**
inInfoVec,
                                            vtkInformationVector*
outInfoVec)
{
  if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))
    {
    return vtkAlgorithm::ProcessRequest(request, inputVector, outputVector);
    }

  return this->Superclass::ProcessRequest(request, inputVector,
outputVector);
}



On Sat, May 29, 2010 at 8:08 PM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

> On Sat, May 29, 2010 at 8:50 AM, Karthik Krishnan
> <karthik.krishnan at kitware.com> wrote:
> > On Sat, May 29, 2010 at 1:10 AM, David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> >
> > wrote:
> >>
> >> I want to make a filter in which I can specify the output type.
> >
> > You would provide the method :
> >
> >   FillOutputPortInformation( int port, vtkInformation *info )
> >     {
> >     if (.... && port == 0)
> >      {
> >      info->Set(vtkDataObject::DATA_TYPE_NAME(),
> > "vtkMutableUndirectedGraph");
> >      }
> >     if (....&& port == 0)
> >      {
> >      info->Set(vtkDataObject::DATA_TYPE_NAME(),
> "vtkMutableDirectedGraph");
> >      }
> >     }
>
> Hm, I tried that:
> http://www.rpi.edu/~doriad/VTK_List/OutputType/<http://www.rpi.edu/%7Edoriad/VTK_List/OutputType/>
>
> but it seems to still force the output type to match the input type.
> (even though I specify "ug", the output says "Output is type:
> vtkMutableUndirectedGraph" (where it should now be
> vtkUndirectedGraph)).
>
> Also, is it then acceptable to in RequestData SafeDownCast the output
> to a vtkGraph but assume you can still use functions from the subclass
> that was selected?
>
> Thanks,
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100529/e007bcc6/attachment.html>


More information about the vtk-developers mailing list