[Insight-developers] Managing Abort in Filters

Lorensen, William E (Research) lorensen@crd.ge.com
Thu, 10 Apr 2003 13:08:41 -0400


Luis,
Why not move the try/catch and the if(abort generate data) code into
itkProcessObject.cxx. The try/catch would go around the GenerateData in
ProcessObject.

Then, be default, every filter would support abort. If a filter needed to
modify the default behavior

1) to clean up intermediate data. Then it could try/catch, clean up its data
and rethrow.
2) to produce intermediate results. It could try/catch, reset the Abort flag
and continue.

It seems like a lot of work to add the current code to all filters since
most will use the default behavior.

Bill

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
Sent: Tuesday, April 08, 2003 4:06 PM
To: Miller, James V (Research)
Cc: Insight Developers List
Subject: Re: [Insight-developers] Managing Abort in Filters



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.
> 

_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers