23 catch(
const std::exception& e)
25 dbgout(
"Exception: " + std::string(e.what()) +
"\n");
35 catch(
const std::exception& e)
37 dbgout(
"Exception: " + std::string(e.what()) +
"\n");
53 return boundaryHit ? 1 : 0;
61 if (radialweights && (*radialweights)->
dimSize == radialSteps)
62 rw = (*radialweights)->elem;
64 *position = tracker->
ComputeQI(*position, iterations, radialSteps, angularStepsPerQ, 1, minRadius,maxRadius, boundaryHit, rw);
65 return boundaryHit ? 1 : 0;
110 bool boundaryHit=
false;
123 if (bestIndex) *bestIndex=maxPos;
126 *error = boundaryHit?1:0;
138 for (
int i=0;i<dst->numElem();i++)
139 dst->
elem[i] = src[i];
152 if (boundaryHit) *boundaryHit = bhit ? 1 : 0;
162 if (boundaryHit) *boundaryHit = bhit ? 1 : 0;
177 tracker->
SetRadialZLUT(zlut->
elem, planes, res, numLUTs, radii[0], radii[1],
true, useCorrelation);
179 tracker->
SetRadialWeights( ((*radialweights)->dimSize>0) ? (*radialweights)->elem : 0);
192 ImageData data((*img)->elem, (*img)->dimSizes[1],(*img)->dimSizes[0]);
195 catch(
const std::exception& e)
197 dbgout(
"Exception: " + std::string(e.what()) +
"\n");
202 float *LUTradii,
vector3f* position,
float pixel_max,
int useSplineInterp,
int samplesPerPixel)
204 ImageData img((*image)->elem, (*image)->dimSizes[1], (*image)->dimSizes[0]);
205 ImageData zlut((*lut)->elem, (*lut)->dimSizes[1], (*lut)->dimSizes[0]);
207 GenerateImageFromLUT(&img, &zlut, LUTradii[0], LUTradii[1], *position, useSplineInterp!=0, samplesPerPixel);
void GenerateTestImage(ImageData &img, float xp, float yp, float size, float SNratio)
void ComputeRadialProfile(float *dst, int radialSteps, int angularSteps, float minradius, float maxradius, vector2f center, bool crp, bool *boundaryHit=0, bool normalize=true)
Wrapper to compute a radial profile.
CDLL_EXPORT CPUTracker *DLL_CALLCONV create_tracker(uint w, uint h, uint xcorw)
float zlut_maxradius
Maximum radius in pixels of the ZLUT profile sampling circle.
void dbgout(const std::string &s)
CDLL_EXPORT void DLL_CALLCONV set_image_u8(CPUTracker *tracker, LVArray2D< uchar > **pData, ErrorCluster *error)
CDLL_EXPORT float DLL_CALLCONV compute_asymmetry(CPUTracker *tracker, LVArray< float > **result, int radialSteps, float *radii, float *center, uint *boundaryHit)
float zlut_minradius
Minimum radius in pixels to start sampling for a ZLUT profile.
int zlut_planes
Number of planes per ZLUT.
CDLL_EXPORT int DLL_CALLCONV compute_qi(CPUTracker *tracker, vector2f *position, int iterations, int radialSteps, int angularStepsPerQ, float minRadius, float maxRadius, LVArray< float > **radialweights)
Class with all CPU algorithm implementations.
int zlut_res
ZLUT resolution = number of radial steps in a plane.
CDLL_EXPORT void DLL_CALLCONV compute_com(CPUTracker *tracker, float *out)
CDLL_EXPORT int DLL_CALLCONV compute_xcor(CPUTracker *tracker, vector2f *position, int iterations, int profileWidth)
void GenerateImageFromLUT(ImageData *image, ImageData *zlut, float minradius, float maxradius, vector3f pos, bool splineInterp, int oversampleSubdiv)
void ResizeLVArray(LVArrayND< T, N > **&d, int *dims)
void normalize(TPixel *d, uint w, uint h)
float LUTProfileCompare(float *profile, int zlutIndex, float *cmpProf, LUTProfileMaxComputeMode maxPosMethod, float *fitcurve=0, int *maxPos=0, int frameNum=0)
Compare a profile to a LUT and calculate the optimum Z value for it.
void SetImage8Bit(uchar *srcImage, uint srcpitch)
Set an image with 8 bit type.
CDLL_EXPORT void DLL_CALLCONV get_ZLUT(CPUTracker *tracker, int zlutIndex, LVArray2D< float > **dst)
float * GetRadialZLUT(int index)
Get the start of the ZLUT of a specific bead.
vector2f ComputeMeanAndCOM(float bgcorrection=0.0f)
Calculate the center of mass of the image.
void ArgumentErrorMsg(ErrorCluster *e, const std::string &msg)
CDLL_EXPORT void DLL_CALLCONV set_ZLUT(CPUTracker *tracker, LVArray3D< float > **pZlut, float *radii, int angular_steps, bool useCorrelation, LVArray< float > **radialweights, bool normalize)
CDLL_EXPORT float DLL_CALLCONV compute_z(CPUTracker *tracker, float *center, int angularSteps, int zlut_index, uint *error, LVArray< float > **profile, int *bestIndex, LVArray< float > **errorCurve)
void ResizeLVArray2D(LVArray2D< T > **&d, int rows, int cols)
CDLL_EXPORT void DLL_CALLCONV set_image_u16(CPUTracker *tracker, LVArray2D< ushort > **pData, ErrorCluster *error)
vector2f ComputeXCorInterpolated(vector2f initial, int iterations, int profileWidth, bool &boundaryHit)
Compute the cross correlation offsets and resulting position.
int GetWidth()
Get the width of the image.
CDLL_EXPORT void DLL_CALLCONV set_image_float(CPUTracker *tracker, LVArray2D< float > **pData, ErrorCluster *error)
void SetRadialZLUT(float *data, int planes, int res, int num_zluts, float minradius, float maxradius, bool copyMemory, bool useCorrelation)
Tell the tracker where in memory the LUT is located.
#define ALLOCA_ARRAY(T, N)
void SetRadialWeights(float *radweights)
Set the radial weights to be used for profile comparisons.
Default. Use a 7-point quadratic fit around the error curve's maximum.
LabVIEW 3D Array template.
CDLL_EXPORT void DLL_CALLCONV compute_crp(CPUTracker *tracker, LVArray< float > **result, int radialSteps, float *radii, float *center, uint *boundaryHit, LVArray2D< float > **crpmap)
LabVIEW 2D Array template.
CDLL_EXPORT void DLL_CALLCONV set_image_from_memory(CPUTracker *tracker, LVArray2D< uchar > **pData, ErrorCluster *error)
CDLL_EXPORT void DLL_CALLCONV generate_test_image(LVArray2D< float > **img, float xp, float yp, float size, float photoncount)
int GetHeight()
Get the height of the image.
CDLL_EXPORT void DLL_CALLCONV destroy_tracker(CPUTracker *tracker)
float * GetDebugImage()
Get the debug image.
CDLL_EXPORT void DLL_CALLCONV get_debug_img_as_array(CPUTracker *tracker, LVArray2D< float > **pdbgImg)
vector2f ComputeQI(vector2f initial, int iterations, int radialSteps, int angularStepsPerQuadrant, float angStepIterationFactor, float minRadius, float maxRadius, bool &boundaryHit, float *radialweights=0)
Execute the quadrant interpolation algorithm.
CDLL_EXPORT void DLL_CALLCONV compute_radial_profile(CPUTracker *tracker, LVArray< float > **result, int angularSteps, float *radii, float *center, uint *boundaryHit)
float ComputeAsymmetry(vector2f center, int radialSteps, int angularSteps, float minRadius, float maxRadius, float *dstAngProf=0)
Find a measure for the asymmetry of the ROI.
void SetImageFloat(float *srcImage)
Set an image with float type.
void NormalizeZLUT(float *zlut, int numBeads, int planes, int radialsteps)
void ApplyPoissonNoise(ImageData &img, float poissonMax, float maxval)
CDLL_EXPORT void DLL_CALLCONV generate_image_from_lut(LVArray2D< float > **image, LVArray2D< float > **lut, float *LUTradii, vector3f *position, float pixel_max, int useSplineInterp, int samplesPerPixel)
void SetImage16Bit(ushort *srcImage, uint srcpitch)
Set an image with 16 bit type.