[vtkusers] How do I test for an empty dataset?

W.T. Bridgman William.T.Bridgman.1 at gsfc.nasa.gov
Thu Oct 14 16:16:03 EDT 2004


I'm building some isosurfaces from an unstructured grid using 
vtkContourFilter.  In some cases, my isovalue of choice is beyond the 
data range.

I've got (in Python)

iso=vtkContourFilter()
iso.SetInput(stuff.GetOutput())
iso.SetValue(0,isovalue)
found=iso.GetOutput()

Sometimes, the PolyData object 'found' contains no data and generates 
an error on subsequent processing.

I've tried

found==None
found.GetNumberOfPolys()==0 (which always seems to evaluate as true!!)
len(found.GetPolys())==0

and a few others with no success.  I've not found any examples of this 
situation in the samples or discussed on the mailing list.

Suggestions?

Thanks,
Tom
--
Dr. William T."Tom" Bridgman               Scientific Visualization 
Studio
Global Science & Technology, Inc.          NASA/Goddard Space Flight 
Center
Email: William.T.Bridgman.1 at gsfc.nasa.gov  Code 935
Phone: 301-286-1346                        Greenbelt, MD 20771
FAX:   301-286-1634                        http://svs.gsfc.nasa.gov/




More information about the vtkusers mailing list