-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMightexMetaData.cpp
More file actions
81 lines (67 loc) · 2.92 KB
/
MightexMetaData.cpp
File metadata and controls
81 lines (67 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* File: MightexMetaData.cpp
* Author: Marc
*
* Created on October 27, 2010, 9:38 AM
*
* (C) Marc Gershow; licensed under the Creative Commons Attribution Share Alike 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
* Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#include <fstream>
#include <sstream>
#include <map>
#include "MightexMetaData.h"
using namespace std;
MightexMetaData::MightexMetaData() {
}
MightexMetaData::MightexMetaData(const MightexMetaData& orig) {
}
MightexMetaData::~MightexMetaData() {
}
MightexMetaData::MightexMetaData(const TProcessedDataProperty *attributes) {
this->attributes = *attributes;
}
void MightexMetaData::toDisk(std::ofstream& os) const{
uint32_t id = idCode();
os.write ((char *) &id, sizeof(id));
os.write((char *)&attributes, sizeof(attributes));
}
int32_t MightexMetaData::sizeOnDisk()const {
return (sizeof(attributes));
}
std::string MightexMetaData::saveDescription()const {
std::stringstream os;
os << "TProcessedDataProperty, a " << sizeof(attributes) << " byte data structure containing information about image aquisition from Mightex Camera engine.\n";
return os.str();
}
MightexMetaData *MightexMetaData::fromFile(std::ifstream& is) {
TProcessedDataProperty tpd;
is.read((char *) &tpd, sizeof(tpd));
return new MightexMetaData(&tpd);
}
std::map<std::string, double> MightexMetaData::getFieldNamesAndValues() const {
map<string, double> fnav;
fnav.insert(pair<string, double>("Mightex_Bin", attributes.Bin));
fnav.insert(pair<string, double>("Mightex_BlueGain", attributes.BlueGain));
fnav.insert(pair<string, double>("Mightex_CameraID", attributes.CameraID));
fnav.insert(pair<string, double>("Mightex_Column", attributes.Column));
fnav.insert(pair<string, double>("Mightex_ExposureTime", attributes.ExposureTime));
fnav.insert(pair<string, double>("Mightex_FilterAcceptForFile", attributes.FilterAcceptForFile));
fnav.insert(pair<string, double>("Mightex_ProcessFrameType", attributes.ProcessFrameType));
fnav.insert(pair<string, double>("Mightex_RedGain", attributes.RedGain));
fnav.insert(pair<string, double>("Mightex_Row", attributes.Row));
fnav.insert(pair<string, double>("Mightex_TimeStamp", attributes.TimeStamp));
fnav.insert(pair<string, double>("Mightex_TriggerEventCount", attributes.TriggerEventCount));
fnav.insert(pair<string, double>("Mightex_TriggerOccurred", attributes.TriggerOccurred));
fnav.insert(pair<string, double>("Mightex_XStart", attributes.XStart));
fnav.insert(pair<string, double>("Mightex_YStart", attributes.YStart));
return fnav;
}
TProcessedDataProperty MightexMetaData::getAttributes() const{
return attributes;
}
ImageMetaData *MightexMetaData::clone() const {
return new MightexMetaData(&(this->attributes));
}