[vtkusers] triangulation
John Hunter
jdhunter at ace.bsd.uchicago.edu
Tue Jan 6 19:27:45 EST 2004
I have the x,y,z coordinates from CT data for a set of EEG electrodes
placed on the surface of the brain. The electrodes are arranged on an
8x8 grid and are placed on a flexible sheet of plastic; something like
a piece of Saran wrap layed across the surface of a balloon. The
electrodes thus have the topology of a structured grid. I want to
define a vtkStructuredGrid so I can reconstruct the surface of the
sheet on which the 8x8 electrodes are placed and do interpolation of
the EEG onto this surface.
I can do this fine using a vtkStructuredGrid, vtkDataSetSurfaceFilter,
and a vtkPolyDataMapper. I use the dimensions of the grid and then
order the electrodes so they fill the vtkStructuredGrid properly.
However, this puts an additional burden on the application users,
since they have to define the topology of the grids (of which there
are many for each patient), and on the application programmer (me!)
since I have to write all the code that enables them to do it.
Ideally, I could determine the structured grid topology
algorithmically.
My first attempt was using vtkDelaunay2D
grid = vtk.vtkUnstructuredGrid()
grid.SetPoints(points)
dela = vtk.vtkDelaunay2D()
dela.SetInput(grid)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(dela.GetOutput())
which worked OK but failed near the edges of the grid where there was
a fair amount of curvature. The wireframe revealed that generally
nearest neighbors were connected as they should be, but near the edges
of the grid there were some connections which skipped over nearest
neighbors. I suspect this is because the vtkDelaunay2D ignores the Z
coordinate. Two solutions come to mind. 1) transform the data so it
is maximally coplanar with the XY plane 2) use a vtkDelaunay3D
triangulation.
Which of these is the best route? I'm not sure if vtkDelaunay3D is
even appropriate for points which lie on a warped surface.
If 1) is best, what is the best way to transform a set of points onto
the XY plane? Minimize the sum of squares of the transformed Z
values? Is there an existing algorithm or example in VTK to perform
this task?
If 2) what is the approach? vtkDelaunay3D only returns a
vtkUnstructuredGrid, and I am not sure how to coerce this into a
useful data structure for me.
Thanks,
John Hunter
More information about the vtkusers
mailing list