[vtkusers] Help!!!!! VtkMarchingCubes::SetValue
Bill Lorensen
bill.lorensen at gmail.com
Sat Nov 1 14:40:00 EDT 2008
Vicky,
In your example, Threshold selects segment label 1 and converts all
voxels to either 0 or 255. Using this pipeline you should always
select the isovalue to be midway between 0 and 255 (127.5). If you
want tosegment label 27 for example, threshold.SetBetween(27,27). But
the isovalue will still be 127.5.
This method of creating surfaces from segemented data is old although
still valid. I would recommend using vtkDiscreteMarchingCubes to
generate surfaces from segmentation labels.
But first, try the value of 127.5 and see how you like the results.
Bill
On Fri, Oct 31, 2008 at 6:34 AM, Vicky <bonsai19 at gmx.de> wrote:
> 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
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list