[vtkusers] Problem (and suggestion): vtkProbeFilter renders black surface with points-only data set

warozzi at imation.com warozzi at imation.com
Wed Oct 11 07:38:30 EDT 2000


Hello all,

Consider the following pipeline:


vtkUnstructuredGrid (with point (x,y,z) and scalar (r,g,b) data only)
      V
vtkGaussianSplatter
     V
vtkContourFilter
     V
vtkProbeFilter  < source: vtkUnstructuredGrid (same one as above)
     V
vtkPolyDataMapper
     V
vtkActor


The result is a polydata object that has black scalar RGB values because vtkProbeFilter::Execute()
does the following:

    cell = source->FindAndGetCell(x,NULL,-1,tol2,subId,pcoords,weights);
    if (cell)
      {
      // Interpolate the point data
      outPD->InterpolatePoint(pd,ptId,cell->PointIds,weights);
      }
    else
      {
      outPD->NullPoint(ptId);
      }

"if(cell)" always fails when the probe filter's source is an unstructured grid containing only point data and associated
RGB scalars, hence the black scalar attribute data in the output.  (Unfortunately one needs to dig into the source to see why
their point data probe failed to render the expected color poly data.)

To overcome this issue, I replaced the line outPD->NullPoint(ptId) with a call to a function of my own design that finds the
point in the source data that is closest to the probed point and colors the output with scalars from that closest point.  For my
reasonably small datasets (approx 15k points in the source and probe to search), this is acceptable. For others this solution
may be too time consuming.  Is there a better way (using vtk obkects, that is) to get scalars from point-only data?  If not, what
I'd like to suggest is a modification along the lines of the following:

    cell = source->FindAndGetCell(x,NULL,-1,tol2,subId,pcoords,weights);
    if (cell)
      {
      // Interpolate the point data
      outPD->InterpolatePoint(pd,ptId,cell->PointIds,weights);
      }
    else
      {
      if(this->PointSearchEnabled) {
             // color probe point with scalars from closest point (or an optimized method
             // for getting scalars from point-only data provided by some vtk wizard)
             DoPointSearch(...);
       }
       else {
             outPD->NullPoint(ptId);
        }
      }

PointSearchEnabled would be a boolean ivar  that could turn point searching on for smaller data sets.  I'd be happy to provide
my version of the modified probe filter object if there's interest.

Regards,
     Bill Rozzi







More information about the vtkusers mailing list