[vtk-developers] vtkAssignAttribute and vtkImageData

Miller, James V (Research) millerjv at crd.ge.com
Fri Sep 27 11:41:56 EDT 2002


There seems to be a problem with vtkAssignAttribute operating on ImageData.
 
We were using vtkAssignAttribute to take the vectors of a dataset and use them as multi-component
scalars.
When the dataset is an ImageData, the output of the vtkAssignAttribute filter does not adjust the 
NumberOfScalarComponents of the ImageData.
 
These problem arises because ImageData caches the NumberOfScalarComponents from the scalars
array.  When the number of components in the scalars are changed, the ImageData needs to be told.
vtkAssignAttributes works generically on DataSets so it doesn't know its operating on an ImageData
and thus doesn't tell the ImageData that new number of scalar components.
 
If a filter after the vtkAssignAttribute in the pipeline querys the
ImageData::GetNumberOfScalarComponents()
instead of ImageData::GetScalars()->GetNumberOfScalarsComponents() then it will not operate properly.
 
Possible solutions:

1.	vtkAssignAttributes could check whether it is operating on ImageData and whether the scalars
are being modified and the adjust the NumberOfScalarComponents on the ImageData appropriately. This
is not too bad an option if ImageData is the only dataset type that caches this information.
2.	Change ImageData::GetNumberOfScalarComponents()/SetNumberOfScalarComponents() to delegate
these calls to the scalars DataArray instead of caching the values.  This could impact how people are
constructing ImageData (where they would set the NumberOfScalarComponents on an ImageData, then have
the allocate procedures create a scalars DataArray with the proper number of components.
3.	Deprecate ImageData::GetNumerOfScalarComponents()/GetNumberOfScalarComponents()

 
 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Jim Miller 
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv at research.ge.com <mailto:millerjv at research.ge.com> 

james.miller at research.ge.com
(518) 387-4005, Dial Comm: 8*833-4005, 
Cell: (518) 505-7065, Fax: (518) 387-6981 

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20020927/9f1a6d7c/attachment.html>


More information about the vtk-developers mailing list