## NAME

         morpho - higher level function performing iterative  morpho-
         logical modification based on morphIterMod_Image

## SYNOPSIS

          #include "CVIPimage.h"
          #include "CVIPmorph.h"

         Image * morpho(const  Image   *binImage,
            const char * surround_str, CVIP_BOOLEAN rotate,
            int boolFUNC, int connectedness,
            unsigned no_of_iter, int fields)

          <binImage> - pointer to Image structure (binary image)
          <surround_str> - pointer to a string  holding  the  set  of
         surrounds, such as "1, 7, 8".
          <rotate> - rotate or not (CVIP_YES, CVIP_NO)
          <boolFUNC> - integer number for the  Boolean  function  (1-
         6):
              1: 0
              2: !a
              3: ab
              4: a+b
              5: a^b
              6: (!a)b
          <connectedness>  -  the  connectivity  scheme  being   used
         (FOUR,EIGHT,SIX_NWSE,SIX_NESW)
          <no_of_iter> - number of iterations to perform
          <fields> - number of subfields into which the image  tesse-
         lation will be divided

## PATH

         $CVIPHOME/MORPHOLOGICAL/morph.c

## DESCRIPTION

         This is a wrapper function for morphIterMod_Image, for  more
         information, see morphIterMod_Image.

## TYPES AND CONSTANTS

         none

## RETURN VALUES

         A pointer to the modified image

## EXAMPLE

          #include "CVIPtoolkit.h"
          #include "CVIPdef.h"
          #include "CVIPimage.h"
          #include "CVIPmorph.h"

          main () {
             Image *cvipImage, *out_img;
             IMAGE_FORMAT  format;
             char *inputfile,
               *surround_str = (char *) malloc(sizeof(char) * 80),
                temp;
             CVIP_BOOLEAN rotate;
             int boolFUNC,
                connectedness,
                fields;
                unsigned no_of_iter;

             print_CVIP("\n\t\tEnter the Input File Name:  ");
             inputfile = getString_CVIP();

             /* read in the input image */
             cvipImage = (Image *) read_Image(inputfile, 1);
             if(cvipImage == NULL) {
                error_CVIP("init_Image",
                   "could not read image file");
                free(inputfile);
                exit(1);
              } else view_Image(cvipImage,inputfile);

             print_CVIP("Please input the surrounds:");
             fgets(surround_str, 80, stdin);

             print_CVIP("Rotate? (y/n)");
             scanf("%1s", &temp);
             rotate = (temp == 'y') ? CVIP_YES : CVIP_NO;

             print_CVIP("The boolean funciton number (1-6):");
             scanf("%d", &boolFUNC);
                if (boolFUNC < 0 || boolFUNC > 6) {
                   error_CVIP("main",
                    "The boolean funciton number should be 1 to 6");
                exit(1);
             }

             print_CVIP("Connectedness  (1-FOUR;2-EIGHT;3-SIX_NWSE;4-
         SIX_NESW):");
             scanf("%1s", &temp);
             switch (temp) {
                case '1': connectedness = FOUR; break;
                case '2': connectedness = EIGHT; break;
                case '3': connectedness = SIX_NWSE; break;
                case '4': connectedness = SIX_NESW; break;
                default:
                   error_CVIP("main",
                     "The connectedness  number should be 1 to 4");
                   exit(1);
             }
             print_CVIP("Number of iterations (0 for infinity):");
             scanf("%d", &no_of_iter);

             print_CVIP("Number of subfields (1-3):");
             scanf("%d", &fields);

             if (fields < 1 || fields > 3) {
                error_CVIP("main",
                 "The number of subfields should be 1 to 3");
                exit(1);
             }

             if ( (out_img = morpho(cvipImage, surround_str,
                   rotate, boolFUNC, connectedness, no_of_iter,
                   fields)) == (Image *)NULL) {
                error_CVIP("main", "Iterative modification  error");
                exit(1);
             } else {
                view_Image(out_img,"Iterative modification");
             }

          }
          /*
          ** end of function main
          */

## HISTORY

         History information recorded: None

## SEE ALSO

         libmorph, morphIterMod_Image

## AUTHOR

         Copyright (C) 1996 SIUE - by Scott E. Umbaugh  and  Yansheng
         Wei.