// file: $USFS/class/image_analysis/v1.0/imaga_proc_0.cc
//

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

#include "image_analysis_constants.h"
#include <integral_constants.h>

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

  // check for the test mode
  //
  if (mode_d == IMAGA_MODE_TEST) {
    if (test_cc(sbe_a, image_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) == 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;
  
}
