[Insight-users] How can I know that an itk object (filter, reader, or writer) has finished his work???

Luis Ibanez luis.ibanez@kitware.com
Thu, 17 Oct 2002 11:12:24 -0400


Hi Zein,

Yes, ITK filters send events when they are
done processing data.

The it::Event to check for is "EndEvent()".

You can setup an itk::Command to Observe the
filter in question and react whenever the
itk::EndEvent() is sent.

An example on how to do this can be seen
in

  Insight/Auxiliary/FltkImageViewer/fltkLightButton.cxx


It could look like

myListenerClassType  myListenerClass; // see details below (**)

typedef itk::SimpleMemberCommand< myListenerClassType >  CommandType;

CommandType::Pointer command = CommandType::New();

command->SetCallbackFunction(
                 & mylistereclass,
                 & myListenerClassType::FilterFinished );

filter->AddObserver( itk::EndEvent(), command.GetPointer() );


-----

(**) This assuming that you have a class

class myListenerClassType
{
public:
   void FilterFinished()
    {
    // here the code you want to execute when the
    //  filter finished.
    }
};


Other typical events are:

   StartEvent();
   ProgressEvent();
   IterationEvent();


Please let us know if you have further questions,


   Thanks


    Luis



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

Zein Salah wrote:
> dear friends,
> 
>  
> 
> How can I know that an itk object (filter, reader, or writer) has 
> finished his work???
> 
> Is there some way to determine that??
> 
>  
> 
> thanks,
> 
> Zein 
> 
>  
> 
>  
> 
> ->8<------------->8<------------->8<------------->8<------------->8<------------->8<-
> Zein I. Salah
> Universität Tübingen, WSI-GRIS
> Sand 14
> 72076 Tübingen
> Email: salah@gris.uni-tuebingen.de <mailto:salah@gris.uni-tuebingen.de>  
> / zeinsalah@hotmail.com <mailto:zeinsalah@hotmail.com>
> Tel.: (07071) 29 75465 (GRIS) , (07071) 96 44 39 (privat)
> Fax: (07071) 29 54 66
>