Combining probing of pixel values with streaming


How would I have to adjust the code of my CLI probeCoords to employ streaming? It just loads an image and reports the pixel values for some specific indices and is based on
This should be possible to realise with streaming, however just adding StreamingImageFilter does not suffice because only for one chunk GetPixel() will work and when all pixels are probed further streaming is not necessary and should be stopped. I guess most efficient would be to test every chunk if GetPixel() succeeds for all specified indices and to continue until all are found. But how to check if GetPixel() succeeded within a chunk?

Thanks for any help or hints.

You should call Image::SetRequestedRegion before calling update. If the input Image file format supports streaming then just the requested region will be read.

Many thanks @blowekamp for your feedback. So I basically should create a one-pixel sized region for each index before each GetPixel()? Would it matter (be faster) if the list of indices is sorted according to their first appearance when streaming?

I don’t think doing them in order would make much of a difference since this operation is going all the way out to disk.

If you ordered the query points, then grouped them into the same slice or scan line. Then reduced the number of requested region to take advantage of the coherence it might make a performance difference.

1 Like

Wonderful, works like a charm with these changes, nearly no loading time and hardly any memory footprint. Many thanks @blowekamp for the help!


Great! Glad you were able to get it working.