[vtkusers] Getting a volume's contour vertices
Mattia "Raibaz" Tommasone
giuseppe.tommasone at tiscali.it
Fri Sep 22 11:56:27 EDT 2006
Ok, second question of the day, for which i spent the whole day digging
through the archives and googling around and yet i didn't find any clues:
I'm working on a haptic volume renderer, and my haptic API (which, by
chance, is Sensable's HDAPI/HLAPI) needs the shapes to be rendered
directly via OpenGL commands, i.e. glVertex*; thus, i was hoping to use
vtk to load a volume file which can be in raw, stl or any other format
(i still have to decide the format to use), then retrieving its outline
vertices' coordinates, store them somewhere in memory and then feed them
to OpenGL commands to render the outline itself instead of using the vtk
renderer.
The approach i followed until now is described here in pseudocode for
briefness:
- Read a .vtk file with a vtkStructuredPointsReader
- Filter the structured points with a vtkContourFilter
- Store contour->GetOutput()->GetPoints() elements in a vector
- Iterate through the vector and draw a GL_POINT for each vector element
What i'm getting, however, is not the external surface of the volume,
but seems more like a scattered group of points...needless to say that
if i try drawing the points as GL_LINES or any other OpenGL drawing
mode, the result is even worse...
So, what am i missing?
- vtkContourFilter isn't the right filter to get a volume's external
surface
- vtkPolyData::GetPoints() isn't the right method to get a vtkPolyData's
vertices to be drawn via OpenGL
- What i'm looking for simply can't be done via vtk (which seems
impossible to me)
- I googled for the wrong query strings and somebody can give me better
hints
Hope somebody can help, this is the basis for my graduation thesis and
i'm totally stuck...
Mattia Tommasone
More information about the vtkusers
mailing list