[vtkusers] marching cubes issues..

Maneesh Yadav 97yadavm at utsc.utoronto.ca
Thu Aug 9 17:41:34 EDT 2001


Hi all (again),
I've got things running now with my data (I eventually had to convert my
tiffs to pnms becuase of LZW issues)
Now I have  segmented data (if anyone is interested in the mouse atlas
paper, it is in a recent Developmental Biology, give me a mail if you
need/want to find it) and when I visualize the volumes things are
fine, and when I use thresholding things are still ok (if I pick the value
for the spine, and use vtkImageThreshold, I get a nice spine), however
when I try to contour the data, none of the filters complain about
anything, but the poly file that I write out with vtkPolyDataWriter seems
like junk (I have to scale out light years, and it just seems like a
really long triangle).  The pipeline is the one described in
Bill Lorensen's tutorial at:

http://users.info.unicaen.fr/~karczma/docs/vtkhtml/applications/segment/segmented16.html

(the parameters I use are default values that in the above URL)

I am little confused as to use vtkMarchingCubes, vtkImageMarchingCubes, or
vtkMarchingContourFilter

Here's the main part of the code:
------------------------------------------------------------------------------------

tissueValues[tissue]=206

threshold.SetInput(reader.GetOutput())
 threshold.ThresholdBetween(tissueValues[tissue], tissueValues[tissue])
 threshold.SetInValue(255)
 threshold.SetOutValue(0)
 threshold.GetOutput().ReleaseDataFlagOn()

 shrinker.SetInput(threshold.GetOutput())
 shrinker.SetShrinkFactors(options['SAMPLE RATE'][0],options['SAMPLE
RATE'][1],options['SAMPLE RATE'][2])
 shrinker.GetOutput().ReleaseDataFlagOn()

 smoothedTissueData.SetInput(shrinker.GetOutput())
 smoothedTissueData.SetDimensionality(3)
 smoothedTissueData.SetStandardDeviation(options['GAUSSIAN STDDEV'])
 smoothedTissueData.ReleaseDataFlagOn()

#EVERYTHING UP TILL HERE SEEMS OK

 mcubes.SetInput(smoothedTissueData.GetOutput())
 mcubes.ComputeScalarsOff()
 mcubes.ComputeGradientsOff()
 mcubes.ComputeNormalsOff()
 mcubes.SetValue(0,128)
 mcubes.GetOutput().ReleaseDataFlagOn()

 decimator.SetInput(mcubes.GetOutput())
 decimator.SetInitialFeatureAngle(options['DECIMATE ANGLE'])
 decimator.SetMaximumIterations(options['DECIMATE ITERATIONS'])
 decimator.SetMaximumSubIterations(0)
 decimator.PreserveEdgesOn()
 decimator.SetMaximumError(1)
 decimator.SetTargetReduction(options['DECIMATE REDUCTION'])
 decimator.SetInitialError(options['DECIMATE ERROR'])
 decimator.SetErrorIncrement(options['DECIMATE ERROR INC'])
 decimator.GetOutput().ReleaseDataFlagOn()

 smoother.SetInput(decimator.GetOutput())
 smoother.SetNumberOfIterations(options['SMOOTH ITERATIONS'])
 smoother.SetRelaxationFactor(options['SMOOTH ITERATIONS'])
 smoother.SetFeatureAngle(options['SMOOTH ANGLE'])
 smoother.FeatureEdgeSmoothingOff()
 smoother.BoundarySmoothingOff()
 smoother.SetConvergence(0)
 smoother.GetOutput().ReleaseDataFlagOn()

 normals.SetInput(smoother.GetOutput())
 normals.SetFeatureAngle(options['FEATURE ANGLE'])
 normals.GetOutput().ReleaseDataFlagOn()

 stripper.SetInput(normals.GetOutput())
 stripper.GetOutput().ReleaseDataFlagOn()

 writer.SetInput(stripper.GetOutput())
 writer.SetFileName(tissue + '.vtk' )
 writer.SetFileType(2)

 writer.Write()
----------------------------------------------------------------------


I don't think the issue is the decimator or the smoother...





More information about the vtkusers mailing list