-
Notifications
You must be signed in to change notification settings - Fork 0
/
Save_text_image_whole_stack.ijm
60 lines (47 loc) · 1.44 KB
/
Save_text_image_whole_stack.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
53
54
55
56
57
58
59
60
/* Generate text images from a folder full of image files
* 14 December 2018
*
* Select folder containing images
* Selects the appropriate channels (user specified)
* Select middle slice of the stack
* Save the slice as a text image
*/
// Load files
dir1 = getDirectory("/Volumes/bioc1301/data/20160929_Gal80_FISH/Files/");
list = getFileList(dir1);
// Define channel
smFISH_channel1 = 1
smFISH_channel2 = 2
setBatchMode(true);
// Set up loop to read all files in a directory
for (i=0; i<list.length; i++) {
showProgress(i+1, list.length);
print("processing ... "+i+1+"/"+list.length+"\n "+list[i]);
path=dir1+list[i];
// Open file
run("Bio-Formats", "open=path autoscale color_mode=Default view=Hyperstack stack_order=XYCZT series_");
// Insert Macro here
// Crop edges (for deconvolved Airyscan data)
makeRectangle(13, 15, 922, 926);
run("Crop");
// Duplicate and select specific channel
original = getTitle();
run("Duplicate...", "duplicate channels=smFISH_channel1");
ch1 = getTitle();
selectWindow(original);
run("Duplicate...", "duplicate channels=smFISH_channel2");
ch2 = getTitle();
selectWindow(original);
close();
selectWindow(ch1);
setSlice(nSlices/2);
print(dir1+"ch1_"+list[i]);
saveAs("Text Image", dir1+"ch1_"+list[i]);
close();
selectWindow(ch2);
setSlice(nSlices/2);
print(dir1+"ch2_"+list[i]);
saveAs("Text Image", dir1+"ch2_"+list[i]);
close();
}
setBatchMode(false);