Debian Codegraph @

test/test2.cc

raw symbols SCIP
1 /**********************************************************************
2 test2.cc: test app for jiblib
3 Author(s): [email protected]
4 Copyright (C) 2016-2020 European Union (Joint Research Centre)
5
6 This file is part of jiplib.
7
8 jiplib is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 jiplib is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with jiplib. If not, see <https://www.gnu.org/licenses/>.
20 ***********************************************************************/
21 #include <memory>
22 #include "base/Optionjl.h"
23 #include "algorithms/Filter2d.h"
24 #include "apps/AppFactory.h"
25 #include "imageclasses/Jim.h"
26
27 using namespace std;
28
29 int main(int argc, char *argv[])
30 {
31 Optionjl<string> output_opt("o", "output", "Output image file");
32 Optionjl<string> oformat_opt("of", "oformat", "Output image format (see also gdal_translate).","GTiff");
33 Optionjl<string> option_opt("co", "co", "Creation option for output file. Multiple options can be specified.");
34 Optionjl<unsigned long int> memory_opt("mem", "mem", "Buffer size (in MB) to read image data blocks in memory",0,1);
35
36 option_opt.setHide(1);
37 memory_opt.setHide(1);
38
39 bool doProcess;//stop process when program was invoked with help option (-h --help)
40 app::AppFactory app(argc,argv);
41 try{
42 doProcess=output_opt.retrieveOption(app);
43 oformat_opt.retrieveOption(app);
44 option_opt.retrieveOption(app);
45 memory_opt.retrieveOption(app);
46 if(doProcess){
47 if(output_opt.empty()){
48 std::cerr << "Error: no output file provided (use option -o). Use --help for help information" << std::endl;
49 exit(1);
50 }
51 }
52 shared_ptr<Jim> outputImg=Jim::createImg(app);
53 outputImg->setFile(output_opt[0],oformat_opt[0]);
54 outputImg->close();
55 std::cout << "test2: done" << std::endl;
56 }
57 catch(string helpString){//help was invoked
58 std::cout << helpString << std::endl;
59 return(1);
60 }
61 return(0);
62 }