-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzprojconcat.ijm
52 lines (38 loc) · 1.46 KB
/
zprojconcat.ijm
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
50
51
52
//====================================================================
//====================================================================
//Maximal-intensity Z-project each time point and combine the projected images into a time stack
//Lin Yangchen
//Centre for Bioimaging Sciences, National University of Singapore
//8 December 2023
//====================================================================
//====================================================================
//prompts you to select the folder containing the images
dir = getDirectory("choose folder");
//replace backslashes with forward slashes (if using Windows)
dir = replace(dir, "\\", "/");
setBatchMode(true); //do not display images during execution
//get the list of files in the folder
filelist = getFileList(dir);
//open each file and Z-project it
count = 1;
for (i = 0; i < filelist.length; i++)
{
print("processing " + filelist[i] + " (" + count + " of " + filelist.length + ")");
//open the file
run("Bio-Formats Windowless Importer", "open=" + dir + filelist[i]);
newname = "stack" + count;
rename(newname);
run("Z Project...", "projection=[Max Intensity]");
//close original image
selectImage(newname);
close();
//free up memory
run("Collect Garbage");
count = count + 1;
}
//combine images into time series
print("combining images into time series");
run("Concatenate...", "all_open title=_timeseries open");
saveAs("Tiff", dir + "_timeseries.tif");
close();
print("finished");