[vtkusers] help needed setting up the colormap/lookuptable/mapper in C++

Dominik Szczerba domi at vision.ee.ethz.ch
Mon Aug 13 08:28:16 EDT 2007



David, John wrote:
> 
>> You could use vtkDoubleArray or vtkFloatArray to set up the scalars:
>>
>> vtkDoubleArray *scalars = vtkDoubleArray::New();
>> for (i=0; !in.eof() && in.good(); i++)
>> {
>>     in >>  v;
>>     scalars.InsertNextValue(v);
>> }
>> polyData->SetScalars(scalars);
> 
> 
> Hmmm...  That gives me a compile error:
> 
>   'class vtkPolyData' has no member named 'SetScalars'

of course, because it is a pointer and not an object. use -> instead
as to setScalars, add getPointData() (or getCellData()) in the middle.
- Dominik


> 
> I thought that maybe I had to go through a PolyDataMapper, but that did not work as well.  
> Poking around a little I found that the SetScalars method is defined in vtkDataSetAttributes.h, vtkMergeFilter.h, and ./vtkSampleFunction.h.  Do I have to set up a merge filter to set the scalers?  Any other suggestions?
> 
> 
> BTW, I defined the polyData and mapper as follows:
> 
> vtkPolyData *polyData = vtkPolyData::New();
> vtkPolyDataMapper *aMapper = vtkPolyDataMapper::New();
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-- 
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi



More information about the vtkusers mailing list