CSIRO Mathematics, Informatics and Statistics
|
|
|
Next: Coupling Up: What is a LIAR Previous: The Image Header
Image analysis routine designFigure 3 provides three possible ways that a simple image analysis routine may be coded in C. Here, we are using the generic pixel type PIX_TYPE. In Fig. 3a, direct referencing to the variables in the image header structure (Fig. 2) is used. In Fig. 3b, indirect referencing to these same variables is used via ``function'' calls. In Fig. 3c, no data structure is used and only the information concerning the routine is passed to it.
From the examples seen in Fig. 3, the one given in (a) is not portable, since it relies on direct referencing to variables held within the IMAGE data structure. Thus, it does not conform to the LIAR methodology. However, by elimating either direct referencing or the data structure, as shown in Fig. 3(b) and (c), it becomes possible to produce portable code; that is, code that is loosely coupled to its environment. Both (b) and (c) conform to the LIAR methodology. However, version (c) is the easiest to port between different IAS's because it has lowest form of coupling. However, version (b), is worth a second look, it passes a reference to the data structure, via a pointer, rather than the individual variables. This has two advantages: 1) it leads to simpler interfaces; and 2) athough this approach provides the routine with more information than required, the extra information contained in the image header can be used when upgrading the routine without having to modify the callers (e.g., higher level routines) of that routine. The disadvantages with version (b) are: 1) the ``functions'' used to access the information from the image header must be written and this might not be a simple task when moving from one image analysis system to another; and 2) low level functions may be concerned about issues that should not affect them; that is whether the image data is compressed or not.
Next: Coupling Up: What is a LIAR Previous: The Image Header Ed Breen Tue Sep 3 17:19:31 EST 1996 |