contrib/gel/gevd/gevd_region_proc_params.cxx
Go to the documentation of this file.
00001 // This is gel/gevd/gevd_region_proc_params.cxx
00002 #include "gevd_region_proc_params.h"
00003 //:
00004 // \file
00005 // See gevd_region_proc_params.h
00006 //
00007 //-----------------------------------------------------------------------------
00008 
00009 #include <vcl_iostream.h>
00010 #include <vcl_sstream.h>
00011 
00012 //------------------------------------------------------------------------
00013 // Constructors
00014 //
00015 
00016 gevd_region_proc_params::
00017 gevd_region_proc_params(const gevd_region_proc_params& rpp)
00018   : gevd_param_mixin()
00019 {
00020   InitParams(rpp.expand_scale_,
00021              rpp.burt_adelson_factor_,
00022              rpp.debug_,
00023              rpp.verbose_,
00024              (gevd_detector_params)rpp.dp_
00025             );
00026 }
00027 
00028 gevd_region_proc_params::gevd_region_proc_params(float expand_scale,
00029                                        float burt_adelson_factor,
00030                                        bool debug,
00031                                        bool verbose,
00032                                        const gevd_detector_params& dp
00033                                        )
00034 {
00035   InitParams(expand_scale, burt_adelson_factor, debug, verbose, dp);
00036 }
00037 
00038 void gevd_region_proc_params::InitParams(float expand_scale,
00039                                     float burt_adelson_factor,
00040                                     bool debug,
00041                                     bool verbose,
00042                                     const gevd_detector_params& dp)
00043 {
00044   expand_scale_ = expand_scale;
00045   burt_adelson_factor_ = burt_adelson_factor;
00046   debug_ = debug;
00047   verbose_ = verbose;
00048   dp_ = dp;
00049 }
00050 
00051 //-----------------------------------------------------------------------------
00052 //
00053 //:   Checks that parameters are within acceptable bounds
00054 //    Note that msg << ends seems to restart the string and erase the
00055 //    previous string. We should only use it as the last call, use
00056 //    vcl_endl otherwise.
00057 bool gevd_region_proc_params::SanityCheck()
00058 {
00059   vcl_stringstream msg;
00060   bool valid = true;
00061 
00062   if (expand_scale_ <0.5 || expand_scale_ >2) {
00063     msg << "currently only handle a scale factor of 0.5, 1.0, or 2.0\n";
00064     valid = false;
00065   }
00066 
00067   if (burt_adelson_factor_ > .6 || burt_adelson_factor_ <.3) {
00068     msg << "burt_adelson_factor must be in the range .3<=ka<=.6\n";
00069     valid = false;
00070   }
00071 
00072   valid = valid && dp_.SanityCheck();
00073   msg << dp_.GetErrorMsg() << vcl_ends;
00074 
00075   SetErrorMsg(msg.str().c_str());
00076   return valid;
00077 }
00078 
00079 vcl_ostream& operator << (vcl_ostream& os, const gevd_region_proc_params& rpp)
00080 {
00081   return
00082   os << "gevd_region_proc_params:\n[---\n"
00083   // << rpp.dp_ << "\n  ---\n"
00084      << "expand scale factor  " << rpp.expand_scale_ << vcl_endl
00085      << "burt_adelson_factor " << rpp.burt_adelson_factor_ << vcl_endl
00086      << "debug " << rpp.debug_ << vcl_endl
00087      << "verbose " << rpp.verbose_ << vcl_endl
00088      << "---]" << vcl_endl;
00089 }