QTrk
Functions
Result Manager

Result manager (RM) API functions available to LabVIEW. More...

Functions

CDLL_EXPORT void DLL_CALLCONV rm_destroy_all ()
 
CDLL_EXPORT ResultManager *DLL_CALLCONV rm_create (const char *file, const char *frameinfo, ResultManagerConfig *cfg, LStrHandle *names)
 
CDLL_EXPORT void DLL_CALLCONV rm_set_tracker (ResultManager *rm, QueuedTracker *qtrk, ErrorCluster *err)
 
CDLL_EXPORT void DLL_CALLCONV rm_destroy (ResultManager *rm, ErrorCluster *err)
 
CDLL_EXPORT void DLL_CALLCONV rm_store_frame_info (ResultManager *rm, int frame, double timestamp, float *cols, ErrorCluster *err)
 
CDLL_EXPORT int DLL_CALLCONV rm_getbeadresults (ResultManager *rm, int start, int numFrames, int bead, LocalizationResult *results, ErrorCluster *err)
 
CDLL_EXPORT void DLL_CALLCONV rm_getframecounters (ResultManager *rm, int *startFrame, int *lastSaveFrame, int *endFrame, int *capturedFrames, int *localizationsDone, int *lostFrames, ErrorCluster *err)
 
CDLL_EXPORT void DLL_CALLCONV rm_flush (ResultManager *rm, ErrorCluster *err)
 
CDLL_EXPORT int DLL_CALLCONV rm_getresults (ResultManager *rm, int startFrame, int numFrames, LocalizationResult *results, ErrorCluster *err)
 
CDLL_EXPORT void DLL_CALLCONV rm_removebead (ResultManager *rm, int bead, ErrorCluster *err)
 
CDLL_EXPORT void DLL_CALLCONV rm_getconfig (ResultManager *rm, ResultManagerConfig *cfg, ErrorCluster *err)
 

Detailed Description

Result manager (RM) API functions available to LabVIEW.

Function Documentation

§ rm_create()

CDLL_EXPORT ResultManager* DLL_CALLCONV rm_create ( const char *  file,
const char *  frameinfo,
ResultManagerConfig cfg,
LStrHandle *  names 
)

Definition at line 39 of file lv_resultmanager_api.cpp.

40 {
41  std::vector<std::string> colNames;
42 
43  if (names) colNames = LVGetStringArray(cfg->numFrameInfoColumns, names);
44  ResultManager* rm = new ResultManager(file, frameinfo, cfg, colNames);
45 
46  rm_instances.insert(rm);
47  return rm;
48 }
Class that handles data gathering and saving from QueuedTracker instances.
Definition: ResultManager.h:91
int numFrameInfoColumns
Number of columns in the frame info metadata file. Additional columns can be added to save more data ...
Definition: ResultManager.h:65
std::vector< std::string > LVGetStringArray(int count, LStrHandle *str)
static std::unordered_set< ResultManager * > rm_instances

§ rm_destroy()

CDLL_EXPORT void DLL_CALLCONV rm_destroy ( ResultManager rm,
ErrorCluster err 
)

Definition at line 57 of file lv_resultmanager_api.cpp.

58 {
59  if (ValidRM(rm, err)) {
60  rm_instances.erase(rm);
61  delete rm;
62  }
63 }
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
static std::unordered_set< ResultManager * > rm_instances

§ rm_destroy_all()

CDLL_EXPORT void DLL_CALLCONV rm_destroy_all ( )

Definition at line 34 of file lv_resultmanager_api.cpp.

35 {
37 }
void DeleteAllElems(T &c)
Definition: utils.h:19
static std::unordered_set< ResultManager * > rm_instances

§ rm_flush()

CDLL_EXPORT void DLL_CALLCONV rm_flush ( ResultManager rm,
ErrorCluster err 
)

Definition at line 104 of file lv_resultmanager_api.cpp.

105 {
106  if (ValidRM(rm, err)) {
107  rm->Flush();
108  }
109 }
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
void Flush()
Write all available data regardless of ResultManagerConfig::writeInterval.

§ rm_getbeadresults()

CDLL_EXPORT int DLL_CALLCONV rm_getbeadresults ( ResultManager rm,
int  start,
int  numFrames,
int  bead,
LocalizationResult results,
ErrorCluster err 
)

Definition at line 75 of file lv_resultmanager_api.cpp.

76 {
77  if (ValidRM(rm, err)) {
78  if (bead < 0 || bead >= rm->Config().numBeads)
79  ArgumentErrorMsg(err,SPrintf( "Invalid bead index: %d. Accepted range: [0-%d]", bead, rm->Config().numBeads));
80  else
81  return rm->GetBeadPositions(start,start+numFrames,bead,results);
82  }
83  return 0;
84 }
const ResultManagerConfig & Config()
Returns a reference to the used configuration to review.
int numBeads
Number of beads for which to grab results. Should always equal the amount of beads in a single frame...
Definition: ResultManager.h:64
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
void ArgumentErrorMsg(ErrorCluster *e, const std::string &msg)
int GetBeadPositions(int startFrame, int endFrame, int bead, LocalizationResult *r)
Get the positions of a single bead over an interval of frames.
std::string SPrintf(const char *fmt,...)
Definition: utils.cpp:132

§ rm_getconfig()

CDLL_EXPORT void DLL_CALLCONV rm_getconfig ( ResultManager rm,
ResultManagerConfig cfg,
ErrorCluster err 
)

Definition at line 132 of file lv_resultmanager_api.cpp.

133 {
134  if (ValidRM(rm, err)) {
135  *cfg = rm->Config();
136  }
137 }
const ResultManagerConfig & Config()
Returns a reference to the used configuration to review.
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.

§ rm_getframecounters()

CDLL_EXPORT void DLL_CALLCONV rm_getframecounters ( ResultManager rm,
int *  startFrame,
int *  lastSaveFrame,
int *  endFrame,
int *  capturedFrames,
int *  localizationsDone,
int *  lostFrames,
ErrorCluster err 
)

Definition at line 87 of file lv_resultmanager_api.cpp.

89 {
90  if (ValidRM(rm, err)) {
91 
92  auto r = rm->GetFrameCounters();
93 
94  if (startFrame) *startFrame = r.startFrame;
95  if (lastSaveFrame) *lastSaveFrame = r.lastSaveFrame;
96  if (endFrame) * endFrame = r.processedFrames;
97  if (capturedFrames) *capturedFrames = r.capturedFrames;
98  if (localizationsDone) *localizationsDone = r.localizationsDone;
99  if (lostFrames) *lostFrames = r.lostFrames;
100  }
101 }
int startFrame
Index of the first frame for which results are available.
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
FrameCounters GetFrameCounters()
Returns a FrameCounters structure with the current counts.

§ rm_getresults()

CDLL_EXPORT int DLL_CALLCONV rm_getresults ( ResultManager rm,
int  startFrame,
int  numFrames,
LocalizationResult results,
ErrorCluster err 
)

Definition at line 111 of file lv_resultmanager_api.cpp.

112 {
113  if (ValidRM(rm,err)) {
114  return rm->GetResults(results, startFrame, numFrames);
115  }
116  return 0;
117 }
int GetResults(LocalizationResult *results, int startFrame, int numResults)
Get the positions of all beads over an interval of frames.
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.

§ rm_removebead()

CDLL_EXPORT void DLL_CALLCONV rm_removebead ( ResultManager rm,
int  bead,
ErrorCluster err 
)

Definition at line 119 of file lv_resultmanager_api.cpp.

120 {
121  if (ValidRM(rm, err)) {
122  if (rm->GetTracker()) {
123  ArgumentErrorMsg(err, "Cannot discard bead results while tracking in progress");
124  }
125 
126  rm->RemoveBeadResults(bead);
127  }
128 }
bool RemoveBeadResults(int bead)
Remove all results of a certain bead.
QueuedTracker * GetTracker()
Get the tracker from which results are fetched.
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
void ArgumentErrorMsg(ErrorCluster *e, const std::string &msg)

§ rm_set_tracker()

CDLL_EXPORT void DLL_CALLCONV rm_set_tracker ( ResultManager rm,
QueuedTracker qtrk,
ErrorCluster err 
)

Definition at line 50 of file lv_resultmanager_api.cpp.

51 {
52  if (ValidRM(rm, err)) {
53  rm->SetTracker(qtrk);
54  }
55 }
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
void SetTracker(QueuedTracker *qtrk)
Set the tracker from which to fetch results.

§ rm_store_frame_info()

CDLL_EXPORT void DLL_CALLCONV rm_store_frame_info ( ResultManager rm,
int  frame,
double  timestamp,
float *  cols,
ErrorCluster err 
)

Definition at line 65 of file lv_resultmanager_api.cpp.

66 {
67  if (ValidRM(rm, err)) {
68 #ifdef _DEBUG
69  dbgprintf("rm_store_frame_info: frame=%d, ts=%f\n", frame,timestamp);
70 #endif
71  rm->StoreFrameInfo(frame, timestamp, cols);
72  }
73 }
void StoreFrameInfo(int frame, double timestamp, float *columns)
Store metadata for a frame. This data will be saved in the info file.
static bool ValidRM(ResultManager *rm, ErrorCluster *err)
Verify the referenced resultmanager is a valid ResultManager instance.
void dbgprintf(const char *fmt,...)
Definition: utils.cpp:149