Problem with vtkMarchingCubes - no isosurface

Brent Burton brentb at io.com
Tue Nov 23 23:53:34 EST 1999


Hello, all.

Maybe somebody will point out what I'm doing wrong with this volumetric
pipeline.  The TCL pipeline is short, so I'll just post it, then describe
the problem.  Summary: an isosurface for a volumetric dataset created
from 6 PGM images is not being generated by vtkMarchingCubes.

#---- start of volume.tcl
vtkPNMReader pnmreader
  pnmreader SetFilePrefix "1.pgm"
  pnmreader SetDataSpacing 0.6 0.6 3.5
  pnmreader SetDataExtent 0 511 0 511 1 6
  [pnmreader GetOutput] ReleaseDataFlagOn

vtkImageShrink3D shrinker
  shrinker SetInput [pnmreader GetOutput]
  shrinker SetShrinkFactors 4 4 1
  shrinker AveragingOn

vtkStructuredPointsWriter spwriter
  spwriter SetInput [shrinker GetOutput]
  spwriter SetFileName six-pts.vtk

puts "vtkMarchingCubes mcubes"
vtkMarchingCubes mcubes
  mcubes SetInput [shrinker GetOutput]
  mcubes ComputeScalarsOff
  mcubes ComputeGradientsOff
  mcubes ComputeNormalsOff
  mcubes SetNumberOfContours 1
  mcubes SetValue 0 0.627
  mcubes DebugOn
  [mcubes GetOutput] ReleaseDataFlagOn
  puts "mcubes Update"
  mcubes Update

#---- remainder of PolyData pipeline removed
#---- end of volume.tcl

The vtkPNMReader loads in 6 PGM images, each being 512x512.  Next, the
volume is reduced to 128x128x6 with the shrinker, and the reduced
StructuredPoints set is written out to six-pts.vtk.  The output of the
shrinker is also sent to the MarchingCubes to generate one isosurface with
value 0.627.

I looked at six-pts.vtk in Emacs, and the data appears normal, varying
from about 0.2 to 0.8 as expected.  The isovalue of 0.627 is a legal
value.

The problem first came up with vtk2.0p1, which I was using until
yesterday.  vtkMarchingCubes::Execute() would simply crash.  I updated to
VTK 2.4 on Linux (Redhat 5.1) and it crashes also (built with shared
libraries).  I rebuilt the entire VTK --without-shared and now it doesn't
crash.

Using gdb, I set a breakpoint at vtkMarchingCubes::Execute() and stepped
through it.  The internal data type is VTK_UNSIGNED_CHAR.  After
the call to vtkMarchingCubesComputeGradient() (a static template fcn)
returns, the number of newPts and newPolys are 0 and 0 (I.e., nothing
generated).

VTK dumps the following error five times, then reports the
number of points and triangles:

  Debug: In vtkProcessObject.h, line 117
  vtkMarchingCubes (0x8c5ced8): vtkMarchingCubes (0x8c5ced8): returning
  AbortExecute of 0
  [*5]

  Debug: In vtkMarchingCubes.cxx, line 577
  vtkMarchingCubes (0x8c5ced8): Created: 0 points, 0 triangles


So that's what I'm seeing.  Anybody have an idea about this?
I would sure appreciate hearing any tips or corrections to the
pipeline.

Thanks for reading, and have a good Thanksgiving.

-Brent Burton



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list