[IGSTK-Users] Error handling in igstk applications

Ziv Yaniv zivy at isis.imac.georgetown.edu
Tue Jun 26 09:50:22 EDT 2007


Hi Torleif,

You can have all these events transition to a single error state and 
provide the user with an appropriate error message using a map between 
event and message. Attached is a class that uses this approach. Note 
that it does not follow the igstk state machine approach but is an 
example of how to use a map to get the functionality you want.

             hope this helps
                    Ziv

Torleif Sandnes wrote:
> Hi.
> 
> I am building an application that has to read Dicom images and want to 
> listen for all error events that the imagereader can send. Based on the 
> error, I want to provide a message to the user describing the error.
> 
> Using igstkEventTransductionMacro, I could add a state to my imagereader 
> component for every errorevent from igstk::DicomImageReader:
> 
>    DICOMInvalidRequestErrorEvent
>    DICOMImageDirectoryEmptyErrorEvent
>    DICOMImageDirectoryDoesNotExistErrorEvent
>    DICOMImageDirectoryIsNotDirectoryErrorEvent
>    DICOMImageDirectoryDoesNotHaveEnoughFilesErrorEvent
>    DICOMImageSeriesFileNamesGeneratingErrorEvent
>    DICOMImageReadingErrorEvent
> 
> This would introduce seven new states and (at least) seven new 
> transitions. All I want to do with these events is to convert it into a 
> message to the user, so each transition's processing method would do 
> essentially the same thing. This seems to be adding a lot of complexity 
> to my statemachine to accomplish just a little.
> 
> Ideally, I would like to add only one "imagereading failed" state to my 
> component and be able to differentiate between the events. Is this 
> possible?
> 
> Regards,
> Torleif Sandnes
> Sintef Health Research
> _______________________________________________
> IGSTK-Users mailing list
> IGSTK-Users at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
> 
> 
> 


-- 
Ziv Yaniv, PhD., Research Assistant Professor
Imaging Science and Information Systems (ISIS) Center
Department of Radiology
Georgetown University Medical Center
2115 Wisconsin Avenue, Suite 603
Washington, DC, 20007,

Phone: +1-202-687-7286
Fax: +1-202-784-3479
email: zivy at isis.imac.georgetown.edu
web: http://isiswiki.georgetown.edu/zivy/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: IGSTKErrorObserver.h
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20070626/5dd9510e/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: IGSTKErrorObserver.cxx
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20070626/5dd9510e/attachment.ksh>


More information about the IGSTK-Users mailing list