[vtkusers] pb using vtkPolyDataToImageStencil

Dean Inglis dean.inglis at on.aibn.com
Wed Nov 6 15:31:26 EST 2002


Hi,

my pipeline consists of a spline
represented by points and line segments
encapsulated in a vtkPolyData object. 
I am passing the polydata into a
vtkPolyDataToImageStencil to try
to generate a stencil consisting
of discrete points, not area
regions, for passing into a
vtkImageAccumulate filter.  The
accumlate filter will be used to generate
a histogram.

It seems that the polydatatoimagestencil
does not function poperly in this
situation as a call to the
accumulate filter with GetVoxelCount returns
zero.


any ideas? 

Dean

code snippit:

  vtkPolyData* poly = vtkPolyData::New();
    spline->GetPolyData(poly);

  vtkImageData* data = v16->GetOutput();
  float* range = data->GetPointData()->GetScalars()->GetRange();
  int numBins = static_cast<int>(range[1]);
  float origin = range[0];
  float spacing  = (range[1] - origin)/numBins;

  vtkPolyDataToImageStencil* pd2is = vtkPolyDataToImageStencil::New();
    pd2is->SetInput(poly);

  vtkImageAccumulate* accumulate = vtkImageAccumulate::New();
    accumulate->SetComponentExtent(0, numBins - 1, 0, 0, 0, 0);
    accumulate->SetComponentOrigin(origin, 0, 0);
    accumulate->SetComponentSpacing(spacing, 1, 1);
    accumulate->SetInput(v16->GetOutput());
    accumulate->SetStencil(pd2is->GetOutput());
  
  




More information about the vtkusers mailing list