[Insight-users] Capturing progress info while loading file
Yann Rouillard
Y . Rouillard at exeter . ac . uk
Tue, 18 Jun 2002 20:58:11 +0100
Hi Luis,
Thank you for your detailed answer. I have tried to use an observer to
update a progress bar while loading a meta-image file but it doesn't seem to
work. I traced the execution and I have reached the MetaImageIO::Read method
where it seems that no ProgressEvent are triggered.
Are ProgressEvent only used for filter or am I wrong in some point ?
Cheers;
Yann
>
> 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
> >
> >
>
>
>
>