[vtkusers] Voxelize a point cloud (vtkVoxelModeller?)
David Doria
daviddoria+vtk at gmail.com
Sun Nov 1 12:48:40 EST 2009
On Sun, Nov 1, 2009 at 12:25 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>
> I think this is a bug in the writer. The scalar data type is VTK_BIT.
> I'm, guessing the writer can't handle this type.
>
> I changed the scalar type to short in my local copy of vtk and the
> program ran without warnings. However, I still could not read the file
> in paraview. But I changed the writer to a vtkDataSetWriter and it ran
> without warning. In this case, when the type was short, I was able to
> see the voxels. As VTK_BIT I could not.
>
> VTK_BIT is not a well-supported type.
>
> Question: Do you have a need for this filter or are you just marching
> through the vtk filters to learn vtk (which is OK by the way)?
>
> The only example I saw using this filter used its output into
> vtkContourFilter, producing a Polydata.
>
> Bill
Bill,
Thanks (as always) for looking at this.
As you have picked up on, I have been playing with several different
things when I've had time. However, this one is quite related to what
I should actually be doing :). I really wanted to iterate over the
leaves of a vtkOBBTree (you may have seen my other list email?), but
since I couldn't get that to work, I thought this voxel grid would be
the next best thing - and at the same time, I am trying to make
examples of everything I touch along the way so that future users
won't have any of the same questions I have had. I am actually not so
interested in writing out the result - what I need to do is iterate
through the voxels. I got the output of voxelModel as a vtkImageData,
but how do I check how many (and which) points are in each cell? The
GetCell(vtkIdType cellId) function of vtkImageData seems to expect a
linear cell id - is there any way to access these by (x, y, z) type
coordinates?
It sounds like there are two things that could be done:
1) change vtkVoxelModeller to not use vtkBitArray (as you have already
done sucessfully) - would this be an issue for backwards
compatibility?
2) Modify the writers to deal with the bit type. You said it is not
well supported - is this because it is new? Or because it is
deprecated?
Also, you mentioned you used vtkDataSetWriter: vtkXMLPolyDataWriter
writes vtp's, vtkXMLImageDataWriter writes vti's - what format does
vtkDataSetWriter write?
Thanks,
David
More information about the vtkusers
mailing list