contrib/brl/bseg/sdet/sdet_watershed_region_proc_params.cxx
Go to the documentation of this file.
00001 // This is brl/bseg/sdet/sdet_watershed_region_proc_params.cxx
00002 #include "sdet_watershed_region_proc_params.h"
00003 //:
00004 // \file
00005 // See sdet_watershed_region_proc_params.h
00006 //
00007 //-----------------------------------------------------------------------------
00008 
00009 #include <vcl_iostream.h>
00010 #include <vcl_sstream.h>
00011 
00012 //-----------------------------------------------------------------------------
00013 //
00014 //:   Checks that parameters are within acceptable bounds
00015 //    Note that msg << ends seems to restart the string and erase the
00016 //    previous string. We should only use it as the last call, use
00017 //    vcl_endl otherwise.
00018 bool sdet_watershed_region_proc_params::SanityCheck()
00019 {
00020   vcl_stringstream msg;
00021   bool valid = true;
00022 
00023   if (min_area_<2)
00024   {
00025     msg << "ERROR: don't use a label array resolution factor less than 2x\n";
00026     valid = false;
00027   }
00028 
00029   valid = valid && wp_.SanityCheck();
00030   msg << wp_.GetErrorMsg() << vcl_ends;
00031 
00032   SetErrorMsg(msg.str().c_str());
00033   return valid;
00034 }
00035 
00036 vcl_ostream& operator << (vcl_ostream& os, const sdet_watershed_region_proc_params& p)
00037 {
00038   return
00039   os << "sdet_watershed_region_proc_params:\n[---\n" << p.wp_
00040      << "\n  ---\ndebug " << p.debug_
00041      << "\nverbose " << p.verbose_
00042      << "\nmin region area " << p.min_area_
00043      << "\nregion merge tol " << p.merge_tol_
00044      << "\nmerge priority " << p.merge_priority_
00045      << "\n---]\n";
00046 }