[vtkusers] ActiViz C# | Problem with vtkPolyDataConnectivityFilter

Matias Montroull matimontg at gmail.com
Thu Jan 16 16:19:41 EST 2014


Hi,

I have a problem trying to obtain the inner points of a 3D reconstruction.
I can visualize just fine but when I save the points and then re open to
see them, I still see the image as when it was without the DataConnectivity
Filter. Why that may be? SkinNormals gets the output of the filter..

here's the code:

 vtkContourFilter skinextractor = vtkContourFilter.New();
            skinextractor.SetInputConnection(readerdicom.GetOutputPort());
            skinextractor.GetValues();
            skinextractor.SetValue(0, -800);

            vtkPolyDataConnectivityFilter contornos = new
vtkPolyDataConnectivityFilter();
            contornos.SetInputConnection(skinextractor.GetOutputPort());
            contornos.SetExtractionModeToLargestRegion();
            contornos.Update();
            contornos.SetColorRegions(1);


            vtkPolyDataNormals skinnormals = vtkPolyDataNormals.New();
            //skinnormals.SetInputConnection(skinextractor.GetOutputPort());
            skinnormals.SetInputConnection(contornos.GetOutputPort());
            skinnormals.SetFeatureAngle(90.0);
            skinnormals.ComputePointNormalsOn();

            vtkPolyData polys = new vtkPolyData();
            polys = skinnormals.GetOutput();
            polys.Update();
            polys.BuildCells();
            int numberofpoints = polys.GetNumberOfPoints();

            for (int i = 0; i < polys.GetNumberOfPoints(); i ++)
            {
                double[] p = new double[3];
                p = polys.GetPoint(i);
                POI poi_mesh_individual = new POI();
                poi_mesh_individual.POI_x = Convert.ToDecimal(p[0]);
                poi_mesh_individual.POI_y = Convert.ToDecimal(p[1]);
                poi_mesh_individual.POI_z = Convert.ToDecimal(p[2]);
                POIs_3D.Add(poi_mesh_individual);
            }

            using (StreamWriter writer = new StreamWriter(@"C:/tracker/" +
"mesh.poi", false))  // False to overwrite the file; True to append data to
the file;
            {
                for (int i = 0; i < POIs_3D.Count; i++)
                {
                    writer.WriteLine(POIs_3D[i].POI_x + ";" +
POIs_3D[i].POI_y + ";" + POIs_3D[i].POI_z);
                }

            }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140116/01aec88e/attachment.html>


More information about the vtkusers mailing list