Algorithm: "tracking2D_particleAnalV1.txt"
depending on the precious positions, seraching origin point is estimated. starting with the original ROI size (currently fixed to 13x13. optimized for the size of Gaspar's embryo), particle analysis function is applied. Objects touching the edge of the ROI is excluded for this searching. if the ROI perfectly contains the thresholded embryo, then the particle is recognized and the centroid is calculated.
A. analyze particel within ROI (exclude touching edge)
A-1 if there is one particle (nResults==1), then the centroid is recorded.
A-2 if there is no particle (nResults==0), then
A-2-1. Do "particle anazysis"without "exclude touchin edge"
test wether the object is there, but overlapping with the ROI edge.
A-2-1-1. if this analysis returns one particle, then the particle is overlapping with the ROI edge.
--> increase the ROI size by 1 pixel and go back to A.
A-2-1-2. if this analysis returns no particle
A-2-1-2-1. the threshold level is too high, the segmented object does not have a sufficient size.
-- test changing the threshold to a lower level, then do particle analysis. Iterate this until threshold==1
A-2-1-2-1-1. >1 particel found at a certain threshold.
--> reset the threshold to the discoverd lower value, and go back to A.
A-2-1-2-1-2. if there is no particle even for a threshold level ==1, then There is no particle.
--> revert the threshold to the original level, increase the ROI size by 1 pixel
and then
A-2-1-2-1-2-1. if the ROI size is still within the scan range, then the particle is outside the ROI.
--> increase the ROI size by an increment, go back to A.
A-2-1-2-1-2-2. the object went out of the frame (or too far away).
--> terminate the tracking, suggest consideirng a larger scan range for a possible high speed.
A-3 if there are multiple particles
-- test changing the threshold to a lower level, then do particle analysis. Iterate this until threshold==1
A-3-1 if single particle could be segmented (nResults==1and the area is not too big),
threshold is too low, so the single particle is segmented as multiple particles.
--> reset the threshold to the discoverd lower value, revert the ROI size to the minimum and go back to A.
A-3-2 if multiple particles (nResutls>1 or area too big),
--> there are actually several particles.
A-3-2-1 (if THIS action is not done previously)
shift the position of ROI to the extended direction of estimated movement,
revert the threshold level, revert the ROI to the minimum size and go back to A
A-3-2-2 if A-3-2-1 is done once already, its impossible to segment one single particle
-- Terminate the tracking. (suggest particles are crossing).
POSSIBLE solution. increase the threshold level, revert the ROI size and go back to A.
B Estimate the next pposition, and starting from that position in the next frame, go back to A