[vtkusers] visualizing a vtkRectilinearGrid

tom fogal tfogal at apollo.sr.unh.edu
Fri Jun 4 11:57:53 EDT 2004


Well, that fixed one of the problems =)

If I add in the allocation for the vtkRectilinearGrid it gets rid of my
segfault, but I get a new error:

ERROR: In /my/source/dir/vtkRectilinearGrid.cxx, line 416
vtkRectilinearGrid (0x516910): Requesting a point from an empty data set.

So it appears as if my data set is empty. One would get this message
when vtkRectilinearGrid::DataDescription = VTK_EMPTY, according to the
source, and DataDescription is set in SetExtent(), for example. So I called
SetExtent with the dimensions of my array and then set a breakpoint there - 
the DataDescription is getting set to 8, which is VTK_XYZ_GRID according to
vtkStructuredData.h
Yet when it gets time to render the data, DataDescription is suddenly 
VTK_EMPTY? There must be some intermediate call that is changing it...

My code is now like this:

   vtkRectilinearGrid *output = (vtkRectilinearGrid*) this->GetOutput();
   output = vtkRectilinearGrid::New();
   output->SetDimensions(dim[IND_X],dim[IND_Y],dim[IND_Z]);
   output->UpdateInformation();
   output->SetWholeExtent(0,391,0,111,0,111);
   output->SetExtent(0,391,0,111,0,111);
   output->SetXCoordinates(rdata[IND_X]);
   output->SetYCoordinates(rdata[IND_Y]);    
   output->SetZCoordinates(rdata[IND_Z]);

where dim = {392, 112, 112}.
I think calling SetWholeExtent() and SetExtent() is redundant, but it doesn't
seem to matter whether or not I call both, one or the other, or none at all - 
I still get the 'empty data set' error.

Any ideas?

-tom

 <4EB6E1738CC2E940BAD2EFBFBF5A38F101C3B208 at OREADE.ipsn.fr>ALIZIER Julien AUSY writes:
>Hi Tom, hi all,
>
>I had a similar problem few months ago when I was testing rectilinear grids.
>I had to call these lines (//***) in my constructor (without them I was
>getting a segmentation fault ):
>
>vtkRectilinearGrid * myoutput = vtkRectilinearGrid::New();
>myoutput->SetDimensions(4,5,6);
>//myoutput->UpdateInformation();   //*** I can't remember if that one is
>really needed
>myoutput->SetWholeExtent(0, 1, 0, 2, 0, 3); //*** This one is IMPORTANT
>
>
>Hope this helps
>
>-- Julien
>
>
>-----Message d'origine-----
>De : tom fogal [mailto:tfogal at apollo.sr.unh.edu]
>Envoyé : jeudi 3 juin 2004 18:42
>À : vtkusers at vtk.org
>Objet : [vtkusers] visualizing a vtkRectilinearGrid
>
>
>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
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list