[vtk-developers] vtkAssignAttribute and vtkImageData
Jeff Lee
jeff at cdnorthamerica.com
Fri Sep 27 11:57:36 EDT 2002
Won't vtkExtractVectorComponents work for you?
-Jeff
Miller, James V (Research) wrote:
> 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()
>
>
>
>
> *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/
>
>
>
>
More information about the vtk-developers
mailing list