[Insight-users] itk::StreamingImageFilter

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Wed, 31 Mar 2004 14:01:08 +0100


When using itk::StreamingImageFilter, the requested regions for each tile of
the image are passed to upstream filters....
Question : Do the upstream filters effectively make a local copy of each
piece of the data. The reason I ask is because if they do so, then using
tiles which of a comparable size to the cache memory will significantly
improve performance on some platforms.

To clarify

Source->Filter1->Filter2->itk::StreamingImageFilter->Sink
When Filter2 receives its requested region, it'll generate a region usually
the same, but possibly different, for Filter1, which will do the same for
Source.
If source generates the required region, and passes it to Filter1, will the
image data be contiguous. I'm presuming so, because each will create an
image object with a wholeextent equal to the requested region and it will
live in a contiguous block.

I'm worried about this...

Source->Filter1->Filter2->itk::StreamingImageFilter1->Sink1
                          ->Filter3->itk::StreamingImageFilter2->Sink2
Now Filter 1, can produce a region which is the union of the two requested
regions and therefore large, but this never happens - correct?. If it did,
the output of Filter1 would need to maintain two separate regions, which it
can't. Instead, Filter1 and Source will update multiple times, possibly
causing accidents (if multiple threads are used for the two sub-pipelines).

Secondary question...How much of the pipeline functionality is thread safe?
I know vtk can fall over badly in certain filters. Is the same true for itk.

Tertiary question : In the case above
Source->Filter1->Filter2->itk::StreamingImageFilter1->Sink1
                          ->Filter3->itk::StreamingImageFilter2->Sink2
Lets suppose Source is only capable of delivering the LargestPossibleRegion,
in this case, the input to Filter1 will be the wholeExtent of the image and
so the region being operated on by Filter1 will not be contiguous in memory
(the increments will be large for one or more axes we assume). In this case,
will the output of Filter1 be a sub image with only the requested region -
and in this case, the image will be contiguous. yes? - In this case, Source
will not re-execute multiple times because it can satisfy the requested
region. Filter1 will re-execute, because although it'd be more sensible for
it to supply the LargestPossibleRegion, it will in fact supply the requested
Tiles N (or more) times.

Have I got this about right, or am I missing anything crucial. Many thanks
and Apologies for mixing vtk and itk terminology.

JB