Posted by
chris elliott on
Nov 25, 2009; 8:55am
URL: http://imagej.273.s1.nabble.com/MTrack2-plugin-bug-fix-tp3690333.html
If a sequence of images contains one with no particles, MTrack2 returns
early and does not write a results file, path plot or other data. The
attached patch fixes it
chris
--- MTrack2_orig.java 2009-11-19 14:18:02.875000000 +0000
+++ MTrack2_.java 2009-11-19 12:28:47.390625000 +0000
@@ -1,3 +1,5 @@
+
+
import ij.plugin.filter.PlugInFilter;
import java.awt.Color;
import java.util.*;
@@ -12,7 +14,7 @@
import ij.measure.*;
-/**
+/** Modified Chris Elliott (
[hidden email]) Nov 2009
Uses ImageJ's particle analyzer to track the movement of
multiple objects through a stack.
Based on the Object Tracker plugin filter by Wayne Rasband
@@ -155,9 +157,8 @@
pa.analyze(imp, stack.getProcessor(iFrame));
float[] sxRes = rt.getColumn(ResultsTable.X_CENTROID);
float[] syRes = rt.getColumn(ResultsTable.Y_CENTROID);
- if (sxRes==null)
- return;
-
+ if (sxRes!=null)
+ {
for (int iPart=0; iPart<sxRes.length; iPart++) {
particle aParticle = new particle();
aParticle.x=sxRes[iPart];
@@ -165,8 +166,10 @@
aParticle.z=iFrame-1;
theParticles[iFrame-1].add(aParticle);
}
+
IJ.showProgress((double)iFrame/nFrames);
}
+ }
// now assemble tracks out of the particle lists
// Also record to which track a particle belongs in ArrayLists