// file: $USFS/class/image_analysis/v3.0/imaga_load_1.cc
//

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

// method: load_model_cc
//
// arguments: none
//
// return: a logical_1 value indicating status
//
// this method loads a model file
//
logical_1 Image_analysis::load_model_cc() {
  
  // load the appropriate model
  //
  if (algorithm_d == IMAGA_ALG_HISTOGRAM) {
    if (hist_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_EDGEDET) {
    if (edge_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_TRUE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_FACTOR) {
    if (pca_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_DIFF) {	
    if (dent_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_SD) {
    if (sd_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_ENT) {
    if (ent_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_RLE) {
    if (rle_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }

  else if (algorithm_d == IMAGA_ALG_FRACT) {
    if (fract_load_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"load_model_cc",
		       (char_1*)"error loading the reference model");
      return ISIP_FALSE;
    }
  }
  
  // else: unknown algorithm
  //
  else {
    error_handler_cc((char_1*)"load_model_cc", (char_1*)"unknown algorithm");
    return ISIP_FALSE;
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}



