[vtkusers] ActiViz C# | Problem with vtkPolyDataConnectivityFilter

Matias Montroull matimontg at gmail.com
Thu Jan 16 16:46:00 EST 2014


Thanks, so to which object I need to apply the vtkCleanPolyData? to my
vtkpolydata?


On Thu, Jan 16, 2014 at 6:25 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> The vtkPolyDataConnectivityFilter probably only removes cells,
> not points.  Pass your data through vtkCleanPolyData after the
> connectivity filter to get rid of any extra points.
>
> On Thu, Jan 16, 2014 at 2:19 PM, Matias Montroull <matimontg at gmail.com>
> wrote:
> > 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/587f547d/attachment.html>


More information about the vtkusers mailing list