SelectInputScalars, Re: [vtk-developers] vtkAssignAttribute and vtkImageData

Charles Law charles.law at kitware.com
Fri Sep 27 12:43:39 EDT 2002


At 11:41 AM 9/27/2002 -0400, Miller, James V (Research) wrote:
>There seems to be a problem with vtkAssignAttribute operating on ImageData.
>
>    * 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.
I agree with Lisa that the first op[tion would have the least impact on 
developers.
>    * 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.
This is almost the same as the next option, and has the same issues.
>    * Deprecate 
> ImageData::GetNumerOfScalarComponents()/GetNumberOfScalarComponents()
Although I like this option, it does greatly impact image filters.  Unlike 
other sources, vtkImageSource superclass allocates the scalars before the 
Execute method is called.  If this "Information" was depriciated, imaging 
filters would have to allocate their own scalars (just like the graphics 
filter).  This would be more consistent, but would impact people who had 
code that was not a part of the official VTK repository.




Another option is to get rid of the need for the assign attributes filter 
:)  This is something I have been quietly supporting for a while.  I have 
tested adding methods like SelectInputScalars/SelectInputVectors to filters 
so they can process arbitrary arrays without the need for an assign 
attributes.  This feature makes it much easier to process the field arrays 
which are not official attributes (take a look at vtkContourFilter).

This experimental feature was added after the release of 4.0, and will 
either be propagated throughout all VTK filters (when it applies) or 
removed for the upcoming release.  Does anyone have any opinions about this?

Charles.








More information about the vtk-developers mailing list