-
Notifications
You must be signed in to change notification settings - Fork 0
/
My_Batch_Subtract_Images.txt
55 lines (29 loc) · 1.07 KB
/
My_Batch_Subtract_Images.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
50
51
52
53
54
55
inputDir = getDirectory("Choose Source Directory ");
outputDir = getDirectory("Choose Destination Directory ");
setBatchMode(true);
list = getFileList(inputDir);
//for (i=0; i<5; i++) {
for (i=0; i<list.length-1; i++) {
showProgress(i+1, list.length);
// open first image
open(inputDir+list[i]);
imageFirst = getTitle;
idFirst = getImageID;
// open second image
open(inputDir+list[i+1]);
imageSecond = getTitle;
idSecond = getImageID;
imageCalculator("Subtract create 32-bit", imageSecond , imageFirst);
run("Scale...", "x=0.5 y=0.5 interpolate create title=Scaled");
//run("8-bit");
//run("Specify...", "width=1500 height=1750 x=300 y=0");
//run("Crop");
//selectImage(idImage);
//close();
idImageRes = getImageID;
saveAs("TIFF", outputDir+list[i]);
//saveAs("PGM", outputDir+list[i]);
//saveAs("Raw Data", outputDir+list[i]);
run("Close All Without Saving");
}
showMessage("Finished");