// file: $USFS/class/image_analysis/v6.0/imaga_proc_5.cc
//

// isip include files
//
#include "image_analysis.h"
#include "image_analysis_constants.h"

// method: process_cc
//
// arguments:
//  float_8& sbe: (output) the image's sbe value
//  char_1* image_fname: (input) the image file name
//  char_1* seg_fname: (input) the segmentation data file name
//
// return:
//  a logical_1 value indicating the status
//
// this method processes a given image on some specific region and output
// an sbe rating for that image.
//
logical_1 Image_analysis::process_cc(float_8& sbe_a, char_1* image_fname_a,
				     char_1* seg_fname_a) {
  
  // provide some information
  //
  if (debug_level_d > ISIP_DEBUG_DETAILED) {
    fprintf(stdout, "<%s> mode = %ld, image_filename = %s,
            seg_filename = %s\n", "Image_analysis::process_cc",
	    mode_d, image_fname_a, seg_fname_a);
  }

  // check for the test mode
  //
  if (mode_d == IMAGA_MODE_TEST) {
    if (test_cc(sbe_a, image_fname_a, seg_fname_a) == ISIP_FALSE) {
      error_handler_cc((char_1*)"process_cc",
		       (char_1*)"error in test mode");
      return ISIP_FALSE;
    }
  }
  
  // check for the train mode
  //
  else if (mode_d == IMAGA_MODE_TRAIN) {
    if (train_cc(image_fname_a, seg_fname_a) == ISIP_FALSE) {
      error_handler_cc((char_1*)"process_cc",
   		       (char_1*)"error training the images");
      return ISIP_FALSE;
    }
  }
  
  // else: unknown mode
  //
  else {
    error_handler_cc((char_1*)"process_cc", (char_1*)"unknown mode");
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}
