QTrk
Functions

General API functions available to LabVIEW. More...

Functions

CDLL_EXPORT QueuedTracker *DLL_CALLCONV qtrk_create (QTrkSettings *settings, LStrHandle warnings, ErrorCluster *e)
 
CDLL_EXPORT void DLL_CALLCONV qtrk_destroy (QueuedTracker *qtrk, ErrorCluster *error)
 
CDLL_EXPORT void DLL_CALLCONV qtrk_free_all ()
 
CDLL_EXPORT void qtrk_set_localization_mode (QueuedTracker *qtrk, uint locType, ErrorCluster *e)
 
CDLL_EXPORT void qtrk_find_beads (uint8_t *image, int pitch, int w, int h, int *smpCornerPos, int roi, float imgRelDist, float acceptance, LVArray2D< uint32_t > **output)
 

Detailed Description

General API functions available to LabVIEW.

Function Documentation

§ qtrk_create()

CDLL_EXPORT QueuedTracker* DLL_CALLCONV qtrk_create ( QTrkSettings settings,
LStrHandle  warnings,
ErrorCluster e 
)

Definition at line 221 of file lv_queuetrk_api.cpp.

222 {
223  QueuedTracker* tracker = 0;
224  try {
225  QTrkComputedConfig cc(*settings);
226  cc.WriteToLog();
227 
228  tracker = CreateQueuedTracker(cc);
229 
230  std::string w = tracker->GetWarnings();
231  if (!w.empty()) SetLVString(warnings, w.c_str());
232 
234  trackerList.push_back(tracker);
236  } catch(const std::runtime_error &exc) {
237  FillErrorCluster(kAppErrorBase, exc.what(), e );
238  }
239  return tracker;
240 }
static Threads::Mutex trackerListMutex
void lock()
Definition: threads.h:74
QueuedTracker * CreateQueuedTracker(const QTrkComputedConfig &cc)
Helper function to create a QueuedTracker instance.
void SetLVString(LStrHandle str, const char *text)
virtual std::string GetWarnings()
Get a report of encountered errors.
Structure for derived settings computed from base settings in QTrkSettings.
Definition: qtrk_c_api.h:189
static std::vector< QueuedTracker * > trackerList
void unlock()
Definition: threads.h:79
Abstract tracker interface, implemented by QueuedCUDATracker and QueuedCPUTracker.
Definition: QueuedTracker.h:86
MgErr FillErrorCluster(MgErr err, const char *message, ErrorCluster *error)

§ qtrk_destroy()

CDLL_EXPORT void DLL_CALLCONV qtrk_destroy ( QueuedTracker qtrk,
ErrorCluster error 
)

Definition at line 242 of file lv_queuetrk_api.cpp.

243 {
245 
246  auto pos = std::find(trackerList.begin(),trackerList.end(),qtrk);
247  if (pos == trackerList.end()) {
248  ArgumentErrorMsg(error, SPrintf( "Trying to call qtrk_destroy with invalid qtrk pointer %p", qtrk));
249  qtrk = 0;
250  }
251  else
252  trackerList.erase(pos);
253 
255 
256  if(qtrk) delete qtrk;
257 }
static Threads::Mutex trackerListMutex
void lock()
Definition: threads.h:74
void ArgumentErrorMsg(ErrorCluster *e, const std::string &msg)
static std::vector< QueuedTracker * > trackerList
void unlock()
Definition: threads.h:79
std::string SPrintf(const char *fmt,...)
Definition: utils.cpp:132

§ qtrk_find_beads()

CDLL_EXPORT void qtrk_find_beads ( uint8_t *  image,
int  pitch,
int  w,
int  h,
int *  smpCornerPos,
int  roi,
float  imgRelDist,
float  acceptance,
LVArray2D< uint32_t > **  output 
)

Definition at line 542 of file lv_queuetrk_api.cpp.

543 {
544  BeadFinder::Config cfg;
545  cfg.img_distance = imgRelDist;
546  cfg.roi = roi;
547  cfg.similarity = acceptance;
548  auto results = BeadFinder::Find(image, pitch, w,h, smpCornerPos[0], smpCornerPos[1], &cfg);
549 
550  ResizeLVArray2D(output, results.size(), 2);
551  for (uint i=0;i<results.size();i++)
552  {
553  (*output)->get(i, 0) = results[i].x;
554  (*output)->get(i, 1) = results[i].y;
555  }
556 }
unsigned int uint
Definition: std_incl.h:127
std::vector< Position > Find(ImageData *img, float *sample, Config *cfg)
Definition: BeadFinder.cpp:168
void ResizeLVArray2D(LVArray2D< T > **&d, int rows, int cols)
Definition: labview.h:98

§ qtrk_free_all()

CDLL_EXPORT void DLL_CALLCONV qtrk_free_all ( )

Definition at line 20 of file lv_queuetrk_api.cpp.

21 {
25 }
static Threads::Mutex trackerListMutex
void lock()
Definition: threads.h:74
void DeleteAllElems(T &c)
Definition: utils.h:19
static std::vector< QueuedTracker * > trackerList
void unlock()
Definition: threads.h:79

§ qtrk_set_localization_mode()

CDLL_EXPORT void qtrk_set_localization_mode ( QueuedTracker qtrk,
uint  locType,
ErrorCluster e 
)

Definition at line 437 of file lv_queuetrk_api.cpp.

438 {
439  if (ValidateTracker(qtrk, e, "set_localization_mode")) {
440  qtrk->SetLocalizationMode( (LocMode_t)locType );
441  }
442 }
bool ValidateTracker(QueuedTracker *tracker, ErrorCluster *e, const char *funcname)
Verify the referenced tracker is a valid QueuedTracker instance.
virtual void SetLocalizationMode(LocMode_t locType)=0
Select which algorithm is to be used.
int LocMode_t
Definition: qtrk_c_api.h:30