contrib/brl/bseg/sdet/sdet_denoise_mrf_params.cxx
Go to the documentation of this file.
00001 // This is brl/bseg/sdet/sdet_denoise_mrf_params.cxx
00002 #include "sdet_denoise_mrf_params.h"
00003 //:
00004 // \file
00005 // See sdet_denoise_mrf_params.h
00006 //
00007 //-----------------------------------------------------------------------------
00008 #include <vcl_sstream.h>
00009 #include <vcl_iostream.h>
00010 
00011 //------------------------------------------------------------------------
00012 // Constructors
00013 //
00014 
00015 sdet_denoise_mrf_params::
00016 sdet_denoise_mrf_params(const sdet_denoise_mrf_params& dmp)
00017   : gevd_param_mixin(), vbl_ref_count()
00018 {
00019   InitParams(dmp.radius_, dmp.kappa_, dmp.beta_);
00020 
00021 }
00022 
00023 sdet_denoise_mrf_params::
00024 sdet_denoise_mrf_params(double radius, double kappa, double beta)
00025 {
00026   InitParams(radius, kappa, beta);
00027 }
00028 
00029 void sdet_denoise_mrf_params::InitParams(double radius,
00030                                          double kappa,
00031                                          double beta)
00032 {
00033   radius_ = radius;
00034   kappa_ = kappa;
00035   beta_ = beta;
00036 }
00037 
00038 //-----------------------------------------------------------------------------
00039 //
00040 //:   Checks that parameters are within acceptable bounds
00041 bool sdet_denoise_mrf_params::SanityCheck()
00042 {
00043   //  Note that msg << ends seems to restart the string and erase the
00044   //  previous string. We should only use it as the last call, use
00045   //  vcl_endl otherwise.
00046   vcl_stringstream msg;
00047   bool valid = true;
00048 
00049   if (radius_ < 1.0)
00050     {
00051       msg << "ERROR: no binary cliques!\n";
00052       valid = false;
00053     }
00054   if (kappa_ < 0.0f)
00055     {
00056       msg << "ERROR: kappa can't be negative\n";
00057       valid = false;
00058     }
00059   if (beta_ < 0.0f)
00060     {
00061       msg << "ERROR: beta can't be negative\n";
00062       valid = false;
00063     }
00064   msg << vcl_ends;
00065 
00066   SetErrorMsg(msg.str().c_str());
00067   return valid;
00068 }
00069 
00070 vcl_ostream& operator << (vcl_ostream& os, const sdet_denoise_mrf_params& dmp)
00071 {
00072   return
00073   os << "sdet_denoise_mrf_params:\n[---\n"
00074      << "radius" << dmp.radius_ << vcl_endl
00075      << "kappa " << dmp.kappa_ << vcl_endl
00076      << "beta " << dmp.beta_ << vcl_endl
00077      << "---]\n";
00078 }