[vtkusers] Detecting success/failure of a polydataalgorithm (vtkContourFilter)

Gerrick Bivins gbivins at objectreservoir.com
Fri Jan 16 16:44:58 EST 2009


Hi All,
I have setup a pipeline to generate contours. This works fine unless the
value specified is constant across some cells as described
in this previous post:
http://www.nabble.com/Contouring-through-constant-value-areas-of-dataset-tt1
9338704.html#a19338704

The result is no output. What I¹d like to do is detect when the contour
operation produces no output and reconnect the pipeline with a threshold
filter with the contour value set as the limits of the threshold like so:

{
...
contour.SetNumberOfContours(1);
contour.SetValue(scalarIndex, isoValue);
contour.SetInputArrayToProcess(0, 0, 0,
originalData.GetAssociationTypeAsString(0), filterScalar);

//force an update
contour.Update();

vtkAlgorithmOutput outputPort = contour.GetOutputPort();

   //attempt to check if output is empty
    if(contour.GetOutput() == null) //<==Always evaluates to true!!!!!!!!
   { 
      threshold.SetInputConnection(cell2PointData.GetOutputPort());
      threshold.SetInputArrayToProcess(0, 0, 0,
originalData.GetAssociationTypeAsString(0), filterScalar);
      threshold.ThresholdBetween(isoValue, isoValue);
      outputPort = threshold.GetOutputPort();
   }
 return outputPort;
}

The problem is that the output of the contour is always ³null² so I always
get the output of the threshold filter which is not what I want.

Any ideas on how to query the contour filter¹s output to see if it is empty?
Thanks in advance.
Gerrick

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090116/0cb5d47f/attachment.htm>


More information about the vtkusers mailing list