[vtkusers] How to extract points and lines?

Andrej Gluhov realandron at gmail.com
Thu Apr 1 03:46:45 EDT 2010


I use vtkContourFilter on DICOM-Image. The filter generates several
isolines. How to extract points and lines for each isolines or is it
impossible? I want to remove some isolines, but do not know how.

           vtkDICOMImageReader DicomReader = new vtkDICOMImageReader();
            DicomReader.SetFileName(m_strFilePath);
            DicomReader.Update();

            vtkContourFilter m_iso = new vtkContourFilter();
            m_iso.SetInputConnection(DicomReader.GetOutputPort());
            m_iso.SetValue(0, (double)numcontourValue.Value);
            m_iso.Update();//generate several isolines,but some need to
remove

            vtkPolyData PD = m_iso.GetOutput();
            int NumberOfPoints = PD.GetNumberOfPoints();

            using (FileStream fs = new FileStream("Points.txt",
FileMode.Create))
            {
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    for (int i = 0; i < NumberOfPoints; i++)//points for all
isolines
                    {
                            double[] xyz = PD.GetPoint(i);
                            sw.Write(xyz[0].ToString() + " " +
xyz[1].ToString() + " " + xyz[2].ToString() + "\r\n");
                            sw.Flush();
                    }
                }
            }
-- 
С Уважением,
Андрей.
Best regards, Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100401/f38f51c4/attachment.htm>


More information about the vtkusers mailing list