[Insight-users] Streaming + Multithreading

Miller, James V (Research) millerjv at crd.ge.com
Fri Feb 4 10:23:35 EST 2005


The streaming filter and threading are disjoint operations that 
share the same architecture.  Doing one facilitates doing the other.

Many ITK filters support multithreading.  A multithreaded filter supplies
the method ThreadedGenerateData() instead of providing a GenerateData() method.

In single threaded filters, the GenerateData() method is responsible for
allocating the bulk data for the output image(s) and is responsible for
producing all the output pixels in the output requested region.  

In multhithreading filter, the pipeline is responsible for allocating the 
bulk data for the output image(s) and forks several threads, each calling 
the ThreadedGenerateData(). The ThreadedGenerateData() method is responsible
only for calculating the pixels in the region specified in the arguments to
ThreadedGenerateData().  It should never write to an output pixel that is
outside this specified region.  The composition of all the ThreadedGenerateData
method calls will produce the entire output requested region.

In streaming, a given problem is broken into several smaller problems, 
asking for a subset of the overall output requested region during solving
each smaller problem. Breaking the problem into smaller problems is similar 
to what the threading problem does.  In solving each of these streaming
subproblems, each filter in the pipeline may break up the problem into
smaller regions for multithreading.

So, threading and streaming are separate capabilities.  Both rely on algorithms
being able to produce a subset of the overall output.

Jim



-----Original Message-----
From: insight-users-bounces at itk.org
[mailto:insight-users-bounces at itk.org]On Behalf Of Kevin H. Hobbs
Sent: Thursday, February 03, 2005 4:42 PM
To: Insight Users List
Subject: [Insight-users] Streaming + Multithreading


I was browsing through Code/BasicFilters/itkStreamingImageFilter.txx
trying to understand how the threading works, and it looks to me like
one instance of the streaming filter just marches through the requested
region.

for (piece = 0;
       piece < numDivisions && !this->GetAbortGenerateData();
       piece++)
    {
...

Will there be an instance of the streaming filter per thread?


More information about the Insight-users mailing list