Attribute Data Questions
Will Schroeder
will.schroeder at kitware.com
Fri Jul 2 09:28:12 EDT 1999
Hi Brian-
At 03:38 PM 7/1/99 -0400, Brian Adams wrote:
> I am a little confused as to how vtk handles attribute data like vectors,
>scalars and field data. I am not exactly sure the best way to phrase my
>"problem" so first here are a few general questions I had..
>
>1) Where in the vtkPolyData is this attribute data stored?
Every subclass of vtkDataSet (of which vtkPolyData is one) has two sets of attribute data: vtkPointData and vtkCellData. These objects gather the scalars, vectors, tensors, normals, texture coords, and field data (in arbitrary combination) together for points and/or cells.
>2) How can I get/set/change this data?
Normally you get it as: scalars = aDataSet->GetPointData()->GetScalars() etc. and set it as aDataSet->GetPointData()->SetScalars(scalars). In this case the scalars object contains scalar values implicitly associated with points and cells (by point id and cell id). The developer is responsible for creating the scalars, etc. If you change values, pay attention to modified time and it's bad etiquette to change the input data inside a filter: copy the input or somehow create output that is derived from the input (there are several ways to pass data through via reference counting or doing point-by-point copies found in vtkDataSetAttributes). The best way to learn is to look at some simpler filters like vtkCubeSource, vtkShrinkFilter, or vtkElevationFilter.
> One specific application we are working on is to have a set of two
>principle direction vectors and a normal vector associated with each point in a
>data set.
> We have run into two problems. We can store all this information in one vtk
>data file and extract it as vtkPolyData, but that only allows us to extract one
>vector for each vtkPolyData set.
> The other solution was to create 3 separate vtkVectors. But, how would you
>extract those from a vtk data file? It seems like you can only get the name.
>(It looks like we might be able to extract them using
vtkFieldData was made for the situation you describe. In field data, which looks like an "array of arrays", you can put most anything and mix types. The challenge then becomes extracting the pieces of field data you want for input to various algorithms. Look at example Tcl scripts like financialField.tcl, financialField2.tcl, or fieldToSGrid.tcl (the key class is vtkFieldDataToAttributeDataFilter). Also look at the example data file fieldfile.vtk and the description of vtkfile formats on the VTK home page.
Will
--------------------------------
Dr. William J. Schroeder
Kitware Visualization Solutions / vtk Commercial Support
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 (Phone & Fax)
-----------------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>. For help, send message body containing
"info vtkusers" to the same address. Live long and prosper.
-----------------------------------------------------------------------------
More information about the vtkusers
mailing list