[vtkusers] voxelization of point cloud - proper data structure

paws paws at op.pl
Wed Mar 30 14:32:33 EDT 2011


Hi Everybody!

I have vtkPolyData object containing unstructured point cloud. 

I'm going to divide space into cubic voxels, so I'm looking for a data
structure, which could store information about points located in given
voxel.

I tried to use vtkImageData and vtkCellLocator:

	vtkSmartPointer imageData = vtkSmartPointer::New();
	imageData->SetSpacing(d,d,d);
	imageData->SetDimensions(dim);
	imageData->SetOrigin(origin);

	vtkSmartPointer cellLocator = vtkSmartPointer::New();
	cellLocator->SetDataSet(imageData);
	cellLocator->BuildLocator();

	vtkSmartPointer idVoxela = vtkSmartPointer::New();
	idVoxela->SetNumberOfComponents(1);
	idVoxela->SetNumberOfValues( polydata->GetNumberOfPoints() );
	idVoxela->SetName("idVoxela");

	for (int i = 0; i < polydata->GetNumberOfPoints(); i++)
	{
		double xyz[3];
		polydata->GetPoint(i,xyz);
		vtkIdType id;		
		id = cellLocator->FindCell(xyz);		
		idVoxela->SetValue(i,id);		
	}

	polydata->GetPointData()->AddArray(idVoxela);

Now I can ask every point for id of voxel, that contain that point. 

It's OK, but what I'm looking for is structure, that I can ask for vtkIdList
of points located in given voxel.

Could anyone tell me, how can I do this?

--
View this message in context: http://vtk.1045678.n5.nabble.com/voxelization-of-point-cloud-proper-data-structure-tp4272033p4272033.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list