contrib/brl/bseg/sdet/sdet_region_proc_params.cxx
Go to the documentation of this file.
00001 // This is brl/bseg/sdet/sdet_region_proc_params.cxx
00002 #include "sdet_region_proc_params.h"
00003 //:
00004 // \file
00005 // See sdet_region_proc_params.h
00006 //
00007 //-----------------------------------------------------------------------------
00008 
00009 #include <vcl_iostream.h>
00010 #include <vcl_sstream.h>
00011 
00012 //------------------------------------------------------------------------
00013 // Constructors
00014 //
00015 
00016 sdet_region_proc_params::
00017 sdet_region_proc_params(const sdet_region_proc_params& rpp)
00018   : gevd_param_mixin()
00019 {
00020   InitParams((sdet_detector_params)rpp.dp_,
00021              rpp.verbose_,
00022              rpp.debug_,
00023              rpp.array_scale_
00024             );
00025 }
00026 
00027 sdet_region_proc_params::
00028 sdet_region_proc_params(const sdet_detector_params& dp,
00029                         bool verbose,
00030                         bool debug,
00031                         int array_scale
00032                         )
00033 {
00034   InitParams(dp, verbose, debug, array_scale);
00035 }
00036 
00037 void sdet_region_proc_params::InitParams(const sdet_detector_params& dp,
00038                                          bool verbose,
00039                                          bool debug,
00040                                          int array_scale)
00041 {
00042   array_scale_ = array_scale;
00043   debug_ = debug;
00044   verbose_ = verbose;
00045   dp_ = dp;
00046 }
00047 
00048 //-----------------------------------------------------------------------------
00049 //
00050 //:   Checks that parameters are within acceptable bounds
00051 //    Note that msg << ends seems to restart the string and erase the
00052 //    previous string. We should only use it as the last call, use
00053 //    vcl_endl otherwise.
00054 bool sdet_region_proc_params::SanityCheck()
00055 {
00056   vcl_stringstream msg;
00057   bool valid = true;
00058 
00059   if (array_scale_<2)
00060   {
00061     msg << "ERROR: don't use a label array resolution factor less than 2x";
00062     valid = false;
00063   }
00064 
00065   valid = valid && dp_.SanityCheck();
00066   msg << dp_.GetErrorMsg() << vcl_ends;
00067 
00068   SetErrorMsg(msg.str().c_str());
00069   return valid;
00070 }
00071 
00072 vcl_ostream& operator << (vcl_ostream& os, const sdet_region_proc_params& rpp)
00073 {
00074   return
00075   os << "sdet_region_proc_params:\n[---\n"
00076      << rpp.dp_ << "\n  ---\n"
00077      << "debug " << rpp.debug_ << vcl_endl
00078      << "verbose " << rpp.verbose_ << vcl_endl
00079      << "label array scale " << rpp.array_scale_ << vcl_endl
00080      << "---]" << vcl_endl;
00081 }