[vtkusers] Voxelize a point cloud (vtkVoxelModeller?)

Bill Lorensen bill.lorensen at gmail.com
Sun Nov 1 14:55:34 EST 2009


David,

> 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?

To be honest, this class is of limited use/interest. I think it is in
vtk for historical reasons. Originally, vtk was written to implement
the concepts and algorithms in the Visualization Toolkit textbook
(Have you read it?). To that end, a rich selection of data types was
supported. My guess is that VTK_BIT is the least useful/used of all of
the data types.
> 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?
>

The VTK_BIT type packs 0/1 into words. This is memory efficient, but
not very fast. VTK_BIT has been in vtk form the very beginning, but
I'd be surprised if anyone uses it.
Although a grep for vtkBitArray does show that the InfoVis kit uses it.
Also:
./Graphics/vtkHyperOctreeContourFilter.cxx
./Graphics/vtkHyperOctreeContourFilter.h
./Graphics/vtkHyperOctreeDualGridContourFilter.cxx
./Graphics/vtkHyperOctreeDualGridContourFilter.h
./Graphics/vtkRandomAttributeGenerator.cxx
./Imaging/vtkVoxelModeller.cxx
./Infovis/vtkClustering2DLayoutStrategy.cxx
./Infovis/vtkCommunity2DLayoutStrategy.cxx
./Infovis/vtkConstrained2DLayoutStrategy.cxx
./Infovis/vtkFast2DLayoutStrategy.cxx
./Infovis/vtkTableToGraph.cxx
./Infovis/vtkTableToGraph.h
./Infovis/vtkXMLTreeReader.cxx
./IO/vtkDataReader.cxx
./IO/vtkDataWriter.cxx
./IO/vtkXMLDataReader.cxx
./IO/vtkXMLWriter.cxx
./Parallel/vtkEnSightWriter.cxx
./Rendering/vtkOpenGLImageMapper.h

> Also, you mentioned you used vtkDataSetWriter: vtkXMLPolyDataWriter
> writes vtp's, vtkXMLImageDataWriter writes vti's - what format does
> vtkDataSetWriter write?

vtkDataSetWriter is what we now call the legacy format. Apparently is
has better support for all types than the new XML based writers. So,
it's probably a bug that VTK_BIT is not supported, but I guess the
question is really who cares? I agree that this can be confusing to
users.

>
> 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