[Insight-developers] Managing Abort in Filters

Luis Ibanez luis.ibanez@kitware.com
Tue, 08 Apr 2003 16:05:59 -0400


Jim,


Thanks for illuminating this,



Just to double check,...
from your message I understand that in
the GenerateData() methods, we should
invoke ResetPipeline() with the filter
has been aborted.  Is that right ?

The typical GenereateData() method
skeleton is now looking like:

----

GenerateData()
{
    ProgressReporter reporter( this, 0,
                        region.GetNumberOfPixels() );
    IteratorType it( image, region );
    it.GoToBegin();
    try {
      while( !it.IsAtEnd() )
        {
        // do stuff
        ++it;
        reporter.CompletedPixel();
        }
      }
    catch( ProcessAborted & xx )
     {
      this->InvokeEvent( AbortEvent() );
      this->ResetPipeline(); // ???
      throw; // rethrow the exception.
         // so the GUI can deal with it.
     }

}

----


    Luis


------------------------
Miller, James V (Research) wrote:
> 
....

> Second, when the pipeline is executing, a flag is set on the current
> filter to keep track of the fact that it is updating.  This keeps a 
> pipeline from getting in a recursive update.  When a filter aborts, 
> this flag is not reset.
> 
> There is a method called ResetPipeline() that can be called on a filter
> that will reset this flag so that the pipeline can be reused.
>