[vtkusers] Filter to change vtkDataArray name?

Cory Quammen cquammen at cs.unc.edu
Thu Oct 21 10:44:03 EDT 2010


>>> Is there a filter that will change the name of a particular data array
>>> in a vtkDataSet?
>>>
>>> I'll explain my need. I am using vtkImplicitModeller to compute
>>> distances of points from a surface. I'd like to use these distance
>>> scalars in vtkArrayCalculator, but the vtkDataSet produced by
>>> vtkImplicitModeller does not have a name. So far I haven't been able
>>> to figure out how to access these scalars in vtkArrayCalculator. If I
>>> modify vtkImplicitModeller.cxx to set the name of the output scalars,
>>> I can use it in the calculator with no problem.
>>>
>>> Thanks in advance for the help,
>>> Cory
>>
>> If ImplicitModeller sets that array as the active scalars, you should be
>> able to do
>> modeller->GetOutput()->GetScalars()->SetName("YourArray");
>> David
>
> David,
>
> Thanks for your response.
>
> If I do as you suggest, won't the name get clobbered if there are
> upstream changes in the pipeline? I'll be changing the upstream
> filters frequently.
>
> Thanks,
> Cory
>

David,

I tried essentially what you suggested, and it appears to work.

modeller->Update();
modeller->GetOutput()->GetPointData()->GetArray(0)->SetName("Distance");

I'm still nervous about the name getting clobbered, though. Maybe my
concern is unfounded?

Thanks,
Cory

-- 
Cory Quammen
Computer Integrated Systems for Microscopy and Manipulation (CISMM)
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen



More information about the vtkusers mailing list