[Insight-users] Please give me a hand in understanding pipeline

Luis Ibanez luis . ibanez at kitware . com
Mon, 19 Aug 2002 09:50:31 -0400


Hi Zhao,

ITK has ProcessObject and DataObjects. ITK filters derive
from ProcessObject while the Images and Meshes derive from
DataObject.

ProcessObjects generate DataObjects. During the generation
process, the ProcessObject register its pointer into the
DataObject. In this way, you can ask a DataObject:

What is the ProcessObject where you are comming from ?

This is done with the method:

   myDataObject->GetSource();

http://www.itk.org/Insight/Doxygen/html/classitk_1_1DataObject.html

You can also ask the ProcessObject about its input and
output DataObject by calling GetInput( int ) and GetOutput( int ).

The ITK internal pipeline mechanism takes care of updating
all the filters for you. When you ask the last filter in the
pipeline to update its data. This last filter is going to
each one of its input DataObject and ask them to be updated.

Each DataObject is going to its source ProcessObject and ask
them to be updated,... and so on.

In this way the Update() call is propagated upstream through
the pipeline.

When the update messages arrive to filters that do not require
updates or to DataObject that are not generated from ProcessObject,
then the pipeline stars rolling downstream by actually updating
each filter in the appropiate order.


When you connect the output of one filter as input for
another filter

e.g.:

WaterShed->SetInput( anisotropicDiffusion->GetOutput() );

The WaterShed filter is able to trigger the Update() of the
anisotropicDiffusion filter by doing the equivalent of:

   this->GetInput()->GetSource()->Update();


The methods that actually compute data are called GenerateData()
and ThreadedGenerateData() these are protected methods that you
are not expected to call.  The Update() method will internally
invoke GenerateData() or ThreadedGenerateData() for you.

>From the user's point of view you just need to connect the pipeline
by A->SetInput( B->GetOutput() ) calls, and the invoke "Update()"
in the last filter of the pipeline.


Please let us know if you have further questions,

  Thanks

   Luis


=================================

zhao wrote:
> Hi Luis,
> 
> 	By reading the source code of WaterShedSegmentation example, I got a taste of the pipeline architecture used in ITK. In this example, there are three filters (except for image read and write filters): Anisotropic Diffusion Filter, Gradient Magnitude Filter, and Watershed Segmentation Filter. I know the output of one filter is the input of it's subsequent filter, and thus a processing pipeline is constructed. It seems that it's the Write() member function of ImageFileWriter object that triggers the whole processing procedure. Now, I got two question to ask:
> 	
> 	(1) How does the later Filter trigger the former Filter's execution? ( e.g. Watershed trigers Gradient, and Gradient triggers Diffusion ).
> 	(2) How does a Process Object (i.e. a filter) begin it's own processing? (e.g. I think the processing subroutine of GradientMagnitudeImageFilter should be ThreadedGenerateData, but I can't find explicitly where GradientMagnitudeImageFilter evoke it. )
> 
> 	Maybe it's too complex to give a clear explanation. Any reply will be appreciated. Thanks in advance!!
> 
> Zhao
>     
> 
> Zhao ChenGuang
> P.O.Box:010,
> Dept. BME
> Shanghai Jiao Tong University,
> 1954# Hua Shan Road,
> Shanghai,P.R.China,
> 200030
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
> 
>