[vtk-developers] vtkAssignAttribute and vtkImageData

Lisa Avila lisa.avila at kitware.com
Fri Sep 27 12:01:35 EDT 2002


Hello Jim,

Considering how close you are to Bill, I can't even believe you would 
suggest option 3 (deprecation)! :-)

Your middle option would also have a serious impact on developers since it 
is common to specify the important parameters directly in the vtkImageData 
(such as scalar type and number of components) then call 
this->AllocateScalars(). Unless this sequence of events still works as 
before, this would not be a good option.

Although the second two options are probably cleaner, I would have to vote 
for the first to reduce the impact on developers.

Lisa


At 11:41 AM 9/27/2002, 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:
>    * 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.
>    * 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.
>    * 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
>
><mailto:millerjv at research.ge.com>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/05a8cfe5/attachment.html>


More information about the vtk-developers mailing list