file=getTitle(); framescounter=11; //number of frames frequency=1; //frames frequency Type=1 setTool("polygon"); Dialog.create("Number of frames"); Dialog.create("Frames frequency in min") Dialog.create("Single Point (0) or Kinetics (1)") Dialog.addNumber("Number of frames: ", framescounter); Dialog.addNumber("Frames frequency in min: ", frequency); Dialog.addNumber("Single Point (0) or Kinetics (1)", Type); Dialog.show(); framescounter=Dialog.getNumber(); frequency=Dialog.getNumber(); Type=Dialog.getNumber(); if (Type==0) { run("Enhance Contrast", "auto"); //it makes easier to select the cell waitForUser('Please go to 1st frame, draw the cell area and press OK.'); run("Clear Results"); run("Set Measurements...", "area integrated limit redirect=None decimal=0"); run("Measure"); Total_first=getResult('IntDen'); // Total intensity at the first frame run("Clear Results"); waitForUser('Please go to the desired frame and press OK.'); run("Measure"); Total_final=getResult('IntDen'); //Total Intensity at the last frame run("Clear Results"); waitForUser('Please go to 1st frame, draw the PHOTOCONVERTED cell area and press OK.'); run("Measure"); Inside_first=getResult('IntDen'); //Intensity of the photoconverted area at the first frame Outside_first=Total_first-Inside_first; //to calculate the outside intensity (Outside= Total-Inside) run("Clear Results"); waitForUser('Please go to the desired frame and press OK.'); run("Measure"); Inside_final=getResult('IntDen'); //Intensity of the photoconverted area at the last frame Outside_final=Total_final-Inside_final; //to calculate the outside intensity run("Clear Results"); Motile_Fraction=(Outside_final-(Outside_first*(Total_final/Total_first)))/(Total_final-(Outside_first*(Total_final/Total_first))); // basically Motiliy= Outside last frame/ total last frame (there is a blackground correction in the equation) print ("DATA_OBTAINED_FROM_FILE:",file); print ("Outside_Initial_Intensity:", Outside_first ); print ("Outside_Final_Intensity:", Outside_final); print ("Total_Initial_Intensity:", Total_first); print ("Total_Final_Intensity:", Total_final); print ("Motile_Intensity:", Motile_Fraction); } else { run("Enhance Contrast", "auto"); //it makes easier to select the cell waitForUser('Please go to 1st frame, draw the cell area and press OK.'); run("Clear Results"); run("Auto Threshold", "method=IsoData white stack"); run("Set Measurements...", "area integrated limit redirect=None decimal=0"); Total= newArray(framescounter+1); for (i=1;i<=framescounter;i++) { run("Measure"); Total[i]=getResult('IntDen'); run("Clear Results"); run("Next Slice [>]"); } for (i=1;i<=framescounter;i++) { run("Previous Slice [<]"); } waitForUser('Make sure to be in the 1st frame, draw the PHOTOCONVERTED cell area and press OK.'); newArray(framescounter); Inside= newArray(framescounter+1); Outside= newArray(framescounter+1); for (i=1;i<=framescounter;i++) { run("Measure"); Inside[i]=getResult('IntDen'); //Intensity of the photoconverted area at the first frame Outside[i]=Total[i]-Inside[i]; //to calculate the outside intensity (Outside= Total-Inside) run("Clear Results"); run("Next Slice [>]"); } print ("Motile_Fraction_OBTAINED_FROM_FILE:",file); i=1; Total1=Total[i]; Outside1=Outside[i]; print("Time_in_min, Motile_Fraction"); Motile_Fraction= newArray(framescounter+1); for (i=1; i<=framescounter;i++) { Motile_Fraction[i]=(Outside[i]-Outside1*(Total[i]/Total1))/(Total[i]-Outside1*(Total[i]/Total1)); Framefrequency= frequency * (i) - frequency; print(Motile_Fraction[i]); } }