[vtkusers] Voxelize a point cloud (vtkVoxelModeller?)

Bill Lorensen bill.lorensen at gmail.com
Sun Nov 1 08:25:06 EST 2009


I think it only voxelizes cells. You probably need to create a Vertex
cell for each point.

On Sat, Oct 31, 2009 at 2:56 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> I am trying to take a set of points and insert it into a voxelized 3d grid.
> That is, the input is an unstructured point set (vtkPoints or similar) and
> the output would be a structure that you can do something like the following
> after voxelizing the points into a 10x10x10 grid:
>
> for(int x = 0; x < 10; x++)
>   for(int y = 0; y < 10; y++)
>    for(int z = 0; z < 10; z++)
>      cout << "Grid cell " << x << " " << y << " " << z << " has " <<
> Grid->GetNumberOfPointsInVoxel(x,y,z) << " points.";
>
> I saw vtkVoxelModeller, but I tried this: (compilable example here:
> http://rpi.edu/~doriad/VTK_List/vtkVoxelModeller/)
>
>     vtkSmartPointer<vtkXMLPolyDataReader> Reader =
> vtkSmartPointer<vtkXMLPolyDataReader>::New();
>     Reader->SetFileName(InputFilename.c_str());
>     Reader->Update();
>
>     vtkSmartPointer<vtkVoxelModeller> voxelModel =
> vtkSmartPointer<vtkVoxelModeller>::New();
>     voxelModel->SetInput(Reader->GetOutput());
>     voxelModel->SetSampleDimensions(10, 10, 10);
>     voxelModel->SetModelBounds(-1.5, 1.5, -1.5, 1.5, -1.5, 1.5);
>
>     vtkSmartPointer<vtkXMLImageDataWriter> Writer =
> vtkSmartPointer<vtkXMLImageDataWriter>::New();
>     Writer->SetFileName(OutputFilename.c_str());
>     Writer->SetInput(voxelModel->GetOutput());
>     Writer->Write();
>
> but I get a whole bunch of unsupported data type errors:
>
> vtkXMLImageDataWriter (0x86a53d8): Unsupported data type: 1
> vtkXMLImageDataWriter (0x86a53d8): Data type size 0 not supported by VTK XML
> format.
>
> Am I expecting the correct thing from this filter? Where have I messed up
> the data types?
>
> Thanks,
>
> David
>
> _______________________________________________
> 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
>
>



More information about the vtkusers mailing list