[vtkusers] How to assign a three-component scalar cell attribute with vtkFieldDataToAttributeDataFilter?

Alain CORON alain.coron at lip.bhdc.jussieu.fr
Wed May 21 09:46:40 EDT 2003


Hello,

I wish to create a vtkStructuredPoints with a three unsigned char component
(RGB) scalar cell attribute.  My pipeline is:

          vtkProgrammableDataObjectSource     (generate a field with 3
                      |                          vtkUnsignedCharArray
                      |                       )
                      |
            vtkDataObjectToDataSetFilter      (assign a topology and geometry)
                      |
         vtkFieldDataToAttributeDataFilter    (assign attributes)
                      |
                  vtkMapper
                      |
                  vtkActor
                 ..........

In order to assign attributes, I call three times the method
SetScalarComponent of my vtkFieldDataToAttributeDataFilter filter (Please
see the complete attached C++ source file):

  vtkFieldDataToAttributeDataFilter *concreteDataSetWithCellAttributes 
    = vtkFieldDataToAttributeDataFilter::New();
  concreteDataSetWithCellAttributes->SetInput( concreteDataSet->GetOutput() );
  concreteDataSetWithCellAttributes->SetInputFieldToDataObjectField();
  concreteDataSetWithCellAttributes->SetOutputAttributeDataToCellData();
  concreteDataSetWithCellAttributes->SetScalarComponent(0, "R", 0);
  concreteDataSetWithCellAttributes->SetScalarComponent(1, "G", 0);
  concreteDataSetWithCellAttributes->SetScalarComponent(2, "B", 0);
  concreteDataSetWithCellAttributes->Update();

Unfortunately the scalar cell attribute of the filter output has one
component but not three.   Do I miss something?

Thanks for your help.
-- 
Alain CORON                   mailto:alain.coron at lip.bhdc.jussieu.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestVtkFieldToAttributeFilter.cpp
Type: text/x-c++src
Size: 4477 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030521/743628f1/attachment.cpp>


More information about the vtkusers mailing list