Page 134 -
P. 134

108   Chapter 3 ■ Digital Morphology


                           encourage experimentation with morphological techniques, a programming
                           language named MAX (Morphology And eXperimentation) has been devised.
                           MAX is a very simple language in the style of Pascal and Modula, the sole
                           purpose of which is to evaluate morphological expressions.















                                       (a)                    (b)                    (c)
                           Figure 3.16: Computing the roughness of reservoir rock pores. (a) A pore image. (b)
                           Opening of depth 3. Grey areas are pixels that have been changed. (c) Opening of depth 6.
                           Used by permission of Dr. N. Wardlaw, Department of Geology and Geophysics, University
                           of Calgary.


                             To help explain the use of MAX, here is a simple program that reads in two
                           images and copies them to new image files:

                                    // Test of input and output in MAX.
                                    image a, b;
                                    begin
                                    // Read in two images
                                          doa<<    ˝ a˝;
                                          dob<<    ˝ b˝;

                                    // Copy them to new files.
                                          do b>>˝copyb˝;
                                          do a>>˝copya˝;
                                    end;
                             The // characters begin a comment, which extends to the end of the line. The
                           MAX compiler ignores any characters within a comment. The first statements
                           in this program are declarations; all variables must be declared between the
                           beginning of the file and the first begin statement. MAX recognizes only three
                           types:

                                IMAGE is used for both data and structuring elements interchangeably.
                                INT is a traditional integer type.
                                PIXEL is a pair of integers that represent the row and column indices of a
                                pixel inanimage.
   129   130   131   132   133   134   135   136   137   138   139