[Insight-developers] recomendations for fast access to list of offsets

Dan Mueller d.mueller at qut.edu.au
Sun Jul 2 20:39:19 EDT 2006


Hi Richard,

I read somewhere (however I can't remember where) that the following 
convention for selecting specific indices is faster than GetPixel(.):

it += newIndex - it.GetIndex(); //'it' must be an iterator of type WithIndex
PixelType test = it.Get();

Of course, seeing I can't remember where I came across this and in the 
absence of any formal testing - use at your own risk. If you do get a 
chance to formally test if this method is faster, I would certainly be 
interested in the result...

Cheers

Dan Mueller
d.mueller at qut.edu.au


Richard Beare wrote:
> Hi,
>
> I have a filter that will sweep lines of various orientations across
> an image. The lines will change angles between passes. I represent the
> line as an array of offsets from the starting point, and this
> representation is computed once for each sweep. The idea is to copy
> the pixel locations to a buffer for processing, and then copy them
> back when I'm done, which tends to simplify the interface to the core
> computational code and often improves cache performance when the
> buffered data is accessed lots of times.
>
> So what is the recommended way of accessing a bunch of pixels that
> aren't necessarily in one of the standard orderings? I've experimented
> with image.GetPixel() to get things working, which the documentation
> says is slow, and it shows signs of being a significant overhead. I've
> also toyed with using += operators with image region iterators, but it
> doesn't seem to be legal.
>
> Any recommendations?
>
> Thanks
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list