[vtkusers] Create (a colored) Surface

Deacon John Sweeney sweeney.2 at wright.edu
Mon Sep 6 18:33:59 EDT 2004


Hi.

This message follows a thread dated 1999, pasted to the bottom of this email. I'm working on a molecular viewer with vtk. I have been experimenting for some time with the display of molecular surfaces, and independently came up with the approaches described by Dr. Schroeder (below). 

For one function (approach 1) I create a PolyData whose points and vertices are atomic coordinates, then I use the vtkImplicitModeler to calculate distances for a vtkContourFilter. The results are fairly impressive, giving a fairly high-resolution model in just several seconds for medium sized proteins. 

For another function (approach 2) I create a vtkImplicitBoolean and add sphere functions to it for each atom. Then I run a contour over a vtkSampleFunction output. The advantage to this approach is that different radii can be represented. The disadvantage is that this approach is slower, but that's ok.

The real problem I'm having is in coloring the surface. My atoms know what color they should be, so I've tried adding color as a scalar to the initial PolyData for approach 1. I figured that out, but these scalars are lost when the vtkImplicitModeler (apparently) replaces the scalars with distances. So, I've tried to use the vtkProbeFilter to give color scalars from the polydata points to the contour points. 

I'm pretty sure it is working because my probe gets 3 components in its pointScalars (the color rgb vals), unlike the contour which has 1 (the distance). However these values are interpolated for the points of the isosurface, whereas I need them to be simply copied from the polydata point from which it (the contour point) was generated.

Does anyone have any suggestions? I think this approach makes sense, and would love for it to work, but I wouldn't mind starting over either.

Deacon Sweeney








Previous Thread:



Hi Luis-

At 11:47 AM 9/15/99 +0100, Luis Miguel Gonçalves wrote:
>Greetings!, VTK users,
>
>         I can already visualize molecules using pdbs in VTK...I have a set of
>points that correspond to types of atoms, and each point represents the
>center of a sphere with the correspondent colour and radius....What I want
>is to create a surface from those spheres...I don't want to see the
>interception of the spheres...I want a smooth surface around them...Can
>anyone help?

Two ideas come to mind. Use the implicit function vtkSphere along with vtkImplicitBoolean, and vtkSampleFunction  to create a union (a sampled volume) of all the "spheres" that make up the molecule, and then isosurface the resulting implicit function (with value=0.0) to get a single surface. Alternatively, you could volume render the sampled volume. Look at the examples graphics/examplesTcl/iceCream.tcl for an example.

Another approach is to use vtkImplicitModeler to create a sampled function (of distance function) and then isosurface/volume render that.

If you're going to volume render you're going to have to convert from float to something the volume renderer can handle (e.g., unsigned short). Also, I'm not sure what you're going to do about coloring the surface.

Will







More information about the vtkusers mailing list