[vtkusers] visualizing a vtkRectilinearGrid

tom fogal tfogal at apollo.sr.unh.edu
Thu Jun 3 12:42:26 EDT 2004


Hi all, I've managed to create a vtk object for loading a new data
format that my group uses. It's derived from vtkRectilinearGridSource,
and I can't seem to find a good way to visualize the output so that
I can see if I actually got things loaded correctly =)

I set the output within the object with code like the following:

---
vtkRectilinearGrid *output = (vtkRectilinearGrid*) this->GetOutput()
output->SetDimensions(x,y,z);
output->SetXCoordinates(data[0]);
output->SetYCoordinates(data[1]);
output->SetZCoordinates(data[2]);
---

where data is declared like 'vtkFloatArray *data[3]'. I can print out
the data within the array and they seem to be good; for example,
'print data[0]->Array[0]' works fine (and has the correct data) in
gdb.

In an attempt to visualize , I create a vtkRectilinearGridGeometryFilter
and SetInput() from my Reader's GetOutput(). A PolyDataMapper gets its
input from the GeometryFilter's output, and that gets passed to an
actor, to a renderer and then displayed.

Only I get a segmentation fault when trying to Execute() the filter.
It eventually ends up that down in vtkRectilinearGrid::GetPoint I have
'XCoordinates' as a NULL pointer and it is dereferenced.

Am I doing something wrong here, or forgetting to set some component
of my rectilinear grid? I was hoping to get some sort of IsoSurface
but I'd settle for just about anything showing up on my screen at this
point.

Any ideas would be greatly appreciated.

-tom



More information about the vtkusers mailing list