[vtkusers] Histogram of a data array?

Steve Boyd boyd at biomed.ee.ethz.ch
Mon Jun 3 11:15:35 EDT 2002


Hello,

I would like to calculate a histogram of some scalar data that is
associated with a vtkUnstructuredGrid dataset.  How do I convert my
vtkDataArray into vtkImageData (single component) so that I can use
vtkImageAccumulate to calculate the histogram?  I think it should be
something like this, but not sure how to convert the data array:

  vtkUnstructuredGrid *ug;

  vtkDataArray *data = ug->GetPointData()->GetScalars();

  // ?? vtkDataArrayToImageDataFilter ??
  vtkDataArrayToImageDataFilter *imageData;
    imageData->SetInput(data);

  vtkImageAccumulate *histogram;
    histogram->SetInput(imageData->GetOutput());

I'm using vtk4.x on VC++.

Thanks,

Steve
-- 
Steven Boyd, PhD

Institute for Biomedical Engineering
ETH and University Zuerich
Moussonstrasse 18
8044 Zuerich, Switzerland

tel. +41.1.632.4591  fax. +41.1.632.1214  boyd at biomed.ee.ethz.ch
-------------------------------------------------------------------



More information about the vtkusers mailing list