BUGRPT: Gaussian Splatter core dump

Randall Hopper aa8vb at yahoo.com
Mon May 15 13:17:52 EDT 2000


Continuing to look back at VTK issues I tabled while working on a project.

Here's a code bite that I distilled from a tool I wrote.  Gaussian splatter
core dumps if SPLAT_RADIUS_DIVISOR (at the top) is set to 20.  Set it to 10
(or lower generally) and splat works fine.

Could have something to do with the splats getting too thin.

-- 
Randall Hopper
aa8vb at yahoo.com
-------------- next part --------------
#!/usr/bin/env python
"""  VTK dumps core with SPLAT_RADIUS_DIVISOR = 20 (FP overflow).
"""

from libVTKCommonPython import *
from libVTKGraphicsPython import *
from libVTKImagingPython import *

SPLAT_RADIUS_DIVISOR = 20.0
#SPLAT_RADIUS_DIVISOR = 10

peacock = ( 0.2000, 0.6300, 0.7900 )

# Create the renderer, render window, and interactor
ren_win = vtkRenderWindow()
ren     = vtkRenderer()

ren.SetBackground( .8, .8, 2 )
ren_win.AddRenderer( ren )
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow( ren_win )
ren_win.SetSize( 640, 480 )

#
# Build a points-only polydata dataset
#
verts = [[ 0.03125,     5.03125   ,  0. ],
         [ 0.03125,     5.11530161,  0. ],
         # ...rows deleted for example purposes...
         [ 0.03125,     6.79633617,  0. ],
         [ 0.03125,     6.88038778,  0. ],
         [ 0.03125,     6.96443987,  0. ]]

points = vtkPoints()
for vert in verts:
  points.InsertNextPoint( vert[0], vert[1], vert[2] )

poly_ds = vtkPolyData()
poly_ds.SetPoints( points )
poly_ds.ComputeBounds()

def SplatActor( poly_ds ):
  splatter = vtkGaussianSplatter()
  splatter.SetInput( poly_ds )
  splatter.SetSampleDimensions( 100, 60, 5 )
  splatter.SetScaleFactor( 1.0 )
  splatter.SetRadius( 0.3125 / SPLAT_RADIUS_DIVISOR )

  grid_size = (40.0, 10.0)
  bounds = [ 0.0, 40.0, 0.0, 10.0, -0.3125, 0.3125 ]
  cell_size = 0.3125
  bounds[4] = -cell_size
  bounds[5] = cell_size
  splatter.SetModelBounds( bounds )

  contour = vtkContourFilter()
  contour.SetInput( splatter.GetOutput() )
  contour.SetValue( 0, 0.5 )

  mapper = vtkPolyDataMapper()
  mapper.SetInput( contour.GetOutput() )
  mapper.ScalarVisibilityOff()

  actor = vtkLODActor()
  actor.SetMapper( mapper )
  actor.GetProperty().SetDiffuseColor( peacock )

  return actor

# Splat actor
splat_actor = SplatActor( poly_ds )
ren.AddActor( splat_actor )

# enable user interface interactor
ren_win.Render()
iren.Initialize()
iren.Start()


More information about the vtkusers mailing list