[vtkusers] multiple vtkScalars in one dataset?
Bill Lorensen
wlorens1 at nycap.rr.com
Tue Sep 19 22:10:37 EDT 2000
Try
fd2ad->Update()
before you GetScalarRange()
Recall that vtk filter don't execute until a request is made.
Bill
At 05:03 PM 9/19/00 -0700, christopher moore wrote:
>Okay - so I'm enlightened in the use of vtkFieldData now, but for one
>problem....
>
>I create a vtkRectilinearGrid dataset and associate a FieldData to it via
>the PointData. The FieldData has two variables (arrays) in it (salinity,
>and temperature).
>
>I use a FieldDataToAttributeDataFilter to set the Scalars of the dataset
>to one of the FieldData arrays (salinity).
>
>But something's wrong: the output of GetScalarRange is (0,1) instead of
>(0, 33.5768). The salinity array isn't properly assigned to the Scalars
>of the dataset....
>
>If I change the code and simply create a new instance of vtkScalars, and
>use the SetData method to access the FieldData array, and then associate
>the new vtkScalars with the dataset, it works fine.
>
>Why won't the FieldDataToAttributeDataFilter work?
>
>---------sample code----------------
>
> rg = vtkRectilinearGrid::New();
> totalSteps = LoadData(1);
>
> cout << "number of arrays: " << rg->GetPointData()->GetFieldData()->GetNumberOfArrays() << endl;
> cout << "first array name: " << rg->GetPointData()->GetFieldData()->GetArrayName(0) << endl;
> cout << "second array name: " << rg->GetPointData()->GetFieldData()->GetArrayName(1) << endl;
>
> vtkFieldDataToAttributeDataFilter *fd2ad = vtkFieldDataToAttributeDataFilter::New();
> fd2ad->SetInput(rg);
> fd2ad->SetOutputAttributeDataToPointData();
> fd2ad->SetInputFieldToPointDataField();
> fd2ad->SetScalarComponent(0,"salinity",0);
>
> float *something;
> something = rg->GetScalarRange();
> cout << "scalar range min: " << something[0] << endl;
> cout << "scalar range max: " << something[1] << endl;
>
>-----end code------------------------
>
>______________________________________________________________
>Christopher Moore tel 206.526.6779
>Research Scientist, Oceanography fax 206.526.6744
>University of Washington/JISAO/NOAA-PMEL
>--------------------------------------------------------------
More information about the vtkusers
mailing list