int measurements = CENTROID;
// Get the number of particles in the first frame
ResultsTable rt = new ResultsTable();
rt.reset();
ParticleAnalyzer pa = new ParticleAnalyzer(options, measurements, rt, minSize, maxSize);
pa.analyze(imp, stack.getProcessor(1));
nParticles = rt.getCounter();
if (nInitialCount == nParticles) {
// check to make sure that there are exactly nParticles entries
if (sxInitial != null && syInitial != null) {
String str = "Sorting order found:\n";
for (int i=0; i<nInitialCount; i++) {
str += ""+ (i+1) +"=("+ (int)sxInitial[i] +","+ (int)syInitial[i] +")\n";
}
IJ.showMessage("MultiTracker", str);
// reset the system measurements
srt.reset();
}
} else {
sxInitial = null;
syInitial = null;
}
// Create the column headings based on the number of particles
String strHeadings = "Frame";
for (int i=1; i<=nParticles; i++) {
strHeadings += "\tX" + i + "\tY" + i;
}
if (!headless) {
IJ.setColumnHeadings(strHeadings);
}
else {
results += strHeadings + "\n";
}
// create storage for particle positions
ssx = new float[nFrames][nParticles];
ssy = new float[nFrames][nParticles];
// now go through each frame and find the particle positions
float[] sxOld = new float [nParticles];
float[] syOld = new float [nParticles];
float[] sx = new float [nParticles];
float[] sy = new float [nParticles];
float[] sxSorted = new float [nParticles];
float[] sySorted = new float [nParticles];
for (int iFrame=1; iFrame<=nFrames; iFrame++) {
rt.reset();
pa = new ParticleAnalyzer(options, measurements, rt, minSize, maxSize);
pa.analyze(imp, stack.getProcessor(iFrame));
float[] sxRes = rt.getColumn(ResultsTable.X_CENTROID);
float[] syRes = rt.getColumn(ResultsTable.Y_CENTROID);
if (sxRes==null)
return;