[Insight-developers] Managing Abort in Filters

Miller, James V (Research) millerjv@crd.ge.com
Tue, 8 Apr 2003 10:56:38 -0400


Is "ProgressAborted" the right name for the exception?
I don't think of it as the "progress" being aborted as 
much as the filter being aborted. 'Course the only thing
I can come up with right now is "AbortGenerateDataException".
I think we want something more specific than just "AbortException".
Looking at our other exceptions, some end in the word
"Exception" and some end in the word "Error". (Rambling)

This approach is using exceptions as a means to 
communicate between the ProgressReporter object and 
the filter.  We are basically trying to hide duplicate
code in the ProgressReporter class. To date, however, 
I think we have tried to restrict the use of exceptions 
to "errors" as opposed to "state".  But I guess, this is 
kind of in the gray area.  I am not worried about the 
overhead of the exception since it is only thrown when 
the user select "abort".

The bottom line is that if a filter uses a ProgressReporter
it had better catch this exception.  We never want this 
exception to propagate up to the application.





> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
> Sent: Tuesday, April 08, 2003 10:36 AM
> To: Insight Developers List
> Subject: [Insight-developers] Managing Abort in Filters
> 
> 
> Hi,
> 
> The following approach for managing Abort calls
> has been added (tentatively) to filters:
> 
> 1) The ProgressReporter tests for the
>       AbortGenerateData flag after calling
>       ProgressUpdate(). That gives the user
>       a chance to click in an "Abort/Cancel"
>       button when the GUI is refreshed after
>       the progress update.
> 
> 2) If the progress reporter finds the AbortGenerateData
>      flag ON, it throws a (newly added to the toolkit)
>      "ProgessAborted" exception.
> 
> 3) Filters should catch this "ProgressAborted" exception
>      outside the outer loop of their GenerateData() and
>      ThreadedGenerateData() methods.
> 
> 
> 
> This logic has been added to the following
> filter classes:
> 
> 
>     - UnaryFunctorImageFilter
>     - BinaryFunctorImageFilter
>     - TernaryFunctorImageFilter
>     - MedianImageFilter
> 
> The first three cover most of the pixel-wise filters.
> 
> 
> 
>    Luis
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>