David:<br><br>Please find attached the modified code. It works now..<br><br>Comes down to adding the following method that creates the right data object<br><br><br>//----------------------------------------------------------------------------<br>
int vtkTestFilter::RequestDataObject(<br>  vtkInformation*, <br>  vtkInformationVector** inputVector , <br>  vtkInformationVector* outputVector)<br>{<br>  // for each output<br>  for(int i=0; i < this->GetNumberOfOutputPorts(); i++)<br>
    {<br>    vtkInformation* info = outputVector->GetInformationObject(i);<br>    vtkDataObject *output = info->Get(vtkDataObject::DATA_OBJECT());<br><br>    // Populate the right type of output<br>    this->FillOutputPortInformation( i, info );<br>
<br>    // Create an instance of that output.<br>    if(const char* dt = info->Get(vtkDataObject::DATA_TYPE_NAME()))<br>      {<br>      output = vtkDataObjectTypes::NewDataObject(dt);<br><br>      // Set it on the executive.<br>
      this->GetExecutive()->SetOutputData(i, output, info);<br><br>      if (output)<br>        {<br>        output->FastDelete();<br>        }      <br>      }      <br>    }<br>  return 1;<br>}<br><br><div class="gmail_quote">
On Sat, May 29, 2010 at 9:09 PM, Wylie, Brian <span dir="ltr"><<a href="mailto:bnwylie@sandia.gov">bnwylie@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Also vtkRandomGraphSource has a similar tactic...<br>
<br>
<br>
  // Copy the structure into the output.<br>
  vtkGraph *output = vtkGraph::GetData(outputVector);<br>
  if (this->Directed)<br>
    {<br>
    if (!output->CheckedShallowCopy(dirBuilder))<br>
      {<br>
      vtkErrorMacro(<<"Invalid structure.");<br>
      return 0;<br>
      }<br>
    }<br>
  else<br>
    {<br>
    if (!output->CheckedShallowCopy(undirBuilder))<br>
      {<br>
      vtkErrorMacro(<<"Invalid structure.");<br>
      return 0;<br>
<div><div></div><div class="h5">      }<br>
    }<br>
  Brian Wylie - Org 1424<br>
  Sandia National Laboratories<br>
  MS 1323 - Building CSRI/242<br>
  (505)844-2238 FAX(505)284-2518<br>
       _______ __<br>
      /_  __(_) /_____ _____<br>
       / / / / __/ __ `/ __ \<br>
      / / / / /_/ /_/ / / / /<br>
     /_/ /_/\__/\__,_/_/ /_/<br>
            Informatics Toolkit<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a> [mailto:<a href="mailto:vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a>] On Behalf Of Wylie, Brian<br>
Sent: Saturday, May 29, 2010 9:33 AM<br>
To: 'David Doria'; 'Karthik Krishnan'<br>
Cc: 'VTK Developers'<br>
Subject: Re: [vtk-developers] Variable output type<br>
<br>
Not sure if this helps but vtkTableToGraph can either output a directed or undirected graph...<br>
<br>
It just creates both and then conditional logic on the choice...<br>
<br>
// Create builder for the graph<br>
  VTK_CREATE(vtkMutableDirectedGraph, dirBuilder);<br>
  VTK_CREATE(vtkMutableUndirectedGraph, undirBuilder);<br>
  vtkGraph *builder = 0;<br>
  if (this->Directed)<br>
    {<br>
    builder = dirBuilder;<br>
    }<br>
  else<br>
    {<br>
    builder = undirBuilder;<br>
    }<br>
<br>
  // Add the correct number of vertices to the graph based on the number of<br>
  // rows in the vertex table.<br>
  builder->GetVertexData()->PassData(vertexTable->GetRowData());<br>
  for (vtkIdType i = 0; i < vertexTable->GetNumberOfRows(); ++i)<br>
    {<br>
    if (this->Directed)<br>
      {<br>
      dirBuilder->AddVertex();<br>
      }<br>
    else<br>
      {<br>
      undirBuilder->AddVertex();<br>
      }<br>
    }<br>
<br>
  Brian Wylie - Org 1424<br>
  Sandia National Laboratories<br>
  MS 1323 - Building CSRI/242<br>
  (505)844-2238 FAX(505)284-2518<br>
       _______ __<br>
      /_  __(_) /_____ _____<br>
       / / / / __/ __ `/ __ \<br>
      / / / / /_/ /_/ / / / /<br>
     /_/ /_/\__/\__,_/_/ /_/<br>
            Informatics Toolkit<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a> [mailto:<a href="mailto:vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a>] On Behalf Of David Doria<br>
Sent: Saturday, May 29, 2010 9:27 AM<br>
To: Karthik Krishnan<br>
Cc: VTK Developers<br>
Subject: Re: [vtk-developers] Variable output type<br>
<br>
</div></div><div><div></div><div class="h5">> In addition to what you have, please also try adding the following method :<br>
><br>
>   int vtkTestFilter::ProcessRequest(vtkInformation* request,<br>
>                                             vtkInformationVector**<br>
> inInfoVec,<br>
>                                             vtkInformationVector*<br>
> outInfoVec)<br>
> {<br>
>   if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA_OBJECT()))<br>
>     {<br>
>     return vtkAlgorithm::ProcessRequest(request, inputVector, outputVector);<br>
>     }<br>
><br>
>   return this->Superclass::ProcessRequest(request, inputVector,<br>
> outputVector);<br>
> }<br>
<br>
When I added that function (changing inputVector to inInfoVec and<br>
outputVector to outInfoVec), I now get:<br>
<br>
vtkStreamingDemandDrivenPipeline (0x8ba81c8): Algorithm<br>
vtkTestFilter(0x8ba73b8) did not create output for port 0 when asked<br>
by REQUEST_DATA_OBJECT and does not specify any DATA_TYPE_NAME.<br>
<br>
Thanks for your help - as usual I am trying not to answer just my<br>
specific question but generate something useful enough to put on the<br>
wiki!<br>
<br>
Thanks,<br>
<br>
David<br>
</div></div><div><div></div><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>