|
On 7 May 2007, at 16:44, 张伟 wrote:
> Hello,
>
> I want to track a moving particle and simultaneously the intensity
> change of
> the particle. Can any plugin of ImageJ automatically give the
> intensity v
> time plot of a moving particle?
Hi,
You might try to configure the following macro for your
purposes.
It was originally intended for following the brightness of a
star that got occulted for a few seconds.
Michael
________________________________________________________________
//Brightness measurement of background and single particle
//in a stack, tracking the particle.
//If the particle becomes too weak (maximum < mean plus 5
//standard deviations of the image) the position remains
//unchanged until the particle reappears.
//
radius=10; //integration radius
oldx=getWidth()/2; //initial position
oldy=getWidth()/2;
meanbright=newArray(nSlices);
integral=newArray(nSlices);
run("Set Measurements...", "area mean centroid redirect=None
decimal=6");
for (slice=0;slice<nSlices;slice++) {
setSlice(slice+1);
run("Select None");
getStatistics(area, mean, min, max, std);
meanbright[slice]=mean;
if ((max-mean)/std>5) {
setThreshold(max-2, 255);
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing display clear include slice");
//find the best maximum
badness=999999999; // the further away the maximum from the old
site, the worse.
for (i=0; i<nResults; i++) {
thisx=getResult("X", i);
thisy=getResult("Y", i);
area=getResult("Area",i);
thisbad=((thisx-oldx)^2+(thisy-oldy)^2)/(2+area);
if (thisbad < badness) {
x=thisx; y=thisy;
badness=thisbad;
}
}
} else { //keep position if no maximum above noise
x=oldx;
y=oldy;
}
oldx=x;
oldy=y;
makeOval(x-radius, y-radius, 2*radius, 2*radius);
resetThreshold;
run("Measure");
integral[slice]=getResult("Area")*(getResult("Mean")-meanbright[slice]);
}
for (slice=0;slice<nSlices;slice++) {
write(meanbright[slice]+" "+integral[slice]);
}
|