<HTML>
<HEAD>
<TITLE>Detecting success/failure of a polydataalgorithm (vtkContourFilter)</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi All,<BR>
I have setup a pipeline to generate contours. This works fine unless the value specified is constant across some cells as described<BR>
in this previous post:<BR>
<a href="http://www.nabble.com/Contouring-through-constant-value-areas-of-dataset-tt19338704.html#a19338704">http://www.nabble.com/Contouring-through-constant-value-areas-of-dataset-tt19338704.html#a19338704</a><BR>
<BR>
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:<BR>
<BR>
{<BR>
...<BR>
contour.SetNumberOfContours(1);<BR>
contour.SetValue(scalarIndex, isoValue);<BR>
contour.SetInputArrayToProcess(0, 0, 0, originalData.GetAssociationTypeAsString(0), filterScalar);<BR>
<BR>
//force an update<BR>
contour.Update();<BR>
<BR>
vtkAlgorithmOutput outputPort = contour.GetOutputPort();<BR>
<BR>
//attempt to check if output is empty<BR>
if(contour.GetOutput() == null) //<==Always evaluates to true!!!!!!!!<BR>
{ <BR>
threshold.SetInputConnection(cell2PointData.GetOutputPort());<BR>
threshold.SetInputArrayToProcess(0, 0, 0, originalData.GetAssociationTypeAsString(0), filterScalar);<BR>
threshold.ThresholdBetween(isoValue, isoValue);<BR>
outputPort = threshold.GetOutputPort();<BR>
}<BR>
return outputPort;<BR>
}<BR>
<BR>
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.<BR>
<BR>
Any ideas on how to query the contour filter’s output to see if it is empty?<BR>
Thanks in advance.<BR>
Gerrick<BR>
<BR>
</SPAN></FONT>
</BODY>
</HTML>