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

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

#include <integral_constants.h>

// method: edge_normalize_cc
//
// arguments: none
//
// return: a logical_1 value indicating status
//
// this method normalizes a edge detection
//
logical_1 Image_analysis::edge_normalize_cc() {
  
  if (check_segflag_cc() == ISIP_TRUE) {

    // if no region corresponding to the transcription was found in the
    // image, no computation needed
    //
    if (polygon_list_d == (Link_list*)NULL) {
      return ISIP_TRUE;
    }
    else if ((polygon_list_d->get_head_cc()) == (Link_node*)NULL) {
      return ISIP_TRUE;
    }
  }

  if (edge_t_tlines_d != (int_4)0) {
  
    // declare a scaling constant
    //
    float_8 scale = 1.0 / (float_8)edge_t_tlines_d;
  
    // normalize
    //
    for (int_4 i=0; i< edge_r_nbins_d; i++) {
    
      // normalize the data
      //
      edge_t_lpdf_d[i] *= scale;
    }
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}


