[Insight-users] Capturing progress info while loading file
Luis Ibanez
luis . ibanez at kitware . com
Tue, 18 Jun 2002 14:44:10 -0400
Hi Yann,
ITK uses the the Observer Design Pattern.
Most ITK filters send "itk::Events", for example:
itk::StartEvent
itk::EndEvent
itk::ProgressEvent
...
ITK provide Observers that can be registered
on a filter in order to "listen" to these events.
You may be interested on the "itk::ProgressEvent"
Basically you create an Observer, and register it
with the filter for which you want to track the
progress.
myFilter->AddObserver( itk::ProgressEvent(),
HxButton->GetRedrawCommand());
NOTE that the first argument is a newly constructed
"ProgressEvent". Only the type of the event is used
here, in an approach similar the one used for Exceptions.
When the filter throws the particular event, the "Execute()"
method of the observer is invoked. Then you can do whatever
you want at this level. For example update a progress bar
in a GUI, or just print a value on the standard output.
There is a FLTK class that you can use right now.
It derives from the fltkSlider and has built in
an Observer.
Insight/Auxiliary/FltkImageViewer/fltkProgressBar.cxx
You may see an example of this on the GaussianFilter example:
Insight/Examples/GaussianFilter/liFilterConsole2D.cxx
progressSlider->Observe( myFilter.GetPointer() );
Please let us know if you encounter any problems
setting up Observers.
Thanks
Luis
==============================================================
Yann Rouillard wrote:
> Hi,
>
> I'd like to know how to set up a progress bar to monitor a loading file
> operation.
>
> Does anyone know how to do it with ITK ?
>
> Cheers,
>
> Yann Rouillard
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>
>