[vtkusers] quickly iterate over voxel data in vtkImageData in Java

David Doria daviddoria at gmail.com
Thu Dec 2 12:21:28 EST 2010


On Tue, Nov 30, 2010 at 11:33 AM, Jonathan Morra <jonmorra at gmail.com> wrote:
> I'm running vtk with Java and want to quickly iterate over the voxels in a
> 3D vtkImageData.  Right now, the only methods I found were
> GetScalarComponentAsFloat
> and
> SetScalarComponentFromFloat
> however, these methods appear to be very slow.
> 1.  Are these methods actually slow?
> 2.  Is there a quicker way to iterate over a section of voxels in
> vtkImageData.
> My problem specifically is that I have 2 3D vtkImageData's.  I want to copy
> one plane of one vtkImageData into one plane of the other vtkImageData.  The
> only way I found of doing that is to iterate over the plane and use the
> get/set scalar components method.  Is there another way?  If not, how can I
> speed up what I'm doing.
> Thanks,
> Jon

ITK has excellent iterators that VTK should definitely try to copy. I
tried to setup some of the structure here:

https://github.com/daviddoria/vtkImageTraversal

but I am still using the inefficient access methods you mentioned to
traverse the image. Pointer arithmetic should definitely be used. If
anyone has time and agrees that this is useful feel free to work in
the above repository (give me your user name and I will add you as a
collaborator).

David



More information about the vtkusers mailing list