[vtkusers] Re: Another vtkMarchingCubes question

Luca Pamparana luca.pamparana at gmail.com
Tue Aug 7 09:37:56 EDT 2007


Never mind this. I figured out what the problem was. I was not setting the
plane origin correctly.

Thanks,

Luca

On 8/7/07, Luca Pamparana <luca.pamparana at gmail.com> wrote:
>
> Hello everyone,
>
> I have a question about vtkDiscreteMarchingCubes object.
>
> What I am doing is as follows:
>
> - Load an input 3D volume (a binary mask).
> - Apply the vtkDiscreteMarchingCubes filter.
> - Cut through the resulting dataset using a vtkCutter.
> - Use a vtkStripper to generate closed loop polygons
> - Visualize these polygons.
>
> The problem is that the tip of my input dataset is missing. The structures
> at the tip are quite small and I am guessing that not enough triangles are
> being generated and it is clipping my dataset somehow. I was wondering if
> someone has had the same problem and would know how to avoid this.
>
> My code looks more or less as follows:
>
> void ExtractBinaryMask(vtkImageData * in)
> {
>     if (in)
>     {
>         // Pass this to the marching cube filter
>         discreteMarchingCubes->ComputeNormalsOff();
>         discreteMarchingCubes>ComputeGradientsOff();
>         discreteMarchingCubes->SetInput(in);
>
>           // Get the scalar range
>           double * range = in->GetScalarRange();
>           // We set the contour surface value to the greatest value
>           discreteMarchingCubes->SetValue(0, range[1]);
>
>           vtkPlane * plane = vtkPlane::New();
>           vtkCutter * cutter = vtkCutter::New();
>           vtkStripper * stripper = vtkStripper::New();
>
>           plane->SetOrigin(in->GetOrigin());
>           plane->SetNormal(0, 0, 1);
>
>           cutter->SetInput(discreteMarchingCubes->GetOutput());
>           cutter->SetCutFunction(plane);
>           cutter->Update();
>
>           stripper->SetInput(cutter->GetOutput());
>           stripper->Update();
>
>           // poly is vtkPolyData
>           poly->SetPoints(stripper->GetOutput()->GetPoints());
>           poly->SetPolys(stripper->GetOutput()->GetLines());
>
>           // we have the points now
>     }
> }
>
>
> I shift the plane along the length of the whole volume and do this
> extraction for the whole set. However, the top tip does not return any
> polygons :(
>
> Any help would be greatly appreciated!
>
> Thanks,
> Luca
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070807/b025968d/attachment.htm>


More information about the vtkusers mailing list