Hugin trunk 0.1
Loading...
Searching...
No Matches
PTScriptParsing.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
25#ifndef _PANODATA_PTSCRIPTPARSING_H
26#define _PANODATA_PTSCRIPTPARSING_H
27
28#include <hugin_shared.h>
29#include <string>
30#include <vigra/diff2d.hxx>
31
33
34
35
36namespace HuginBase {
37namespace PTScriptParsing {
38
39
41 IMPEX bool getPTParam(std::string & output, const std::string & line, const std::string & parameter);
42
43// template <class T>
44// bool getParam(T & value, const std::string & line, const std::string & name);
45
47 template <class T>
48 bool getIntParam(T & value, const std::string & line, const std::string & name);
49
50
51 bool readVar(Variable & var, int & link, const std::string & line);
52/*
53 bool getPTStringParam(std::string & output, const std::string & line,
54 const std::string & parameter);
55
56 bool getPTStringParamColon(std::string & output, const std::string & line, const std::string & parameter);
57*/
58
59 bool getDoubleParam(double & d, const std::string & line, const std::string & name);
60
61 bool getPTDoubleParam(double & value, int & link,
62 const std::string & line, const std::string & var);
64 struct ImgInfo
65 {
66 std::string filename;
67 std::string flatfieldname;
68 std::map<std::string, double> vars;
69 std::map<std::string, int> links;
70 int f;
71 // int blend_radius;
75 vigra::Rect2D crop;
77 double cropFactor;
78 bool enabled;
79
80
81 public:
83 {
84 init();
85 }
86
87 explicit ImgInfo(const std::string & line)
88 {
89 init();
90 this->parse(line);
91 }
92
93 protected:
94 void init();
95
96 public:
97 void parse(const std::string & line);
98
99 public:
100 static const char *varnames[];
101 static double defaultValues[];
102
103 };
104
105
106//==============================================================================
107// template implementation
108
109
110#if 0
111 template <class T>
112 bool getParam(T & value, const std::string & line, const std::string & name)
113 {
114 std::string s;
115 if (!getPTParam(s, line, name)) {
116 return false;
117 }
118 std::istringstream is(s);
119 is >> value;
120 return true;
121 }
122#endif
123
124 template <class T>
125 bool getIntParam(T & value, const std::string & line, const std::string & name)
126 {
127 std::string s;
128 if (!getPTParam(s, line, name)) {
129 return false;
130 }
131 std::istringstream is(s);
132 is >> value;
133 return true;
134 }
135
136} // namespace
137} // namespace
138#endif //_H
#define IMPEX
bool getIntParam(T &value, const std::string &line, const std::string &name)
bool getPTDoubleParam(double &value, int &link, const std::string &line, const std::string &var)
bool readVar(Variable &var, int &link, const std::string &line)
bool getDoubleParam(double &d, const std::string &line, const std::string &name)
bool getPTParam(std::string &output, const std::string &line, const std::string &parameter)
helper functions for parsing of a script line
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
ImgInfo(const std::string &line)
std::map< std::string, int > links
std::map< std::string, double > vars
void parse(const std::string &line)
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41