QTrk
Functions

ZLUT API functions available to LabVIEW. More...

Functions

CDLL_EXPORT void DLL_CALLCONV qtrk_set_ZLUT (QueuedTracker *tracker, LVArray3D< float > **pZlut, LVArray< float > **zcmpWindow, int normalize, ErrorCluster *e)
 
CDLL_EXPORT void DLL_CALLCONV qtrk_get_ZLUT (QueuedTracker *tracker, LVArray3D< float > **pzlut, ErrorCluster *e)
 
CDLL_EXPORT void DLL_CALLCONV qtrk_set_image_lut (QueuedTracker *qtrk, LVArrayND< float, 4 > **imageLUT, LVArray3D< float > **radialZLUT, ErrorCluster *e)
 
CDLL_EXPORT void DLL_CALLCONV qtrk_get_image_lut (QueuedTracker *qtrk, LVArrayND< float, 4 > **imageLUT, ErrorCluster *e)
 
CDLL_EXPORT void qtrk_build_lut_plane (QueuedTracker *qtrk, LVArray3D< float > **data, uint flags, int plane, ErrorCluster *err)
 
CDLL_EXPORT void qtrk_finalize_lut (QueuedTracker *qtrk, ErrorCluster *e)
 

Detailed Description

ZLUT API functions available to LabVIEW.

Function Documentation

§ qtrk_build_lut_plane()

CDLL_EXPORT void qtrk_build_lut_plane ( QueuedTracker qtrk,
LVArray3D< float > **  data,
uint  flags,
int  plane,
ErrorCluster err 
)

Definition at line 355 of file lv_queuetrk_api.cpp.

356 {
357  if (ValidateTracker(qtrk, err, "build_lut_plane")) {
358  if ((*data)->dimSizes[2] != qtrk->cfg.width || (*data)->dimSizes[1] != qtrk->cfg.height) {
359  ArgumentErrorMsg(err, SPrintf("Invalid size: %dx%d. Expecting %dx%d\n", (*data)->dimSizes[2], (*data)->dimSizes[1], qtrk->cfg.width, qtrk->cfg.height));
360  return;
361  }
362 
363  int cnt,planes,rsteps;
364  qtrk->GetRadialZLUTSize(cnt, planes, rsteps);
365 
366  if ((*data)->dimSizes[0] != cnt) {
367  ArgumentErrorMsg(err, SPrintf("Invalid number of images given (%d). Expecting %d", (*data)->dimSizes[0], cnt));
368  return;
369  }
370 
371  qtrk->BuildLUT( (*data)->elem, sizeof(float*) * qtrk->cfg.width, QTrkFloat, plane);
372  }
373 }
virtual void BuildLUT(void *data, int pitch, QTRK_PixelDataType pdt, int plane, vector2f *known_pos=0)=0
Add a new lookup table plane.
virtual void GetRadialZLUTSize(int &count, int &planes, int &radialsteps)=0
Get the dimensions of the radial lookup table data.
64 bit float
Definition: qtrk_c_api.h:37
int width
Width of regions of interest to be handled. Typically equals height (square ROI). ...
Definition: qtrk_c_api.h:106
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
int height
Height of regions of interest to be handled. Typically equals width (square ROI). ...
Definition: qtrk_c_api.h:107
void ArgumentErrorMsg(ErrorCluster *e, const std::string &msg)
QTrkComputedConfig cfg
The settings used by this instance of QueuedTracker.
std::string SPrintf(const char *fmt,...)
Definition: utils.cpp:132

§ qtrk_finalize_lut()

CDLL_EXPORT void qtrk_finalize_lut ( QueuedTracker qtrk,
ErrorCluster e 
)

Definition at line 375 of file lv_queuetrk_api.cpp.

376 {
377  if (ValidateTracker(qtrk, e, "finalize_lut"))
378  qtrk->FinalizeLUT();
379 }
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
virtual void FinalizeLUT()=0
Finalize the lookup tables in memory.

§ qtrk_get_image_lut()

CDLL_EXPORT void DLL_CALLCONV qtrk_get_image_lut ( QueuedTracker qtrk,
LVArrayND< float, 4 > **  imageLUT,
ErrorCluster e 
)

Definition at line 152 of file lv_queuetrk_api.cpp.

153 {
154  if (ValidateTracker(qtrk, e, "get_image_lut")) {
155 
156  int dims[4];
157  qtrk->GetImageZLUTSize(dims);
158  ResizeLVArray(imageLUT, dims);
159 
160  if ( (*imageLUT)->numElem () > 0 ){
161  qtrk->GetImageZLUT( (*imageLUT)->elem );
162  }
163  }
164 }
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
void ResizeLVArray(LVArrayND< T, N > **&d, int *dims)
Definition: labview.h:118
virtual void GetImageZLUTSize(int *dims)
Get the dimensions of the image lookup table data.
virtual void GetImageZLUT(float *dst)
Get the image lookup tables used.

§ qtrk_get_ZLUT()

CDLL_EXPORT void DLL_CALLCONV qtrk_get_ZLUT ( QueuedTracker tracker,
LVArray3D< float > **  pzlut,
ErrorCluster e 
)

Definition at line 139 of file lv_queuetrk_api.cpp.

140 {
141  if (ValidateTracker(tracker, e, "get ZLUT")) {
142  int dims[3];
143 
144  tracker->GetRadialZLUTSize(dims[0], dims[1], dims[2]);
145  if(dims[0]*dims[1]*dims[2]>0) {
146  ResizeLVArray3D(pzlut, dims[0], dims[1], dims[2]);
147  tracker->GetRadialZLUT( (*pzlut)->elem );
148  }
149  }
150 }
virtual void GetRadialZLUTSize(int &count, int &planes, int &radialsteps)=0
Get the dimensions of the radial lookup table data.
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
virtual void GetRadialZLUT(float *dst)=0
Get the radial lookup tables used for z tracking.
void ResizeLVArray3D(LVArray3D< T > **&d, int depth, int rows, int cols)
Definition: labview.h:107

§ qtrk_set_image_lut()

CDLL_EXPORT void DLL_CALLCONV qtrk_set_image_lut ( QueuedTracker qtrk,
LVArrayND< float, 4 > **  imageLUT,
LVArray3D< float > **  radialZLUT,
ErrorCluster e 
)

Definition at line 166 of file lv_queuetrk_api.cpp.

167 {
168  if (ValidateTracker(qtrk, e, "set_image_lut")) {
169  if ( (*imageLUT)->numElem () == 0 ){
170  qtrk->SetImageZLUT (0, 0, 0);
171  }
172  else {
173  qtrk->SetImageZLUT( (*imageLUT)->elem, (*radialZLUT)->elem, (*imageLUT)->dimSizes );
174  }
175  }
176 }
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
virtual bool SetImageZLUT(float *src, float *radial_zlut, int *dims)
Set the image lookup tables to be used for z tracking.

§ qtrk_set_ZLUT()

CDLL_EXPORT void DLL_CALLCONV qtrk_set_ZLUT ( QueuedTracker tracker,
LVArray3D< float > **  pZlut,
LVArray< float > **  zcmpWindow,
int  normalize,
ErrorCluster e 
)

Definition at line 101 of file lv_queuetrk_api.cpp.

102 {
103  LVArray3D<float>* zlut = *pZlut;
104 
105  if (ValidateTracker(tracker,e, "set ZLUT")) {
106 
107  int numLUTs = zlut->dimSizes[0];
108  int planes = zlut->dimSizes[1];
109  int res = zlut->dimSizes[2];
110 
111  dbgprintf("Setting ZLUT size: %d beads, %d planes, %d radialsteps\n", numLUTs, planes, res);
112 
113  float* zcmp = 0;
114  if (zcmpWindow && (*zcmpWindow)->dimSize > 0) {
115  if ( (*zcmpWindow)->dimSize != res)
116  ArgumentErrorMsg(e, SPrintf("Z Compare window should have the same resolution as the ZLUT (%d elements)", res));
117  else
118  zcmp = (*zcmpWindow)->elem;
119  }
120 
121  if (numLUTs * planes * res == 0) {
122  tracker->SetRadialZLUT(0, 0, 0);
123  } else {
124  if (res != tracker->cfg.zlut_radialsteps)
125  ArgumentErrorMsg(e, SPrintf("set_ZLUT: 3rd dimension should have size of zlut_radialsteps (%d instead of %d)", tracker->cfg.zlut_radialsteps, res));
126  else {
127 
128  if (normalize) {
129  NormalizeZLUT( zlut->elem, numLUTs, planes, res );
130  }
131 
132  tracker->SetRadialZLUT(zlut->elem, numLUTs, planes);
133  tracker->SetRadialWeights(zcmp);
134  }
135  }
136  }
137 }
T elem[1]
Definition: labview.h:59
int32_t dimSizes[3]
Definition: labview.h:58
int32_t dimSize
Definition: labview.h:34
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
void normalize(TPixel *d, uint w, uint h)
Definition: utils.h:27
int zlut_radialsteps
Number of radial steps to sample on.
Definition: qtrk_c_api.h:198
virtual void SetRadialZLUT(float *data, int count, int planes)=0
Set the radial lookup tables to be used for z tracking.
void ArgumentErrorMsg(ErrorCluster *e, const std::string &msg)
QTrkComputedConfig cfg
The settings used by this instance of QueuedTracker.
LabVIEW 3D Array template.
Definition: labview.h:57
void dbgprintf(const char *fmt,...)
Definition: utils.cpp:149
virtual void SetRadialWeights(float *zcmp)=0
Set radial weights used for comparing LUT profiles.
std::string SPrintf(const char *fmt,...)
Definition: utils.cpp:132
void NormalizeZLUT(float *zlut, int numBeads, int planes, int radialsteps)
Definition: utils.cpp:291