-
Notifications
You must be signed in to change notification settings - Fork 2
/
BatchSimpleCaTrace.txt
49 lines (40 loc) · 1.23 KB
/
BatchSimpleCaTrace.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//This macro takes an image, sets it up as a time series and plots the intensities
//Useful for calcium imaging
// Adapted with Greg on 14 March 2011
// This next bit Aaron has been working on starting on 14 March 2011
requires("1.42k");
file = getArgument;
arg = split(file,","); //useful if I want to start having multiple arguements
open(arg[0]);
current=getTitle();
//print(current); //error checking
current=substring(current,0,lengthOf(current)-4);
// print(current); //error checking
//adapted from http://rsb.info.nih.gov/ij/macros/examples/PlotGetValuesDemo.txt
if (arg.length==4){
outfile=arg[1] +current+ "_roi-" +arg[3]+ ".csv";
} else{
outfile=arg[1] +current+ "_roi-none.csv";
}
if(File.exists(outfile)) exit("File exists");
if (arg.length==4){
// cribbed from http://imagej.nih.gov/ij/macros/ROI_Manager_Stack_Demo.txt
if (isOpen("ROI Manager")) {
selectWindow("ROI Manager");
run("Close");
}
roiManager("Open", arg[2]);
roiManager("Select", parseInt(arg[3]));
}
run("Plot Z-axis Profile");
f=File.open(outfile);
print(f, "Time, F");
Plot.getValues(x, y);
for (i=0; i<x.length; i++)
print(f, x[i]+","+y[i]);
File.close(f);
//keeping things clean
run("Close");
run("Close");
run("Close");
// run("Close");