[IGSTK-Developers] String Events vs. Get Methods

David Gobbi dgobbi at atamai.com
Tue Oct 4 13:12:59 EDT 2005


Hi Everyone,

This came up at the last t-con, and I thought that rather
than letting it eat up too much time at the next t-con,
it would be better to try to get it at least partially
resolved on the mailing list.

Right now, the application get the patient name and other
info from the DICOMImageReader by calling a "Request"
method, after which the reader will send either a StringEvent
that contains the info, or an InvalidRequestEvent.

There has to be application code to do the following:
 1) set an observer for DICOMPatientNameEvent, and create a callback 
object for the observer
 2) set an observer for InvalidRequestEvent, and create a callback 
object for the observer
 3) define a callback function (called when the request is successful)
 4) define an error function (called when the request failed)
 5) perform the request

I have three issues with this. 

One is that a large amount of code is required to do a very
simple thing, all just to make sure that the patient name is
not requested before the file is successfully read.

The second is that the code is separated into three separate
chunks (set observers, define callbacks, perform request) which
makes it more difficult for a programmer (or reviewer) to look
at the code and know whether it is doing the right thing.

Third, if there is a lot of information that is needed from
the image (patient, patient ID, physician, hospital, date,
default window/level, modality, scan type) then these issues are
multiplied by N.


Personally, I think that the logical place for error checking
is at the point in the code where the file is read.  We can
trust that the application developer can check this, and if
we don't trust the application developer, then we need an
application "state machine" that does these checks.

It should be fine if we simply have GetPatientName() etc.
methods that return a suitable default (e.g. an empty string)
if the file was not successfully read.

 - David



More information about the IGSTK-Developers mailing list