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

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

// method: write_models_cc
//
// arguments: none
//   
// return:
//   a logical_1 value indicating status
//
// this method writes all model files for the training mode
//
logical_1 Image_segmentation::write_models_cc() {

  for (int_4 i=0; i<num_models_d; i++) {

    // update the means and the covariance matrices for all models
    //
    if (ia_d[i].seg_components_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"write_models_cc", (char_1*)"error
                       updating the model components");
      return ISIP_FALSE;
    }

    // write the model files for training mode
    //
    if (ia_d[i].write_cc() == ISIP_FALSE) {
      error_handler_cc((char_1*)"write_models_cc", (char_1*)"error
                       writing the model files");
      return ISIP_FALSE;
    }
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}
