Problem with vtkDataSetMapper::SetScalarModeToUseCellData()

william e lorensen lorensen at esopus.crd.ge.com
Wed Mar 8 09:27:53 EST 2000


Paul,
	Good find! And thanks for the illustrative example.

Seems like vtkDataSetMapper invokes vtkImageToStructuredPoints on its
SetInput if the input is vtkImageData. In prior releases, vtkImageData 
was a subclass of vtkStructuredPoints. Now it's reversed.

vtkImageToStructuredPoints was not passing cell data (nor field data).
You can either grab tongith;s build or add the followings lines to
vtkImageToStruturedPoints::Execute

replace:
   output->GetPointData()->PassData(data->GetPointData());

with:
 if (data->GetPointData())
   {
   output->GetPointData()->PassData(data->GetPointData());
   }
 if (data->GetCellData())
   {
   output->GetCellData()->PassData(data->GetCellData());
   }
 if (data->GetFieldData())
   {
   output->GetFieldData()->ShallowCopy(data->GetFieldData());
   }

I've also taken the liberty of adding your example as a regression
test.

Thanks,

Bill

>> In vtk 3.1, vtkDataSetMapper doesn't seem to recognize cell data.
>> This is illustrated by the test program below. A structured points
>> data set with cell data is rendered by both vtkDataSetMapper and
>> by vtkPolyDataMapper (the latter via vtkGeometryFilter). The
>> vtkDataSetMapper appears to have lost the scalar data as the
>> resultant grid is white. In vtk 2.3, both pipelines lead to
>> identical images.
>> 
>> This is not a severe program because one can always work around
>> it by using vtkGeometryFilter and vtkPolyDataMapper.
>> 
>> Thanks.
>> Paul



--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list