[vtkusers] how to get the scalar or vector data from vtkstructuredgrid
Soumya Dutta
soumya.nsec at gmail.com
Tue Nov 5 10:28:42 EST 2013
Hi David,
thanks for the suggestion.. I am now able to get the data
vtkPointData* vals;
vals = data->GetPointData();
vtkDataArray* arr;
arr = vals->GetArray(0);
arr->GetTuple(i,value);
this gives the values..
do you know how I can draw isosurface in this structured grid data? I know
I can not do volume rendering.. but does vtk allow drawing isosurafce in a
structured grid ?
I can draw isosurface using paraview. SO I am assuming that it is possible.
On Tue, Nov 5, 2013 at 9:11 AM, David Doria <daviddoria at gmail.com> wrote:
> On Mon, Nov 4, 2013 at 5:43 PM, Soumya Dutta <soumya.nsec at gmail.com>
> wrote:
> > Hi All,
> >
> > I am new to vtk and trying to find my way to use vtk structuredgrid. I
> have
> > a plot3d data that has several variable and vectors. I loaded the file
> using
> > following code:
> >
> > vtkSmartPointer<vtkMultiBlockPLOT3DReader> reader =
> > vtkSmartPointer<vtkMultiBlockPLOT3DReader>::New();
> > reader->SetXYZFileName(xyzFilename.c_str());
> > reader->SetQFileName(qFilename.c_str());
> > reader->SetAutoDetectFormat(1);
> > reader->SetScalarFunctionNumber(110);
> > reader->SetVectorFunctionNumber(200);
> >
> >
> > the I did the following to convert it into a structured grid:
> >
> > vtkSmartPointer<vtkStructuredGrid> sgrid =
> > vtkSmartPointer<vtkStructuredGrid>::New();
> > sgrid =
> vtkStructuredGrid::SafeDownCast(reader->GetOutput()->GetBlock(0));
> >
> > now how can I can I access individual scalar values from this grid data
> > structure?
> >
> > If I do the following:
> >
> > vtkPoints* pts;
> > pts = sgrid->GetPoints();
> >
> > I think I am getting the x,y,z locations of the points.. but I am not
> able
> > to access the fields and their scalar values. Any kind of help would be
> > appreciated.
> >
> > --
> > Yours' Sincerely,
> > Soumya Dutta
>
> Are you looking for vtkPointData* pointData = sgrid->GetPointData()?
>
> There are some examples that explain how to set and retrieve data from
> points and cells (the examples are mostly for vtkPolyData, but they
> should apply to vtkStructuredGrid as well):
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/MiscPointData
>
> David
>
--
*Yours' Sincerely*,
Soumya Dutta
Graduate Student
Department of Computer Science and Engineering
The Ohio State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131105/ca2bf05a/attachment.htm>
More information about the vtkusers
mailing list