// file: $USFS/class/image_analysis/v6.1/imaga_fract_18.cc
//

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

// method: fract_train_cc
//
// arguments:
//  uint_1* blk_r: (input) buffer for red color
//  uint_1* blk_g: (input) buffer for green color
//  uint_1* blk_b: (input) buffer for blue color
//  int_4 offset_w: (input) offset in width for the image block
//  int_4 offset_h: (input) offset in height for the image block
//  int_4 width: (input) width of the image block
//  int_4 height: (input) height of the image block
//
// return:
//  a logical_1 value indicating status
//
// this method computes the fractal dimension on an image block in
// the training mode
//
logical_1 Image_analysis::fract_train_cc(uint_1* blk_r_a, uint_1* blk_g_a,
					 uint_1* blk_b_a, int_4 offset_w_a,
					 int_4 offset_h_a, int_4 width_a,
					 int_4 height_a) {
  
  // compute the fractal dimension
  //
  if (fract_compute_cc(blk_r_a, blk_g_a, blk_b_a, offset_w_a, offset_h_a,
		       width_a, height_a) == ISIP_FALSE) {
    error_handler_cc((char_1*)"fract_train_cc",
		     (char_1*)"error while computing the entropy");
    return ISIP_FALSE;
  }

  // provide some debugging information
  //
  if (debug_level_d > ISIP_DEBUG_BRIEF) {
    fprintf(stdout, "<%s> %s = %ld\n", "Image_analysis::fract_compute_cc",
	    "fract_npxls", fract_r_npxls_d);
    fprintf(stdout, "<%s> %s = %ld\n", "Image_analysis::fract_compute_cc",
	    "fract_r_nimages_d", fract_r_nimages_d);
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
