Hello everyone,<br><br>I have a question about vtkDiscreteMarchingCubes object.<br><br>What I am doing is as follows:<br><br>- Load an input 3D volume (a binary mask).<br>- Apply the vtkDiscreteMarchingCubes filter.<br>- Cut through the resulting dataset using a vtkCutter.
<br>- Use a vtkStripper to generate closed loop polygons<br>- Visualize these polygons.<br><br>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.
<br><br>My code looks more or less as follows:<br><br>void ExtractBinaryMask(vtkImageData * in)<br>{<br> if (in)<br> { <br> // Pass this to the marching cube filter <br> discreteMarchingCubes->ComputeNormalsOff();
<br> discreteMarchingCubes>ComputeGradientsOff();<br> discreteMarchingCubes->SetInput(in);<br> <br> // Get the scalar range<br> double * range = in->GetScalarRange();
<br> // We set the contour surface value to the greatest value<br> discreteMarchingCubes->SetValue(0, range[1]);<br><br> vtkPlane * plane = vtkPlane::New();<br> vtkCutter * cutter = vtkCutter::New();
<br> vtkStripper * stripper = vtkStripper::New();<br><br> plane->SetOrigin(in->GetOrigin()); <br> plane->SetNormal(0, 0, 1);<br><br> cutter->SetInput(discreteMarchingCubes->GetOutput());
<br> cutter->SetCutFunction(plane); <br> cutter->Update();<br> <br> stripper->SetInput(cutter->GetOutput());<br> stripper->Update();
<br> <br> // poly is vtkPolyData <br> poly->SetPoints(stripper->GetOutput()->GetPoints());<br> poly->SetPolys(stripper->GetOutput()->GetLines());<br>
<br> // we have the points now<br> }<br>}<br><br><br>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 :(
<br><br>Any help would be greatly appreciated!<br><br>Thanks,<br>Luca<br>