// file: $USFS/class/image_segmentation/v1.0/imags_proc_0.cc
//

// isip include files
//
#include "image_segmentation.h"
#include "image_segmentation_constants.h"

// method: process_cc
//
// arguments:
//   char_1* image_file: (input) the image file name
//   char_1* seg_file: (input) the segmentation data file name
//   char_1* output_imagefile: (input) the output image file name
//   char_1* output_datafile: (input) the output data file name
//
// return:
//   a logical_1 value indicating status
//
// this method processes the given image file either in the training
// mode or the test mode
//
logical_1 Image_segmentation::process_cc(char_1* image_file_a,
					 char_1* seg_file_a,
					 char_1* output_imagefile_a,
					 char_1* output_datafile_a) {
  // check for the train mode
  //
  if (mode_d == IMAGS_MODE_TRAIN) {
    if (train_cc(image_file_a, seg_file_a) == ISIP_FALSE) {
      error_handler_cc((char_1*)"process_cc", (char_1*)"error training");
      return ISIP_FALSE;
    }
  }

  // check for the test mode
  //
  else if (mode_d == IMAGS_MODE_TEST) {
    if (test_cc(image_file_a, output_imagefile_a, output_datafile_a)
	== ISIP_FALSE) {
      error_handler_cc((char_1*)"process_cc", (char_1*)"error testing");
      return ISIP_FALSE;
    }
  }

  // unknown mode
  //
  else {
    error_handler_cc((char_1*)"process_cc", (char_1*)"unknown mode");
    return ISIP_FALSE;
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}
