Listing 8 gray_shade_region - implements region growing with gray shades only

    /*******************************************
    *
    *   gray_shade_region(...
    *
    *   This function segments an image by
    *   growing regions based only on gray
    *   shade.
    *
    *******************************************/

gray_shade_region(in_name, out_name, the_image, out_image, il, ie, ll, le,
                  diff, min_area, max_area)
   char   in_name[], out_name[];
   int    il, ie, ll, le;
   short  the_image[ROWS][COLS],
         out_image[ROWS][COLS],
         diff, min_area, max_area;
{
   int    a, b, big_count, count, i, j, k, l,
         not_finished, length, width;
   short  temp[3][3];
   struck tiff_header_struct image_header;

   if(does_not_exist(out_name)){
      printf("/n/n output file does not exist %s",
             out_name);
      read_tiff_header(in_name, &image_header);
      round_off_image_size(&image_header,
                        &length, &width);
      image_header.image_length = length*ROWS;
      image_header.image_width  = width*COLS;
      create_allocate_tiff_file(out_name, &image_header,
                            out_image);
   }  /* ends if does_not_exist */

   read_tiff_image(in_name, the_image, il, ie, ll, le);
   pixel_grow(the_image, out_image, diff,
            min_area, max_area);
   write_array_into_tiff_image(out_name, out_image,
                          il, ie, ll, le);

}  /* ends gray_shade_region */

/*End of File */