[vtkusers] Help!!!!! VtkMarchingCubes::SetValue
Vicky
bonsai19 at gmx.de
Fri Oct 31 06:34:37 EDT 2008
Hi there,
I'll be grateful if someone can help me out.
I want to create models from segmented 2D images (slices).
I have used code like the VTK frog-example from the book "Visualization
Toolkit: An Object-Oriented Approach to 3D Graphics":
vtkImageThreshold threshold = new vtkImageThreshold();
threshold.ThresholdBetween(1,1);
threshold.SetInValue(255);
threshold.SetOutValue(0);
threshold.SetInput(image.GetOutput());
vtkImageShrink3D shrink = new vtkImageShrink3D();
shrink.SetInput(threshold.GetOutput());
shrink.SetShrinkFactors(shrinkFactor);
shrink.AveragingOn();
vtkImageGaussianSmooth gaussiansmooth = new
vtkImageGaussianSmooth();
gaussiansmooth.SetDimensionality(3);
gaussiansmooth.SetStandardDeviation(gaussianStandardDeviation);
gaussiansmooth.SetInput(shrink.GetOutput());
vtkImageToStructuredPoints structuredPoints = new
vtkImageToStructuredPoints();
structuredPoints.SetInput(gaussiansmooth.GetOutput());
structuredPoints.GetOutput().ReleaseDataFlagOn();
vtkMarchingCubes marchingCubes = new vtkMarchingCubes();
marchingCubes.SetInput(structuredPoints.GetOutput());
marchingCubes.ComputeScalarsOff();
marchingCubes.ComputeGradientsOff();
marchingCubes.ComputeNormalsOff();
marchingCubes.SetValue(0, 450);
vtkDecimatePro decimate = new vtkDecimatePro();
decimate.SetInput(marchingCubes.GetOutput());
decimate.SetFeatureAngle(60.0);
decimate.SetMaximumError(1);
decimate.SetTargetReduction(decimateReduction);
decimate.GetOutput().ReleaseDataFlagOn();
vtkSmoothPolyDataFilter smoother = new
vtkSmoothPolyDataFilter();
smoother.SetInput(decimate.GetOutput());
smoother.SetNumberOfIterations(smoothIterations);
smoother.SetRelaxationFactor(RelaxionsFactor);
smoother.SetFeatureAngle(smoothAngle);
smoother.FeatureEdgeSmoothingOff();
smoother.SetConvergence(0);
smoother.GetOutput().ReleaseDataFlagOn();
vtkPolyDataNormals normals = new vtkPolyDataNormals();
normals.SetInput(smoother.GetOutput());
normals.SetFeatureAngle(featureAngle);
normals.GetOutput().ReleaseDataFlagOn();
vtkStripper stripper = new vtkStripper();
stripper.SetInput(normals.GetOutput());
stripper.GetOutput().ReleaseDataFlagOn();
vtkPolyDataWriter writer = new vtkPolyDataWriter();
writer.SetInput(stripper.GetOutput());
writer.SetFileName("Ratte_Lila.vtk");
writer.SetFileType(2);
... and so on!
I think the pipeline is correct
But my problem is I can't determine which value is used in
SetValue-function of the vtkMarchingCubes-class. I don't know how to
calculate it.This value seems to be different to which tissue will be
rendered. But how can I calculate this value for each tissue?
I know the first parameter is the contour-number. Is this right?
Can anyone help me?
I'm using vtk 5.0
Thanks!
Vicky
More information about the vtkusers
mailing list