7#include "TrackingTable.h"
13#include "IException.h"
15#include "SpecialPixel.h"
17#include "TableField.h"
18#include "TableRecord.h"
40 for (
int i=0; i < table.Records(); i++) {
41 TableRecord record = table[i];
42 QString nameField = QString(record[
"FileName"]).split(
"/").last();
43 QString extension(FileName(nameField).extension());
44 int found = nameField.lastIndexOf(extension);
47 nameField.remove(QString::number(found + 3));
49 FileName fileName(nameField);
50 QString serialNumber = QString(record[
"SerialNumber"]);
51 m_fileList.append(QPair<FileName, QString>(fileName, serialNumber));
76 if (
m_fileList[i].first.name().length() > fieldLength) {
77 fieldLength =
m_fileList[i].first.name().length();
79 if (
m_fileList[i].second.length() > fieldLength) {
85 TableRecord dummyRecord;
86 TableField fileNameField(
"FileName", TableField::Text, fieldLength);
87 TableField serialNumberField(
"SerialNumber", TableField::Text, fieldLength);
88 TableField indexField(
"PixelValue", TableField::Integer);
89 dummyRecord += fileNameField;
90 dummyRecord += serialNumberField;
91 dummyRecord += indexField;
92 Table table(trackingTableName, dummyRecord);
99 indexField = (int) (i + VALID_MINUI4);
102 record += fileNameField;
103 record += serialNumberField;
104 record += indexField;
121 if (pixel < VALID_MINUI4) {
122 QString msg =
"Cannot convert pixel [" +
toString(pixel)
123 +
"] to a filename, pixel is below valid minimum ["
125 throw IException(IException::Programmer, msg, _FILEINFO_);
128 unsigned int index = pixel - VALID_MINUI4;
129 if (index >= (
unsigned int)
m_fileList.size()) {
130 QString msg =
"Cannot convert pixel [" +
toString(pixel)
131 +
"] to a filename, pixel is above valid maximum ["
133 throw IException(IException::Programmer, msg, _FILEINFO_);
152 if (QString::compare(
m_fileList[i].first.toString(), file.name()) == 0) {
153 return i + VALID_MINUI4;
159 m_fileList.append(QPair<FileName, QString>(file, serialNumber));
171 if (pixel < VALID_MINUI4) {
172 QString msg =
"Cannot convert pixel [" +
toString(pixel)
173 +
"] to a serial number, pixel is below valid minimum ["
175 throw IException(IException::Programmer, msg, _FILEINFO_);
178 unsigned int index = pixel - VALID_MINUI4;
179 if (index >= (
unsigned int)
m_fileList.size()) {
180 QString msg =
"Cannot convert pixel [" +
toString(pixel)
181 +
"] to a serial number, pixel is above valid maximum ["
183 throw IException(IException::Programmer, msg, _FILEINFO_);
209 m_fileList.append(QPair<FileName, QString>(file, serialNumber));
QString pixelToSN(unsigned int pixel)
Returns the serial number that corresponds to a pixel value.
Table toTable()
Constrcts and returns a Table object based on values in m_fileList.
FileName pixelToFileName(unsigned int pixel)
Returns the FileName that corresponds to a pixel value.
TrackingTable()
Default constructor.
~TrackingTable()
Destroys the TrackingTable object.
QList< QPair< FileName, QString > > m_fileList
The list to keep track of images.
int fileNameToIndex(FileName file, QString serialNumber)
Returns the index of the filename/serialnumber combination.
unsigned int fileNameToPixel(FileName file, QString serialNumber)
Returns the pixel value of the filename/serialnumber combination.
This is free and unencumbered software released into the public domain.
QString toString(const LinearAlgebra::Vector &vector, int precision)
A global function to format LinearAlgebra::Vector as a QString with the given precision.
Namespace for the standard library.