OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
atp-config-test.cpp
Go to the documentation of this file.
1 //**************************************************************************************************
2 //
3 // OSSIM Open Source Geospatial Data Processing Library
4 // See top level LICENSE.txt file for license information
5 //
6 //**************************************************************************************************
7 #include "../src/AtpConfig.h"
8 #include <ossim/init/ossimInit.h>
9 
10 using namespace std;
11 using namespace ATP;
12 using namespace ossim;
13 
14 /**************************************************************************************************
15  *
16  * Test of AtpConfig subsystem
17  *
18  **************************************************************************************************/
19 
20 int main(int argc, char** argv)
21 {
22  clog << "ATP Config Test" << endl;
23  ossimInit::instance()->initialize(argc, argv);
24 
25  // Initialize correlation parameters:
26  AtpConfig& atpConfig = AtpConfig::instance();
27  clog << "\nDump of default common ATP params:"<<endl;
28  clog << atpConfig << endl;
29 
30  if (!atpConfig.readConfig("crosscorr"))
31  {
32  clog <<"\nError reading testConfig!"<<endl;
33  return 1;
34  }
35  clog << "\n******************************************************************"<<endl;
36  clog << "\nDump of crosscorr ATP params:"<<endl;
37  clog << atpConfig << endl;
38 
39  if (!atpConfig.readConfig("testConfig"))
40  {
41  clog <<"\nError reading testConfig!"<<endl;
42  return 1;
43  }
44  clog << "\n******************************************************************"<<endl;
45  clog << "\nDump of testConfig ATP params:"<<endl;
46  clog << atpConfig << endl;
47 
48  Json::Value shortForm;
49  shortForm["myCustomParam"] = false;
50  shortForm["peakThreshold"] = 0.8;
51  shortForm["algorithm"] = "override-test";
52  shortForm["newParam"] = "oops";
53  shortForm["diagnosticLevel"] = 3;
54  atpConfig.loadJSON(shortForm);
55  clog << "\n******************************************************************"<<endl;
56  clog << "\nDump of short-form ATP params override:"<<endl;
57  clog << atpConfig << endl;
58 
59  if (atpConfig.diagnosticLevel(2) && !atpConfig.diagnosticLevel(4))
60  clog<<"\nCorrectly processed diagnostic level."<<endl;
61  else
62  clog<<"\nDiagnostic level test failed."<<endl;
63 
64  return 0;
65 }
void initialize(int &argc, char **argv)
Definition: ossimInit.cpp:119
int main(int argc, char **argv)
This code was derived from https://gist.github.com/mshockwave.
Definition: Barrier.h:8
THESE FUNCTIONS REQUIRE OPENCV.
bool diagnosticLevel(unsigned int level) const
Convenience method returns TRUE if the currently set diagnostic level is <= level.
Definition: JsonConfig.cpp:461
static ossimInit * instance()
Definition: ossimInit.cpp:89
virtual void loadJSON(const Json::Value &params_json_node)
Reads the params controlling the process from the JSON node named "parameters".
Definition: JsonConfig.cpp:403
bool readConfig(const std::string &configName="")
Definition: AtpConfig.cpp:38
Singleton class maintaining parameters affecting the automatic tie point generation.
Definition: AtpConfig.h:24