[vtkusers] Saving VtkPolydata

Shashwath T.R. trshash at gmail.com
Tue Jun 16 00:31:08 EDT 2009


Hi,
Try calling Update() on the vtkExtractPolyDataGeometry before gettings its
output.

Regards,
Shash

On Mon, Jun 15, 2009 at 9:01 PM, diego martinez <damartinez80 at gmail.com>wrote:

>   Dear VtkUsers,
> I have a set of unstructured points (Point Cloud). I use a vtkPoint to save
> each point, and then I create a vtkCellArray. and Then I use a vtkPolydata
> as it can be seen of the following part of my code.
>
>         pvtkPoints->InsertPoint(n,x,y,z);
> int iNo = this->pvtkPoints->GetNumberOfPoints();
> for (int i=0; i<iNo; i++) {
>  this->pvtkCellArray->InsertNextCell(1,&i);
>  }
> this->pvtkPolyData->SetPoints(this->pvtkPoints);
> this->pvtkPolyData->SetPolys(this->pvtkCellArray);
>  this->pvtkPolyData->GetPointData()->SetScalars(this->intensities1);
>         this->pvtkPolyDataMapper->SetInput(this->pvtkPolyData);
>  this->pvtkActor->SetMapper(this->pvtkPolyDataMapper);
> this->pvtkActor->GetProperty()->SetRepresentationToPoints();
>  this->Props->AddItem( this->pvtkActor);
>
> This works fine when I create a mapper and actor and added to the render. I
> extract some planes with vtkExtractPolyDataGeometry(vtkEPDG)
>
>         this->pvtkEPDG->SetInput(this->pvtkPolyData);
> this->pvtkEPDG->SetImplicitFunction(this->pvtkPlanes_hull);
>  this->pvtkEPDG->SetExtractInside(1);
> this->pvtkEPDG->Update();
>  this->pvtkPolyData= this->pvtkEPDG->GetOutput();
>
> This works fine too, but when I want to extract the results and put this
> into a plain txt files, it wont do it. I would basically used the old
> vtkPolydata set of points
>
>         for (int i=0; i<iNo; i++)
> {
> this->pvtkPolyData->GetPoint(i,x);
>  fileHandle<<x[0]<<" "<<x[1]<<" "<<x[2]<<endl;
>  }
>
>
> Does anyone know what would be the solution to this simple problem. I would
> really appreciate any suggestion.
>
> thanks
>
>
> --
> Diego Martinez
> University of Nebraska at Lincoln
> 1110 S. 67st, PKI 108
> Omaha, NE 68182
> +1 - 402 - 575- 8881(Cell)
> +1 - 402 - 554 - 3537(Lab)
> +1 - 402 - 238 - 1908(SkypePC)
>
>
>
> dmartinez at unomaha.edu
> damartinez80 at gmail.com(personal)
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090616/0f9011f4/attachment.htm>


More information about the vtkusers mailing list