[vtkusers] Iterating over an image and getting neighbors

Alex mrapsouthern at gmail.com
Thu Sep 23 15:43:54 EDT 2010


  David,

Im really interested in this functionality aswell. Currently I do this 
outside of VTK in a pre-processing stage and I do the "interrogation"  
of the validity in a sequential manner. My application is complicated by 
the fact that edges can occur anywhere not just at the edge of the 
bounding container.

What I'd that like is for the interrogation to be done in parallel on 
the GPU using CUDA (it's very parallelizable) and for it to support 3D 
grids (i.e. retrieve 6 neighbours) aswell.

Why do you require this? I think there are alot of applications of this 
function. I need it for setting up complex grids (not just rectangles 
and cuboids)  for physical modelling, the visualization provided by VTK 
is an added bonus.

Cheers
Alex

On 23/09/2010 21:24, David Doria wrote:
> I want to visit each pixel in an image (a 2D vtkImageData) and get its
> 4-connected neighbors. The tricky part (i.e. that makes it messy to do
> directly in the algorithm) is that there is not always 4 valid
> neighbors (you might be on the edge of the image).
>
> Is there any built in mechanism for doing this? It would be very nice
> to separate this logic from the core algorithm.
>
> I saw vtkImageIterator but it just seems to move a pointer but not
> know anything about neighborhoods:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/ImageData/vtkImageIterator
>
> I also saw vtkImageSpatialAlgorithm, but it doesn't seem to have any
> concept of neighbors of a pixel either.
>
> I'd like something like a
>
> for(every pixel in the image)
> {
>   neighbors = pixel.GetNeighbors()
>   if(neighbors.HasLeft())
>    {do something with neighbors.GetLeft()}
> }
>
> Is there anything like this built in?
>
> 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