24 #ifndef _PANODATA_IMAGEVARIABLETRANSLATE_H
25 #define _PANODATA_IMAGEVARIABLETRANSLATE_H
71 const std::string& name,
90 const std::string& name,
121 template <
char code1,
char code2 = '\0',
char code3 = '\0',
class T =
double>
127 static const char code[] = {code1, code2, code3,
'\0'};
128 return ((std::string)code) == name;
143 static const char code[] = {code1, code2, code3,
'\0'};
144 map.insert(std::make_pair(code,
Variable(code, (
double)var.
getData())));
161 template <
char base_code,
class T =
double,
size_t size = 4>
167 return name.size() == 2 && name[0] == base_code && name[1] >=
'a' && name[1] <
'a' + char(size);
172 return var.getData()[name[1]-
'a'];
177 std::vector<T> temp = var.getData();
178 temp[name[1]-
'a'] = value;
184 char s[3] = {base_code,
'a',
'\0'};
185 for (
size_t index = 0; index < size; index++, s[1]++)
187 map.insert(std::make_pair(s,
Variable(s, (
double)var.getData()[index])));
202 template <
class T =
double,
size_t size = 3>
208 return name[0] >=
'a' && name[0] <
'a' + char(size);
213 return var.getData()[name[0]-
'a'];
218 std::vector<T> temp = var.getData();
219 temp[name[0]-
'a'] = value;
226 for (
size_t index = 0; index < size; index++, s[0]++)
228 map.insert(std::make_pair(s,
Variable(s, (
double)var.getData()[index])));
240 template <
char code_x1,
char code_y1,
char code_x2 = '\0',
char code_y2 = '\0'>
246 static const char code_x[] = {code_x1, code_x2,
'\0'};
247 static const char code_y[] = {code_y1, code_y2,
'\0'};
248 return name == (std::string) code_x || name == (std::string) code_y;
253 static const char code_x[] = {code_x1, code_x2,
'\0'};
260 static const char code_x[] = {code_x1, code_x2,
'\0'};
261 (name == (std::string)code_x ? temp.
x : temp.
y) = value;
267 static const char s_x[] = {code_x1, code_x2,
'\0'};
268 static const char s_y[] = {code_y1, code_y2,
'\0'};
Object to group conversion functions for PTO format variables representing a std::vector variable in ...
PTOVariableConverterSingle<'T','p','y'> PTOVariableConverterForTranslationPlaneYaw
PTOVariableConverterSingle<'j'> PTOVariableConverterForStack
static double getValueFromVariable(const std::string &name, const ImageVariable< hugin_utils::FDiff2D > &var)
static void addToVariableMap(const ImageVariable< std::vector< T > > &var, VariableMap &map)
PTOVariableConverterNoOp PTOVariableConverterForExifBlueBalance
Object to group conversion functions for PTO format variables of up to three characters representing ...
PTOVariableConverterNoOp PTOVariableConverterForActive
PTOVariableConverterNoOp PTOVariableConverterForMasks
PTOVariableConverterVectorChar<'V', double, 4 > PTOVariableConverterForRadialVigCorrCoeff
An ImageVariable stores a value that can be linked to other ImageVariables of the same type...
static double getValueFromVariable(const std::string &name, const ImageVariable< T > &var)
PTOVariableConverterSingle<'E', 'e', 'v'> PTOVariableConverterForExposureValue
static bool checkApplicability(const std::string &name)
PTOVariableConverterNoOp PTOVariableConverterForAutoCenterCrop
PTOVariableConverterSingle<'E', 'b'> PTOVariableConverterForWhiteBalanceBlue
static void setValueFromVariable(const std::string &name, ImageVariable< std::vector< T > > &var, const double value)
static void addToVariableMap(const ImageVariable< std::vector< T > > &var, VariableMap &map)
PTOVariableConverterNoOp PTOVariableConverterForActiveMasks
a variable has a value and a name.
PTOVariableConverterNoOp PTOVariableConverterForExifOrientation
PTOVariableConverterNoOp PTOVariableConverterForExifLens
PTOVariableConverterSingle<'T','r','Z'> PTOVariableConverterForZ
static bool checkApplicability(const std::string &name)
Check if a given pto format variable name applies to this image variable.
PTOVariableConverterNoOp PTOVariableConverterForExifModel
static bool checkApplicability(const std::string &name)
PTOVariableConverterNoOp PTOVariableConverterForFileMetadata
PTOVariableConverterNoOp PTOVariableConverterForExifRedBalance
PTOVariableConverterFDiff2D<'V','V', 'x','y'> PTOVariableConverterForRadialVigCorrCenterShift
Parent class to anything that aids conversion between PTO file variables and the image variables of S...
PTOVariableConverterVector< double, 3 > PTOVariableConverterForRadialDistortion
PTOVariableConverterSingle<'r'> PTOVariableConverterForRoll
PTOVariableConverterNoOp PTOVariableConverterForProjection
void setData(const Type data)
Set the variable groups' value.
static void addToVariableMap(const ImageVariable< T > &var, VariableMap &map)
Add all PTO format variables specifed by an image variable in SrcPanoImg to a VariableMap.
PTOVariableConverterNoOp PTOVariableConverterForExifExposureTime
static bool checkApplicability(const std::string &name)
PTOVariableConverterNoOp PTOVariableConverterForFilename
PTOVariableConverterNoOp PTOVariableConverterForVigCorrMode
PTOVariableConverterNoOp PTOVariableConverterForCropMode
PTOVariableConverterNoOp PTOVariableConverterForRadialDistortionRed
static double getValueFromVariable(const std::string &name, const ImageVariable< T > &var)
Get a pto format variable's value, given its name and a reference to the variable in SrcPanoImg...
Type getData() const
get the variable's value
static void setValueFromVariable(const std::string &name, ImageVariable< T > &var, const double value)
Set a ImageVariable in SrcPanoImg given the pto format variable.
PTOVariableConverterNoOp PTOVariableConverterForFlatfieldFilename
PTOVariableConverterNoOp PTOVariableConverterForExifFocalLength
Object to group conversion functions for PTO format variables representing a std::vector variable in ...
PTOVariableConverterNoOp PTOVariableConverterForLensNr
PTOVariableConverterNoOp PTOVariableConverterForExifDate
static void addToVariableMap(const ImageVariable< T > &var, VariableMap &map)
static double getValueFromVariable(const std::string &name, const ImageVariable< std::vector< T > > &var)
static void setValueFromVariable(const std::string &name, ImageVariable< hugin_utils::FDiff2D > &var, const double value)
PTOVariableConverterNoOp PTOVariableConverterForExifExposureMode
PTOVariableConverterNoOp PTOVariableConverterForExifFocalLength35
PTOVariableConverterSingle<'E', 'r'> PTOVariableConverterForWhiteBalanceRed
PTOVariableConverterSingle<'T','r','X'> PTOVariableConverterForX
Object to group conversion functions for PTO format variables representing a hugin_utils::FDiff2D var...
PTOVariableConverterNoOp PTOVariableConverterForExifMake
std::map< std::string, Variable > VariableMap
PTOVariableConverterNoOp PTOVariableConverterForExifCropFactor
static void setValueFromVariable(const std::string &name, ImageVariable< std::vector< T > > &var, const double value)
PTOVariableConverterFDiff2D<'g', 't'> PTOVariableConverterForShear
PTOVariableConverterNoOp PTOVariableConverterForExifISO
PTOVariableConverterNoOp PTOVariableConverterForCropFactor
PTOVariableConverterNoOp PTOVariableConverterForRadialDistortionBlue
static double getValueFromVariable(const std::string &name, const ImageVariable< std::vector< T > > &var)
PTOVariableConverterNoOp PTOVariableConverterForGamma
PTOVariableConverterSingle<'v'> PTOVariableConverterForHFOV
static void addToVariableMap(const ImageVariable< hugin_utils::FDiff2D > &var, VariableMap &map)
PTOVariableConverterNoOp PTOVariableConverterForExifDistance
PTOVariableConverterNoOp PTOVariableConverterForResponseType
PTOVariableConverterSingle<'T','r','Y'> PTOVariableConverterForY
PTOVariableConverterFDiff2D<'d', 'e'> PTOVariableConverterForRadialDistortionCenterShift
PTOVariableConverterNoOp PTOVariableConverterForExifAperture
PTOVariableConverterVectorChar<'R', float, 5 > PTOVariableConverterForEMoRParams
PTOVariableConverterSingle<'T','p','p'> PTOVariableConverterForTranslationPlanePitch
static void setValueFromVariable(const std::string &name, ImageVariable< T > &var, const double value)
PTOVariableConverterNoOp PTOVariableConverterForSize
PTOVariableConverterSingle<'y'> PTOVariableConverterForYaw
PTOVariableConverterSingle<'p'> PTOVariableConverterForPitch
static bool checkApplicability(const std::string &name)
PTOVariableConverterNoOp PTOVariableConverterForCropRect