[vtkusers] vtkMarchingCubes

Peter F Bradshaw pfb at exadios.com
Fri Jan 9 00:23:35 EST 2009


Hi Chen;

On Thu, 8 Jan 2009, chens wrote:

> We used the following codes for the surface generation of a medical object
> in DICOM files.
>
> The resultant 3D images were excellent.
>
> Originally, we thought that the marching cube algorithm was used for the
> surface generation of the medical object since the vtkMarchingCubes method
> was invoked.
>
> However, we were surprised that it seemed that the "vtkMarchingCubes" was
> not invoked when we set breakpoint in that method in the debugging mode.

I am not sure that I fully understand why you think that vtkMarchingCubes
was not invoked. Looking at the code below I would say it most certainly
is.

>
> Does anyone know whether the marching cube algorithm was used or not?  If it
> was, which method implements the marching cube algorithm?

vtkMarchingCubes::RequestData()

>
> How can we invoke marching cube algorithm in vtk? Are there any other sample
> codes?
>
> Thank you very much for your help.
>
> Chen
>
>
>
>
>
> vtkMarchingCubes *m_cube=vtkMarchingCubes::New();
>
>     vtkPolyData  *m_polydata=vtkPolyData::New();//define an object frm the
> filter
>
>     m_cube->SetValue(0,500); // set value corresponding  to which the
> isosurface will be created
>
>     m_cube->ComputeNormalsOff(); // turn Normals Creation off (u can do it
> later...and only if u  have light settings)
>
>     m_cube->ComputeGradientsOff(); // gradients off
>
>     m_cube->SetInput(m_reader->GetOutput()); // set input for the volume
> from which u'll extract iso surface
>
>     m_polydata= m_cube->GetOutput(); // get o/p (it's of polydata type)
>
>     m_polydata->Update();
>
>
>
>     vtkPolyDataMapper *m_polydataMapper = vtkPolyDataMapper::New();
>
>     m_polydataMapper->SetInput(m_polydata);
>
>     m_polydataMapper->SetScalarRange(0,7);
>
>     m_polydataMapper->Update();
>

Cheers

-- 
Peter F Bradshaw: http://www.exadios.com (public keys avaliable there).
Personal site: http://personal.exadios.com
"I love truth, and the way the government still uses it occasionally to
 keep us guessing." - Sam Kekovich.



More information about the vtkusers mailing list